[Mesa-dev] [PATCH 12/20] radeonsi: fix a badly implemented GS bug workaround

Marek Olšák maraeo at gmail.com
Mon Aug 29 15:28:27 UTC 2016


From: Marek Olšák <marek.olsak at amd.com>

Limit it to geometry shaders and Hawaii.
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index bcf1104..60cc3f0 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -337,40 +337,45 @@ static unsigned si_get_ia_multi_vgt_param(struct si_context *sctx,
 		    (sctx->b.family == CHIP_HAWAII ||
 		     (sctx->b.chip_class == VI &&
 		      (sctx->gs_shader.cso || max_primgroup_in_wave != 2))))
 			partial_vs_wave = true;
 
 		/* Instancing bug on Bonaire. */
 		if (sctx->b.family == CHIP_BONAIRE && ia_switch_on_eoi &&
 		    (info->indirect || info->instance_count > 1))
 			partial_vs_wave = true;
 
+		/* GS hw bug with single-primitive instances and SWITCH_ON_EOI.
+		 * The hw doc says all multi-SE chips are affected, but Vulkan
+		 * only applies it to Hawaii. Do what Vulkan does.
+		 */
+		if (sctx->b.family == CHIP_HAWAII &&
+		    sctx->gs_shader.cso &&
+		    ia_switch_on_eoi &&
+		    (info->indirect ||
+		     (info->instance_count > 1 &&
+		      si_num_prims_for_vertices(info) <= 1)))
+			sctx->b.flags |= SI_CONTEXT_VGT_FLUSH;
+
+
 		/* If the WD switch is false, the IA switch must be false too. */
 		assert(wd_switch_on_eop || !ia_switch_on_eop);
 	}
 
 	/* If SWITCH_ON_EOI is set, PARTIAL_ES_WAVE must be set too. */
 	if (ia_switch_on_eoi)
 		partial_es_wave = true;
 
 	/* GS requirement. */
 	if (SI_GS_PER_ES / primgroup_size >= sctx->screen->gs_table_depth - 3)
 		partial_es_wave = true;
 
-	/* Hw bug with single-primitive instances and SWITCH_ON_EOI
-	 * on multi-SE chips. */
-	if (sctx->b.screen->info.max_se >= 2 && ia_switch_on_eoi &&
-	    (info->indirect ||
-	     (info->instance_count > 1 &&
-	      si_num_prims_for_vertices(info) <= 1)))
-		sctx->b.flags |= SI_CONTEXT_VGT_FLUSH;
-
 	return S_028AA8_SWITCH_ON_EOP(ia_switch_on_eop) |
 		S_028AA8_SWITCH_ON_EOI(ia_switch_on_eoi) |
 		S_028AA8_PARTIAL_VS_WAVE_ON(partial_vs_wave) |
 		S_028AA8_PARTIAL_ES_WAVE_ON(partial_es_wave) |
 		S_028AA8_PRIMGROUP_SIZE(primgroup_size - 1) |
 		S_028AA8_WD_SWITCH_ON_EOP(sctx->b.chip_class >= CIK ? wd_switch_on_eop : 0) |
 		S_028AA8_MAX_PRIMGRP_IN_WAVE(sctx->b.chip_class >= VI ?
 					     max_primgroup_in_wave : 0);
 }
 
-- 
2.7.4



More information about the mesa-dev mailing list