panfrost: Move the batch stack size adjustment out of panfrost_queue_draw()
authorBoris Brezillon <boris.brezillon@collabora.com>
Thu, 5 Mar 2020 07:58:10 +0000 (08:58 +0100)
committerBoris Brezillon <boris.brezillon@collabora.com>
Tue, 10 Mar 2020 11:47:33 +0000 (12:47 +0100)
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 <boris.brezillon@collabora.com>
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4083>

src/gallium/drivers/panfrost/pan_context.c
src/gallium/drivers/panfrost/pan_job.c
src/gallium/drivers/panfrost/pan_job.h

index 83067e30446cd53a81d1e929574adc1b1a4abc98..19407658c1daf86f419ad60cd813b3368e062388 100644 (file)
@@ -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! */
index 62ce2e36bc9b8e4cc48117cc967480a39b586562..359cfef3615324e860be6edd4f0a865baeca6f05 100644 (file)
@@ -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
index 59279925e36412ed351ab8f5915defad98ad22f9..9ed544f6c63c4483533e98838d2beffe65a26d52 100644 (file)
@@ -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);