We'll compute the size with the new scratchpad helpers.
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
}
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 *
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);
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),
.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;
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),
.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),
};