[Mesa-dev] [PATCH 17/18] radeonsi: only emit line stippling and provoking vertex state when it changes

Marek Olšák maraeo at gmail.com
Tue Dec 9 03:40:05 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.c         | 1 +
 src/gallium/drivers/radeonsi/si_state_draw.c    | 5 +++++
 src/gallium/drivers/radeonsi/si_state_shaders.c | 1 +
 5 files changed, 9 insertions(+)

diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c
index 5892453..e18a358 100644
--- a/src/gallium/drivers/radeonsi/si_hw_context.c
+++ b/src/gallium/drivers/radeonsi/si_hw_context.c
@@ -163,4 +163,5 @@ void si_begin_new_cs(struct si_context *ctx)
 	ctx->last_gs_out_prim = -1;
 	ctx->last_prim = -1;
 	ctx->last_multi_vgt_param = -1;
+	ctx->last_rast_prim = -1;
 }
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index a55e1e4..04c886d 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -185,6 +185,7 @@ struct si_context {
 	int			last_gs_out_prim;
 	int			last_prim;
 	int			last_multi_vgt_param;
+	int			last_rast_prim;
 };
 
 /* si_blit.c */
diff --git a/src/gallium/drivers/radeonsi/si_state.c b/src/gallium/drivers/radeonsi/si_state.c
index fe9666f..1bb1f69 100644
--- a/src/gallium/drivers/radeonsi/si_state.c
+++ b/src/gallium/drivers/radeonsi/si_state.c
@@ -711,6 +711,7 @@ static void si_bind_rs_state(struct pipe_context *ctx, void *state)
 	si_update_fb_rs_state(sctx);
 
 	sctx->clip_regs.dirty = true;
+	sctx->last_rast_prim = -1; /* reset this so that it gets updated */
 }
 
 static void si_delete_rs_state(struct pipe_context *ctx, void *state)
diff --git a/src/gallium/drivers/radeonsi/si_state_draw.c b/src/gallium/drivers/radeonsi/si_state_draw.c
index 8408359..354eedf 100644
--- a/src/gallium/drivers/radeonsi/si_state_draw.c
+++ b/src/gallium/drivers/radeonsi/si_state_draw.c
@@ -156,6 +156,9 @@ static void si_emit_rasterizer_prim_state(struct si_context *sctx, unsigned mode
 	if (sctx->gs_shader)
 		mode = sctx->gs_shader->gs_output_prim;
 
+	if (mode == sctx->last_rast_prim)
+		return;
+
 	r600_write_context_reg(cs, R_028A0C_PA_SC_LINE_STIPPLE,
 		sctx->pa_sc_line_stipple |
 		S_028A0C_AUTO_RESET_CNTL(mode == PIPE_PRIM_LINES ? 1 :
@@ -166,6 +169,8 @@ static void si_emit_rasterizer_prim_state(struct si_context *sctx, unsigned mode
 		S_028814_PROVOKING_VTX_LAST(mode == PIPE_PRIM_QUADS ||
 					    mode == PIPE_PRIM_QUAD_STRIP ||
 					    mode == PIPE_PRIM_POLYGON));
+
+	sctx->last_rast_prim = mode;
 }
 
 static void si_emit_draw_registers(struct si_context *sctx,
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index afd94c2..a73f4a7 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -511,6 +511,7 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state)
 		return;
 
 	sctx->gs_shader = sel;
+	sctx->last_rast_prim = -1; /* reset this so that it gets updated */
 }
 
 static void si_make_dummy_ps(struct si_context *sctx)
-- 
2.1.0



More information about the mesa-dev mailing list