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 <sroland@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
This commit is contained in:
Dave Airlie
2020-03-10 12:55:31 +10:00
committed by Marge Bot
parent 6befeb6607
commit f6383673c9
+5 -5
View File
@@ -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;
}