From 79f8850527756dd0d0e861a59d8c7e6700314a5d Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Thu, 5 Mar 2020 08:58:10 +0100 Subject: [PATCH] panfrost: Move the batch stack size adjustment out of panfrost_queue_draw() That's part of our attempt to sanitize panfrost_queue_draw(), panfrost_draw_vbo() and panfrost_emit_for_draw(). The new panfrost_batch_adjust_stack_size() helper is placed in pan_job.c, where all batch related functions live. Signed-off-by: Boris Brezillon Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_context.c | 9 +-------- src/gallium/drivers/panfrost/pan_job.c | 16 ++++++++++++++++ src/gallium/drivers/panfrost/pan_job.h | 3 +++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_context.c b/src/gallium/drivers/panfrost/pan_context.c index 83067e3..1940765 100644 --- a/src/gallium/drivers/panfrost/pan_context.c +++ b/src/gallium/drivers/panfrost/pan_context.c @@ -1157,14 +1157,7 @@ panfrost_queue_draw(struct panfrost_context *ctx) panfrost_new_job(batch, JOB_TYPE_TILER, false, vertex, tiler_payload, sizeof(*tiler_payload), false); } - for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i) { - struct panfrost_shader_state *ss = panfrost_get_shader_state(ctx, i); - - if (!ss) - continue; - - batch->stack_size = MAX2(batch->stack_size, ss->stack_size); - } + panfrost_batch_adjust_stack_size(batch); } /* The entire frame is in memory -- send it off to the kernel! */ diff --git a/src/gallium/drivers/panfrost/pan_job.c b/src/gallium/drivers/panfrost/pan_job.c index 62ce2e3..359cfef 100644 --- a/src/gallium/drivers/panfrost/pan_job.c +++ b/src/gallium/drivers/panfrost/pan_job.c @@ -1127,6 +1127,22 @@ panfrost_batch_set_requirements(struct panfrost_batch *batch) batch->requirements |= PAN_REQ_DEPTH_WRITE; } +void +panfrost_batch_adjust_stack_size(struct panfrost_batch *batch) +{ + struct panfrost_context *ctx = batch->ctx; + + for (unsigned i = 0; i < PIPE_SHADER_TYPES; ++i) { + struct panfrost_shader_state *ss; + + ss = panfrost_get_shader_state(ctx, i); + if (!ss) + continue; + + batch->stack_size = MAX2(batch->stack_size, ss->stack_size); + } +} + /* Helper to smear a 32-bit color across 128-bit components */ static void diff --git a/src/gallium/drivers/panfrost/pan_job.h b/src/gallium/drivers/panfrost/pan_job.h index 5927992..9ed544f 100644 --- a/src/gallium/drivers/panfrost/pan_job.h +++ b/src/gallium/drivers/panfrost/pan_job.h @@ -190,6 +190,9 @@ panfrost_flush_batches_accessing_bo(struct panfrost_context *ctx, void panfrost_batch_set_requirements(struct panfrost_batch *batch); +void +panfrost_batch_adjust_stack_size(struct panfrost_batch *batch); + struct panfrost_bo * panfrost_batch_get_scratchpad(struct panfrost_batch *batch, unsigned shift, unsigned thread_tls_alloc, unsigned core_count); -- 2.7.4