diff options
author | Karol Herbst <kherbst@redhat.com> | 2022-05-15 19:20:40 +0200 |
---|---|---|
committer | Marge Bot <emma+marge@anholt.net> | 2022-08-30 23:08:19 +0000 |
commit | a5c5b172fdb27061d8fd4ef7d1dd38f99dc036cb (patch) | |
tree | b5bcd8de826adc301595dca3d670a89417834f16 /src/gallium/drivers/nouveau/nv50/nv50_surface.c | |
parent | df0a4d02f264a4c49b7503c5f564ac4c492f906f (diff) |
nv50: race free state tracking
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/nv50/nv50_surface.c')
-rw-r--r-- | src/gallium/drivers/nouveau/nv50/nv50_surface.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/gallium/drivers/nouveau/nv50/nv50_surface.c b/src/gallium/drivers/nouveau/nv50/nv50_surface.c index 6f28c97cc73..983a67200ff 100644 --- a/src/gallium/drivers/nouveau/nv50/nv50_surface.c +++ b/src/gallium/drivers/nouveau/nv50/nv50_surface.c @@ -534,9 +534,11 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso unsigned i, j, k; uint32_t mode = 0; + simple_mtx_lock(&nv50->screen->state_lock); + /* don't need NEW_BLEND, COLOR_MASK doesn't affect CLEAR_BUFFERS */ if (!nv50_state_validate_3d(nv50, NV50_NEW_3D_FRAMEBUFFER)) - return; + goto out; if (scissor_state) { uint32_t minx = scissor_state->minx; @@ -544,7 +546,7 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso uint32_t miny = scissor_state->miny; uint32_t maxy = MIN2(fb->height, scissor_state->maxy); if (maxx <= minx || maxy <= miny) - return; + goto out; BEGIN_NV04(push, NV50_3D(SCREEN_SCISSOR_HORIZ), 2); PUSH_DATA (push, minx | (maxx - minx) << 16); @@ -622,6 +624,10 @@ nv50_clear(struct pipe_context *pipe, unsigned buffers, const struct pipe_scisso PUSH_DATA (push, fb->width << 16); PUSH_DATA (push, fb->height << 16); } + +out: + PUSH_KICK(push); + simple_mtx_unlock(&nv50->screen->state_lock); } static void @@ -1773,6 +1779,7 @@ nv50_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) info->src.box.height != -info->dst.box.height)) eng3d = true; + simple_mtx_lock(&nv50->screen->state_lock); if (nv50->screen->num_occlusion_queries_active) { BEGIN_NV04(push, NV50_3D(SAMPLECNT_ENABLE), 1); PUSH_DATA (push, 0); @@ -1787,6 +1794,8 @@ nv50_blit(struct pipe_context *pipe, const struct pipe_blit_info *info) BEGIN_NV04(push, NV50_3D(SAMPLECNT_ENABLE), 1); PUSH_DATA (push, 1); } + PUSH_KICK(push); + simple_mtx_unlock(&nv50->screen->state_lock); } static void |