From 3291eedfe601b9d09023fb24987ae7d2c7e977c3 Mon Sep 17 00:00:00 2001 From: Marek Olšák Date: Mon, 8 Dec 2014 13:35:36 +0100 Subject: radeonsi: only emit line stippling and provoking vertex state when it changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Michel Dänzer --- 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(+) (limited to 'src/gallium') diff --git a/src/gallium/drivers/radeonsi/si_hw_context.c b/src/gallium/drivers/radeonsi/si_hw_context.c index b55cbf34948..983a0976b04 100644 --- a/src/gallium/drivers/radeonsi/si_hw_context.c +++ b/src/gallium/drivers/radeonsi/si_hw_context.c @@ -161,4 +161,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 8e89e4a2ef0..9ba4970b3ff 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 fe9666f5f99..1bb1f69044c 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 4383da4ad09..f3d58c3e2ab 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 31d5094d008..3a5b0ae5fee 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -512,6 +512,7 @@ static void si_bind_gs_shader(struct pipe_context *ctx, void *state) sctx->gs_shader = sel; sctx->clip_regs.dirty = true; + sctx->last_rast_prim = -1; /* reset this so that it gets updated */ } static void si_make_dummy_ps(struct si_context *sctx) -- cgit v1.2.3