Module: Mesa
Branch: main
Commit: c1429a3120037a1599b4187eaca31fec413b2579
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c1429a3120037a1599b4187eaca31fec413b2579

Author: Louis-Francis Ratté-Boulianne <[email protected]>
Date:   Fri Oct  6 21:19:10 2023 -0400

panfrost: Split out internal of `panfrost_launch_grid`

For an upcoming feature (AFBC packing), we're gonna run internal
compute shaders on resources. This commit just split the internal
of `panfrost_launch_grid` so we can run the shader on a given
batch.

Signed-off-by: Louis-Francis Ratté-Boulianne <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25012>

---

 src/gallium/drivers/panfrost/pan_cmdstream.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c 
b/src/gallium/drivers/panfrost/pan_cmdstream.c
index c87ea468b9a..75960171eb2 100644
--- a/src/gallium/drivers/panfrost/pan_cmdstream.c
+++ b/src/gallium/drivers/panfrost/pan_cmdstream.c
@@ -3757,17 +3757,12 @@ panfrost_draw_vbo(struct pipe_context *pipe, const 
struct pipe_draw_info *info,
  */
 
 static void
-panfrost_launch_grid(struct pipe_context *pipe,
-                     const struct pipe_grid_info *info)
+panfrost_launch_grid_on_batch(struct pipe_context *pipe,
+                              struct panfrost_batch *batch,
+                              const struct pipe_grid_info *info)
 {
    struct panfrost_context *ctx = pan_context(pipe);
 
-   /* XXX - shouldn't be necessary with working memory barriers. Affected
-    * test: KHR-GLES31.core.compute_shader.pipeline-post-xfb */
-   panfrost_flush_all_batches(ctx, "Launch grid pre-barrier");
-
-   struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
-
    if (info->indirect && !PAN_GPU_INDIRECTS) {
       struct pipe_transfer *transfer;
       uint32_t *params =
@@ -3782,7 +3777,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
       pipe_buffer_unmap(pipe, transfer);
 
       if (params[0] && params[1] && params[2])
-         panfrost_launch_grid(pipe, &direct);
+         panfrost_launch_grid_on_batch(pipe, batch, &direct);
 
       return;
    }
@@ -3878,6 +3873,21 @@ panfrost_launch_grid(struct pipe_context *pipe,
    panfrost_add_job(&batch->pool.base, &batch->scoreboard,
                     MALI_JOB_TYPE_COMPUTE, true, false, indirect_dep, 0, &t,
                     false);
+}
+
+static void
+panfrost_launch_grid(struct pipe_context *pipe,
+                     const struct pipe_grid_info *info)
+{
+   struct panfrost_context *ctx = pan_context(pipe);
+
+   /* XXX - shouldn't be necessary with working memory barriers. Affected
+    * test: KHR-GLES31.core.compute_shader.pipeline-post-xfb */
+   panfrost_flush_all_batches(ctx, "Launch grid pre-barrier");
+
+   struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
+   panfrost_launch_grid_on_batch(pipe, batch, info);
+
    panfrost_flush_all_batches(ctx, "Launch grid post-barrier");
 }
 

Reply via email to