[Mesa-dev] [PATCH 05/19] radeonsi: separate IA_MULTI_VGT_PARAM and VGT_PRIMITIVE_TYPE emission

Marek Olšák maraeo at gmail.com
Sun Oct 2 21:09:20 UTC 2016


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

We want to emit IA_MULTI_VGT_PARAM less often because it's a context reg.
---
 src/gallium/drivers/radeonsi/si_state_draw.c | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index a337445..58f32fb 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -466,32 +466,35 @@ static void si_emit_draw_registers(struct si_context *sctx,
 			sctx->last_vtx_reuse_depth = vtx_reuse_depth;
 		}
 	}
 
 	if (sctx->tes_shader.cso)
 		si_emit_derived_tess_state(sctx, info, &num_patches);
 
 	ia_multi_vgt_param = si_get_ia_multi_vgt_param(sctx, info, num_patches);
 
 	/* Draw state. */
-	if (prim != sctx->last_prim ||
-	    ia_multi_vgt_param != sctx->last_multi_vgt_param) {
-		if (sctx->b.chip_class >= CIK) {
+	if (ia_multi_vgt_param != sctx->last_multi_vgt_param) {
+		if (sctx->b.chip_class >= CIK)
 			radeon_set_context_reg_idx(cs, R_028AA8_IA_MULTI_VGT_PARAM, 1, ia_multi_vgt_param);
+		else
+			radeon_set_context_reg(cs, R_028AA8_IA_MULTI_VGT_PARAM, ia_multi_vgt_param);
+
+		sctx->last_multi_vgt_param = ia_multi_vgt_param;
+	}
+	if (prim != sctx->last_prim) {
+		if (sctx->b.chip_class >= CIK)
 			radeon_set_uconfig_reg_idx(cs, R_030908_VGT_PRIMITIVE_TYPE, 1, prim);
-		} else {
+		else
 			radeon_set_config_reg(cs, R_008958_VGT_PRIMITIVE_TYPE, prim);
-			radeon_set_context_reg(cs, R_028AA8_IA_MULTI_VGT_PARAM, ia_multi_vgt_param);
-		}
 
 		sctx->last_prim = prim;
-		sctx->last_multi_vgt_param = ia_multi_vgt_param;
 	}
 
 	if (gs_out_prim != sctx->last_gs_out_prim) {
 		radeon_set_context_reg(cs, R_028A6C_VGT_GS_OUT_PRIM_TYPE, gs_out_prim);
 		sctx->last_gs_out_prim = gs_out_prim;
 	}
 
 	/* Primitive restart. */
 	if (info->primitive_restart != sctx->last_primitive_restart_en) {
 		radeon_set_context_reg(cs, R_028A94_VGT_MULTI_PRIM_IB_RESET_EN, info->primitive_restart);
-- 
2.7.4



More information about the mesa-dev mailing list