llvmpipe: Add some missing locking
The lp_rasterizer is shared across contexts, and lp_rast_fence called
without holding rast_mutex could race with rast_mutex being replaced and
unref'd on a different thread.
Fixes: a680fd078c ("llvmpipe: make last_fence a screen/rast object not a context one.")
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18116>
This commit is contained in:
@@ -57,7 +57,9 @@ llvmpipe_flush( struct pipe_context *pipe,
|
||||
/* ask the setup module to flush */
|
||||
lp_setup_flush(llvmpipe->setup, reason);
|
||||
|
||||
mtx_lock(&screen->rast_mutex);
|
||||
lp_rast_fence(screen->rast, (struct lp_fence **)fence);
|
||||
mtx_unlock(&screen->rast_mutex);
|
||||
if (fence && (!*fence))
|
||||
*fence = (struct pipe_fence_handle *)lp_fence_create(0);
|
||||
|
||||
|
||||
@@ -1714,7 +1714,9 @@ lp_setup_end_query(struct lp_setup_context *setup, struct llvmpipe_query *pq)
|
||||
}
|
||||
else {
|
||||
struct llvmpipe_screen *screen = llvmpipe_screen(setup->pipe->screen);
|
||||
mtx_lock(&screen->rast_mutex);
|
||||
lp_rast_fence(screen->rast, &pq->fence);
|
||||
mtx_unlock(&screen->rast_mutex);
|
||||
}
|
||||
|
||||
fail:
|
||||
|
||||
Reference in New Issue
Block a user