From ad7457fe20e37acd9031cba2537ad24859f6f07e Mon Sep 17 00:00:00 2001 From: "Eric R. Smith" Date: Mon, 1 Apr 2024 11:09:28 -0300 Subject: [PATCH] panfrost: mark indirect compute buffer as read When we dispatch an indirect compute job, the buffer containing the indirect parameters should be marked as read (since the GPU will read the parameters from there). Without this there's a race condition if the CPU later updates the buffer. Signed-off-by: Eric R. Smith Reviewed-by: Boris Brezillon Cc: mesa-stable Part-of: --- src/gallium/drivers/panfrost/pan_cmdstream.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gallium/drivers/panfrost/pan_cmdstream.c b/src/gallium/drivers/panfrost/pan_cmdstream.c index 02e480f1293..55afd4a61cf 100644 --- a/src/gallium/drivers/panfrost/pan_cmdstream.c +++ b/src/gallium/drivers/panfrost/pan_cmdstream.c @@ -3065,6 +3065,11 @@ panfrost_launch_grid_on_batch(struct pipe_context *pipe, mali_ptr saved_tls = batch->tls.gpu; batch->tls.gpu = panfrost_emit_shared_memory(batch, info); + /* if indirect, mark the indirect buffer as being read */ + if (info->indirect) + panfrost_batch_read_rsrc(batch, pan_resource(info->indirect), PIPE_SHADER_COMPUTE); + + /* launch it */ JOBX(launch_grid)(batch, info); batch->compute_count++; batch->tls.gpu = saved_tls;