radeonsi: rewrite si_update_ps_colorbuf0_slot to fix crashes and recursions
authorMarek Olšák <marek.olsak@amd.com>
Tue, 13 Dec 2022 19:10:29 +0000 (14:10 -0500)
committerMarge Bot <emma+marge@anholt.net>
Tue, 10 Jan 2023 21:26:39 +0000 (21:26 +0000)
commit3632d398359cce1fb666b8cf6299ba624d3ccda7
treed1458ad22481467a26c981c047025ceb8d24bf2d
parent8bc51d78a577f2321be7ecb9bf86a8a193fe9018
radeonsi: rewrite si_update_ps_colorbuf0_slot to fix crashes and recursions

I'm convinced that u_blitter interactions with fbfetch can't be handled
in si_update_ps_colorbuf0_slot alone, so it has to be force-disabled
by si_blitter_begin. Another reason why it has to be disabled for u_blitter
and not ignored is because FBFETCH with MSAA enables sample shading
regardless of context states, and we don't want that for u_blitter.

Also, si_update_ps_colorbuf0_slot now disables FBFETCH explicitly before
its own DCC and CMASK decompression because even though u_blitter can't do
anything (due to blitter_running), si_blitter_end calls it too.

The result is that no recursion can occur thanks to the blitter_running
and suppress_update_ps_colorbuf0_slot flags, and FBFETCH is always
force-disabled before those flags are set, which is the state we want
to be in.

Fixes: bc6d22b9200 ("radeonsi: fix ps_uses_fbfetch value")

Acked-by: Yogesh Mohan Marimuthu <yogesh.mohanmarimuthu@amd.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20318>
src/gallium/drivers/radeonsi/si_blit.c
src/gallium/drivers/radeonsi/si_compute_blit.c
src/gallium/drivers/radeonsi/si_descriptors.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state.h