[Mesa-dev] [PATCH 12/18] radeonsi: emit GS_OUT_PRIM_TYPE only if it changes

Marek Olšák maraeo at gmail.com
Tue Dec 9 03:40:00 PST 2014


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

---
 src/gallium/drivers/radeonsi/si_hw_context.c | 1 +
 src/gallium/drivers/radeonsi/si_pipe.h       | 1 +
 src/gallium/drivers/radeonsi/si_state_draw.c | 5 ++++-
 3 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index a7e29b1..f7dcd80 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -160,4 +160,5 @@ void si_begin_new_cs(struct si_context *ctx)
 	ctx->last_sh_base_reg = -1; /* reset to an unknown value */
 	ctx->last_primitive_restart_en = -1;
 	ctx->last_restart_index = SI_RESTART_INDEX_UNKNOWN;
+	ctx->last_gs_out_prim = -1;
 }
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index b4a1ea0..65a9393 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -182,6 +182,7 @@ struct si_context {
 	int			last_sh_base_reg;
 	int			last_primitive_restart_en;
 	int			last_restart_index;
+	int			last_gs_out_prim;
 };
 
 /* si_blit.c */
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index fedf19b..7a7f85a 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -192,7 +192,10 @@ static void si_emit_draw_registers(struct si_context *sctx,
 		r600_write_context_reg(cs, R_028AA8_IA_MULTI_VGT_PARAM, ia_multi_vgt_param);
 	}
 
-	r600_write_context_reg(cs, R_028A6C_VGT_GS_OUT_PRIM_TYPE, gs_out_prim);
+	if (gs_out_prim != sctx->last_gs_out_prim) {
+		r600_write_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) {
-- 
2.1.0



More information about the mesa-dev mailing list