diff options
author | Karol Herbst <kherbst@redhat.com> | 2021-06-17 18:56:24 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-08-30 23:08:19 +0000 |
commit | df0a4d02f264a4c49b7503c5f564ac4c492f906f (patch) | |
tree | 5fd2b41c0d3dc231611552afe70fbe1f6214a755 /src/gallium/drivers/nouveau/nvc0/nvc0_compute.c | |
parent | f2af3a9cae22f5e644c55a3c75513fbf726d8004 (diff) |
nvc0: make state handling race free
I am not entirely convinced that contexts can't mess up the state of other
contexts, but with this we at least turn down the amount of races on the
CPU side.
If we hit bugs later we can always look into it then and figure out what
to fix how.
I think we might need a better solution for it in the future as state
tracking might need to become more involved, but for now this should be
good enough.
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Acked-by: M Henning <drawoc@darkrefraction.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10752>
Diffstat (limited to 'src/gallium/drivers/nouveau/nvc0/nvc0_compute.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nvc0/nvc0_compute.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c index 24ee9bfff6c..b2b00f4ba98 100644 --- a/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c +++ b/src/gallium/drivers/nouveau/nvc0/nvc0_compute.c @@ -428,10 +428,11 @@ nvc0_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) struct nvc0_program *cp = nvc0->compprog; int ret; + simple_mtx_lock(&screen->state_lock); ret = !nvc0_state_validate_cp(nvc0, ~0); if (ret) { NOUVEAU_ERR("Failed to launch grid !\n"); - return; + goto out; } nvc0_compute_upload_input(nvc0, info); @@ -502,6 +503,10 @@ nvc0_launch_grid(struct pipe_context *pipe, const struct pipe_grid_info *info) nvc0->images_dirty[5] |= nvc0->images_valid[5]; nvc0_update_compute_invocations_counter(nvc0, info); + +out: + PUSH_KICK(push); + simple_mtx_unlock(&screen->state_lock); } static void |