From: Dave Airlie Date: Tue, 10 Mar 2020 02:55:31 +0000 (+1000) Subject: llvmpipe: fix race between draw and setting fragment shader. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f6383673c96de2102edae0e705f7960753fe848b;p=mesa.git 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: --- 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; }