radeonsi/gfx11: fix GLCTS with register shadowing by keeping the CS preamble
authorMarek Olšák <marek.olsak@amd.com>
Sun, 11 Jun 2023 02:07:40 +0000 (22:07 -0400)
committerMarge Bot <emma+marge@anholt.net>
Thu, 22 Jun 2023 08:35:55 +0000 (08:35 +0000)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23517>

src/gallium/drivers/radeonsi/si_cp_reg_shadowing.c

index 2d73740..aaae69f 100644 (file)
@@ -76,11 +76,15 @@ void si_init_cp_reg_shadowing(struct si_context *sctx)
                                    RADEON_USAGE_READWRITE | RADEON_PRIO_DESCRIPTORS);
       si_pm4_emit(sctx, shadowing_preamble);
       ac_emulate_clear_state(&sctx->screen->info, &sctx->gfx_cs, si_set_context_reg_array);
-      si_pm4_emit(sctx, sctx->cs_preamble_state);
 
-      /* The register values are shadowed, so we won't need to set them again. */
-      si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0);
-      sctx->cs_preamble_state = NULL;
+      /* TODO: Gfx11 fails GLCTS if we don't re-emit the preamble at the beginning of every IB. */
+      if (sctx->gfx_level < GFX11) {
+         si_pm4_emit(sctx, sctx->cs_preamble_state);
+
+         /* The register values are shadowed, so we won't need to set them again. */
+         si_pm4_free_state(sctx, sctx->cs_preamble_state, ~0);
+         sctx->cs_preamble_state = NULL;
+      }
 
       si_set_tracked_regs_to_clear_state(sctx);