aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/panfrost
diff options
context:
space:
mode:
authorAlyssa Rosenzweig <[email protected]>2019-12-09 11:02:15 -0500
committerAlyssa Rosenzweig <[email protected]>2019-12-13 10:26:35 -0500
commit4f7fddbd7169a2976b56edb39d15c64206e31ebc (patch)
treebfd786b32611c07b38ed12f0fc5456163e97d21b /src/gallium/drivers/panfrost
parentbc887e82818ac2c8f2011da70d7bddb8975b66c3 (diff)
panfrost: Pass size to panfrost_batch_get_scratchpad
We'll compute the size with the new scratchpad helpers. Signed-off-by: Alyssa Rosenzweig <[email protected]>
Diffstat (limited to 'src/gallium/drivers/panfrost')
-rw-r--r--src/gallium/drivers/panfrost/pan_job.c26
-rw-r--r--src/gallium/drivers/panfrost/pan_job.h6
-rw-r--r--src/gallium/drivers/panfrost/pan_mfbd.c10
-rw-r--r--src/gallium/drivers/panfrost/pan_sfbd.c11
4 files changed, 35 insertions, 18 deletions
diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c
index a36edae2a26..dbab1df1b83 100644
--- a/src/gallium/drivers/panfrost/pan_job.c
+++ b/src/gallium/drivers/panfrost/pan_job.c
@@ -636,19 +636,21 @@ panfrost_batch_get_polygon_list(struct panfrost_batch *batch, unsigned size)
}
struct panfrost_bo *
-panfrost_batch_get_scratchpad(struct panfrost_batch *batch)
+panfrost_batch_get_scratchpad(struct panfrost_batch *batch,
+ unsigned shift,
+ unsigned thread_tls_alloc,
+ unsigned core_count)
{
- if (batch->scratchpad)
- return batch->scratchpad;
-
- batch->scratchpad = panfrost_batch_create_bo(batch, 64 * 4 * 4096,
- PAN_BO_INVISIBLE,
- PAN_BO_ACCESS_PRIVATE |
- PAN_BO_ACCESS_RW |
- PAN_BO_ACCESS_VERTEX_TILER |
- PAN_BO_ACCESS_FRAGMENT);
- assert(batch->scratchpad);
- return batch->scratchpad;
+ unsigned size = panfrost_get_total_stack_size(shift,
+ thread_tls_alloc,
+ core_count);
+
+ return panfrost_batch_create_bo(batch, size,
+ PAN_BO_INVISIBLE,
+ PAN_BO_ACCESS_PRIVATE |
+ PAN_BO_ACCESS_RW |
+ PAN_BO_ACCESS_VERTEX_TILER |
+ PAN_BO_ACCESS_FRAGMENT);
}
struct panfrost_bo *
diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h
index aa4966f0633..ab2db010ef9 100644
--- a/src/gallium/drivers/panfrost/pan_job.h
+++ b/src/gallium/drivers/panfrost/pan_job.h
@@ -202,13 +202,13 @@ panfrost_flush_batches_accessing_bo(struct panfrost_context *ctx,
void
panfrost_batch_set_requirements(struct panfrost_batch *batch);
+struct panfrost_bo *
+panfrost_batch_get_scratchpad(struct panfrost_batch *batch, unsigned shift, unsigned thread_tls_alloc, unsigned core_count);
+
mali_ptr
panfrost_batch_get_polygon_list(struct panfrost_batch *batch, unsigned size);
struct panfrost_bo *
-panfrost_batch_get_scratchpad(struct panfrost_batch *batch);
-
-struct panfrost_bo *
panfrost_batch_get_tiler_heap(struct panfrost_batch *batch);
struct panfrost_bo *
diff --git a/src/gallium/drivers/panfrost/pan_mfbd.c b/src/gallium/drivers/panfrost/pan_mfbd.c
index 211ef7e4944..0f2931a58b3 100644
--- a/src/gallium/drivers/panfrost/pan_mfbd.c
+++ b/src/gallium/drivers/panfrost/pan_mfbd.c
@@ -354,9 +354,15 @@ panfrost_mfbd_upload(struct panfrost_batch *batch,
static struct bifrost_framebuffer
panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
{
+ struct panfrost_context *ctx = batch->ctx;
+ struct pipe_context *gallium = (struct pipe_context *) ctx;
+ struct panfrost_screen *screen = pan_screen(gallium->screen);
+
unsigned width = batch->key.width;
unsigned height = batch->key.height;
+ unsigned shift = panfrost_get_stack_shift(batch->stack_size);
+
struct bifrost_framebuffer framebuffer = {
.width1 = MALI_POSITIVE(width),
.height1 = MALI_POSITIVE(height),
@@ -371,9 +377,9 @@ panfrost_emit_mfbd(struct panfrost_batch *batch, unsigned vertex_count)
.unknown2 = 0x1f,
.tiler = panfrost_emit_midg_tiler(batch, vertex_count),
- .stack_shift = 0x5,
+ .stack_shift = shift,
.unk0 = 0x1e,
- .scratchpad = panfrost_batch_get_scratchpad(batch)->gpu
+ .scratchpad = panfrost_batch_get_scratchpad(batch, shift, screen->thread_tls_alloc, screen->core_count)->gpu
};
return framebuffer;
diff --git a/src/gallium/drivers/panfrost/pan_sfbd.c b/src/gallium/drivers/panfrost/pan_sfbd.c
index ccf23253b51..eb0f24b0a8a 100644
--- a/src/gallium/drivers/panfrost/pan_sfbd.c
+++ b/src/gallium/drivers/panfrost/pan_sfbd.c
@@ -198,9 +198,18 @@ panfrost_sfbd_set_zsbuf(
static struct mali_single_framebuffer
panfrost_emit_sfbd(struct panfrost_batch *batch, unsigned vertex_count)
{
+ struct panfrost_context *ctx = batch->ctx;
+ struct pipe_context *gallium = (struct pipe_context *) ctx;
+ struct panfrost_screen *screen = pan_screen(gallium->screen);
+
unsigned width = batch->key.width;
unsigned height = batch->key.height;
+ /* TODO: Why do we need to make the stack bigger than other platforms? */
+ unsigned shift = panfrost_get_stack_shift(MAX2(batch->stack_size, 512));
+
+ /* TODO: where do we specify the shift? */
+
struct mali_single_framebuffer framebuffer = {
.width = MALI_POSITIVE(width),
.height = MALI_POSITIVE(height),
@@ -209,7 +218,7 @@ panfrost_emit_sfbd(struct panfrost_batch *batch, unsigned vertex_count)
.unk3 = 0x3,
},
.clear_flags = 0x1000,
- .scratchpad = panfrost_batch_get_scratchpad(batch)->gpu,
+ .scratchpad = panfrost_batch_get_scratchpad(batch, shift, screen->thread_tls_alloc, screen->core_count)->gpu,
.tiler = panfrost_emit_midg_tiler(batch, vertex_count),
};