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 <eric.smith@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28512>
(cherry picked from commit ad7457fe20)
This commit is contained in:
Eric R. Smith 2024-04-01 11:09:28 -03:00 committed by Eric Engestrom
parent 24fd8685b7
commit 721dbc0afe
2 changed files with 6 additions and 1 deletions

View file

@ -3694,7 +3694,7 @@
"description": "panfrost: mark indirect compute buffer as read",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -3021,6 +3021,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;