panfrost: Allow passing an explicit global dependency when queuing a job
authorBoris Brezillon <boris.brezillon@collabora.com>
Sat, 27 Feb 2021 10:50:51 +0000 (11:50 +0100)
committerMarge Bot <eric+marge@anholt.net>
Thu, 11 Mar 2021 14:30:19 +0000 (14:30 +0000)
We will have 2 compute jobs per indexed indirect draw, one doing the
min-max index search and one patching the cmdstream. The second compute
job needs to depend on the first one, as well as the previous indirect
draw job to avoid corrupting the indirect draw context which is shared
at the batch level (global dependency).

Instead of handling that case in panfrost_add_job(), extend
panfrost_add_job() to accept an explicit global dependency.

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/9520>

src/gallium/drivers/panfrost/pan_cmdstream.c
src/gallium/drivers/panfrost/pan_compute.c
src/panfrost/lib/pan_blit.c
src/panfrost/lib/pan_scoreboard.c
src/panfrost/lib/pan_scoreboard.h

index 8d8f867..24926bb 100644 (file)
@@ -2222,11 +2222,11 @@ panfrost_emit_vertex_tiler_jobs(struct panfrost_batch *batch,
 
         unsigned vertex = panfrost_add_job(&batch->pool, &batch->scoreboard,
                                            MALI_JOB_TYPE_VERTEX, false, false,
-                                           0, vertex_job, false);
+                                           0, 0, vertex_job, false);
 
         if (ctx->rasterizer->base.rasterizer_discard)
                 return;
 
         panfrost_add_job(&batch->pool, &batch->scoreboard, MALI_JOB_TYPE_TILER,
-                         false, false, vertex, tiler_job, false);
+                         false, false, vertex, 0, tiler_job, false);
 }
index c1d04f6..f17efe8 100644 (file)
@@ -160,7 +160,7 @@ panfrost_launch_grid(struct pipe_context *pipe,
         pan_section_pack(t.cpu, COMPUTE_JOB, DRAW_PADDING, cfg);
 
         panfrost_add_job(&batch->pool, &batch->scoreboard,
-                         MALI_JOB_TYPE_COMPUTE, true, false, 0, &t, true);
+                         MALI_JOB_TYPE_COMPUTE, true, false, 0, 0, &t, true);
         panfrost_flush_all_batches(ctx);
 }
 
index d3433e5..fa32f05 100644 (file)
@@ -488,7 +488,7 @@ panfrost_load_midg(struct pan_pool *pool,
                                           1, vertex_count, 1, 1, 1, 1, true);
 
         panfrost_add_job(pool, scoreboard, MALI_JOB_TYPE_TILER, false, false,
-                         0, &t, true);
+                         0, 0, &t, true);
 }
 
 static void
@@ -685,5 +685,5 @@ panfrost_load_bifrost(struct pan_pool *pool,
         }
 
         panfrost_add_job(pool, scoreboard, MALI_JOB_TYPE_TILER, false, false,
-                         0, &t, true);
+                         0, 0, &t, true);
 }
index afb13e5..2a77798 100644 (file)
@@ -111,12 +111,10 @@ panfrost_add_job(
                 struct pan_scoreboard *scoreboard,
                 enum mali_job_type type,
                 bool barrier, bool suppress_prefetch,
-                unsigned local_dep,
+                unsigned local_dep, unsigned global_dep,
                 const struct panfrost_ptr *job,
                 bool inject)
 {
-        unsigned global_dep = 0;
-
         if (type == MALI_JOB_TYPE_TILER) {
                 /* Tiler jobs must be chained, and on Midgard, the first tiler
                  * job must depend on the write value job, whose index we
index ad9cc10..44a3456 100644 (file)
@@ -60,7 +60,7 @@ panfrost_add_job(
                 struct pan_scoreboard *scoreboard,
                 enum mali_job_type type,
                 bool barrier, bool suppress_prefetch,
-                unsigned local_dep,
+                unsigned local_dep, unsigned global_dep,
                 const struct panfrost_ptr *job,
                 bool inject);