From 0b3bd7c5167c7d7a87ded47730641a4103996591 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Mon, 23 Nov 2020 13:48:42 +0100 Subject: [PATCH] radeonsi/gfx10: flush gfx cs on ngg -> legacy transition MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit with a sequence like this: glClear(STENCIL) glBeginTransformFeedback() ... glEndTransformFeedback() glClear(STENCIL) The second clear sometimes may produce an unexpected result. Calling si_flush_gfx_cs() when doing ngg -> legacy transition seems to be a valid workaround (both for the synthetic reproducer and the real Blender bug). Using flush flags or events (BOTTOM_OF_PIPE_TS, RESET_TO_LOWEST_VGT) didn't help. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2941 Cc: mesa-stable Reviewed-by: Marek Olšák Part-of: --- src/gallium/drivers/radeonsi/si_state_shaders.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 729f465..3ab959a 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -3039,8 +3039,13 @@ bool si_update_ngg(struct si_context *sctx) * VGT_FLUSH is also emitted at the beginning of IBs when legacy GS ring * pointers are set. */ - if ((sctx->chip_class == GFX10 || sctx->family == CHIP_SIENNA_CICHLID) && !new_ngg) + if ((sctx->chip_class == GFX10 || sctx->family == CHIP_SIENNA_CICHLID) && !new_ngg) { sctx->flags |= SI_CONTEXT_VGT_FLUSH; + if (sctx->chip_class == GFX10) { + /* Workaround for https://gitlab.freedesktop.org/mesa/mesa/-/issues/2941 */ + si_flush_gfx_cs(sctx, RADEON_FLUSH_ASYNC_START_NEXT_GFX_IB_NOW, NULL); + } + } sctx->ngg = new_ngg; sctx->last_gs_out_prim = -1; /* reset this so that it gets updated */ -- 2.7.4