From f6383673c96de2102edae0e705f7960753fe848b Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Tue, 10 Mar 2020 12:55:31 +1000 Subject: [PATCH] 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 Part-of: --- src/gallium/drivers/llvmpipe/lp_state_fs.c | 10 +++++----- 1 file 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; } -- 2.30.2