From 1758da0a7e412fa6d6054ee2dcc5a17f69b5ef9c Mon Sep 17 00:00:00 2001 From: Boris Brezillon Date: Sat, 27 Feb 2021 11:50:51 +0100 Subject: [PATCH] panfrost: Allow passing an explicit global dependency when queuing a job 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 Reviewed-by: Alyssa Rosenzweig Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 4 ++-- src/gallium/drivers/panfrost/pan_compute.c | 2 +- src/panfrost/lib/pan_blit.c | 4 ++-- src/panfrost/lib/pan_scoreboard.c | 4 +--- src/panfrost/lib/pan_scoreboard.h | 2 +- 5 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 8d8f867..24926bb 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -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); } diff --git a/src/gallium/drivers/panfrost/pan_compute.c b/src/gallium/drivers/panfrost/pan_compute.c index c1d04f6..f17efe8 100644 --- a/src/gallium/drivers/panfrost/pan_compute.c +++ b/src/gallium/drivers/panfrost/pan_compute.c @@ -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); } diff --git a/src/panfrost/lib/pan_blit.c b/src/panfrost/lib/pan_blit.c index d3433e5..fa32f05 100644 --- a/src/panfrost/lib/pan_blit.c +++ b/src/panfrost/lib/pan_blit.c @@ -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); } diff --git a/src/panfrost/lib/pan_scoreboard.c b/src/panfrost/lib/pan_scoreboard.c index afb13e5..2a77798 100644 --- a/src/panfrost/lib/pan_scoreboard.c +++ b/src/panfrost/lib/pan_scoreboard.c @@ -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 diff --git a/src/panfrost/lib/pan_scoreboard.h b/src/panfrost/lib/pan_scoreboard.h index ad9cc10..44a3456 100644 --- a/src/panfrost/lib/pan_scoreboard.h +++ b/src/panfrost/lib/pan_scoreboard.h @@ -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); -- 2.7.4