aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Airlie <[email protected]>2020-03-10 12:55:31 +1000
committerMarge Bot <[email protected]>2020-05-06 06:20:37 +0000
commitf6383673c96de2102edae0e705f7960753fe848b (patch)
treef199f882554de3d4ff01e428588ce2bc1cfa654b
parent6befeb66070498427e139d3ff86bfd0bd15b5668 (diff)
llvmpipe: fix race between draw and setting fragment shader.
There is a race with u_blitter shaders + pipeline shaders (aaline/aapoint) where the draw bind can cause a pipeline flush which can use bind_fs_state to be reenters and llvmpipe->fs gets the wrong value. Fix this by only setting the llvmpipe->fs value after the draw binding is complete. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
-rw-r--r--src/gallium/drivers/llvmpipe/lp_state_fs.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/gallium/drivers/llvmpipe/lp_state_fs.c b/src/gallium/drivers/llvmpipe/lp_state_fs.c
index 8826d499b47..425bb87df27 100644
--- a/src/gallium/drivers/llvmpipe/lp_state_fs.c
+++ b/src/gallium/drivers/llvmpipe/lp_state_fs.c
@@ -3071,14 +3071,14 @@ static void
llvmpipe_bind_fs_state(struct pipe_context *pipe, void *fs)
{
struct llvmpipe_context *llvmpipe = llvmpipe_context(pipe);
-
- if (llvmpipe->fs == fs)
+ struct lp_fragment_shader *lp_fs = (struct lp_fragment_shader *)fs;
+ if (llvmpipe->fs == lp_fs)
return;
- llvmpipe->fs = (struct lp_fragment_shader *) fs;
-
draw_bind_fragment_shader(llvmpipe->draw,
- (llvmpipe->fs ? llvmpipe->fs->draw_data : NULL));
+ (lp_fs ? lp_fs->draw_data : NULL));
+
+ llvmpipe->fs = lp_fs;
llvmpipe->dirty |= LP_NEW_FS;
}