radeonsi: fix ps_uses_fbfetch value
si_update_ps_colorbuf0_slot used blitter_running as a way to detect recursive calls. Unfortunately this catch too many cases; for instance a backtrace like: #0 si_update_ps_colorbuf0_slot #1 si_set_framebuffer_state #2 do_blits [...] #5 si_blit #6 si_copy_region_with_blit Would end-up not updating ps_uses_fbfetch; so if the new fb_state is something like: cbufs = {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}, zsbuf = 0x55b8987545e0} We can have ps_uses_fbfetch=true but cbufs[0] = NULL, which causes a crash later in si_ps_key_update_framebuffer. This commit fixes intermittent crashes in KHR-GL46.stencil_texturing.functional. Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13550>
This commit is contained in:
@@ -931,8 +931,11 @@ void si_update_ps_colorbuf0_slot(struct si_context *sctx)
|
||||
struct pipe_surface *surf = NULL;
|
||||
|
||||
/* si_texture_disable_dcc can get us here again. */
|
||||
if (sctx->blitter_running)
|
||||
if (sctx->in_update_ps_colorbuf0_slot) {
|
||||
assert(!sctx->ps_uses_fbfetch || sctx->framebuffer.state.cbufs[0]);
|
||||
return;
|
||||
}
|
||||
sctx->in_update_ps_colorbuf0_slot = true;
|
||||
|
||||
/* See whether FBFETCH is used and color buffer 0 is set. */
|
||||
if (sctx->shader.ps.cso && sctx->shader.ps.cso->info.base.fs.uses_fbfetch_output &&
|
||||
@@ -940,8 +943,11 @@ void si_update_ps_colorbuf0_slot(struct si_context *sctx)
|
||||
surf = sctx->framebuffer.state.cbufs[0];
|
||||
|
||||
/* Return if FBFETCH transitions from disabled to disabled. */
|
||||
if (!buffers->buffers[slot] && !surf)
|
||||
if (!buffers->buffers[slot] && !surf) {
|
||||
assert(!sctx->ps_uses_fbfetch);
|
||||
sctx->in_update_ps_colorbuf0_slot = false;
|
||||
return;
|
||||
}
|
||||
|
||||
sctx->ps_uses_fbfetch = surf != NULL;
|
||||
si_update_ps_iter_samples(sctx);
|
||||
@@ -989,6 +995,7 @@ void si_update_ps_colorbuf0_slot(struct si_context *sctx)
|
||||
}
|
||||
|
||||
sctx->descriptors_dirty |= 1u << SI_DESCS_INTERNAL;
|
||||
sctx->in_update_ps_colorbuf0_slot = false;
|
||||
}
|
||||
|
||||
/* SAMPLER STATES */
|
||||
|
@@ -984,6 +984,7 @@ struct si_context {
|
||||
uint16_t prefetch_L2_mask;
|
||||
|
||||
bool blitter_running;
|
||||
bool in_update_ps_colorbuf0_slot;
|
||||
bool is_noop:1;
|
||||
bool has_graphics:1;
|
||||
bool gfx_flush_in_progress : 1;
|
||||
|
Reference in New Issue
Block a user