diff options
author | Marek Olšák <[email protected]> | 2018-04-26 16:21:19 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-05-10 18:26:33 -0400 |
commit | 656fd607bed929685968ebbbe3d97cbe7b455274 (patch) | |
tree | c4214eb462f867aacb922a98c98054cd858a8776 /src | |
parent | 835095973df84e3970582c6a3d4a9729990ddda2 (diff) |
radeonsi: don't update clear color registers if they don't change
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src')
-rw-r--r-- | src/gallium/drivers/radeonsi/si_clear.c | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c index 8ecd47fea9b..0f3546b02da 100644 --- a/src/gallium/drivers/radeonsi/si_clear.c +++ b/src/gallium/drivers/radeonsi/si_clear.c @@ -65,7 +65,7 @@ static void si_alloc_separate_cmask(struct si_screen *sscreen, p_atomic_inc(&sscreen->compressed_colortex_counter); } -static void si_set_clear_color(struct r600_texture *rtex, +static bool si_set_clear_color(struct r600_texture *rtex, enum pipe_format surface_format, const union pipe_color_union *color) { @@ -90,7 +90,11 @@ static void si_set_clear_color(struct r600_texture *rtex, util_pack_color(color->f, surface_format, &uc); } + if (memcmp(rtex->color_clear_value, &uc, 2 * sizeof(uint32_t)) == 0) + return false; + memcpy(rtex->color_clear_value, &uc, 2 * sizeof(uint32_t)); + return true; } /** Linearize and convert luminace/intensity to red. */ @@ -545,10 +549,10 @@ static void si_do_fast_color_clear(struct si_context *sctx, /* We can change the micro tile mode before a full clear. */ si_set_optimal_micro_tile_mode(sctx->screen, tex); - si_set_clear_color(tex, fb->cbufs[i]->format, color); - - sctx->framebuffer.dirty_cbufs |= 1 << i; - si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer); + if (si_set_clear_color(tex, fb->cbufs[i]->format, color)) { + sctx->framebuffer.dirty_cbufs |= 1 << i; + si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer); + } *buffers &= ~clear_bit; } } @@ -596,9 +600,12 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers, sctx->db_depth_disable_expclear = true; } - zstex->depth_clear_value = depth; - sctx->framebuffer.dirty_zsbuf = true; - si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer); /* updates DB_DEPTH_CLEAR */ + if (zstex->depth_clear_value != (float)depth) { + /* Update DB_DEPTH_CLEAR. */ + zstex->depth_clear_value = depth; + sctx->framebuffer.dirty_zsbuf = true; + si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer); + } sctx->db_depth_clear = true; si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state); } @@ -614,9 +621,12 @@ static void si_clear(struct pipe_context *ctx, unsigned buffers, sctx->db_stencil_disable_expclear = true; } - zstex->stencil_clear_value = stencil; - sctx->framebuffer.dirty_zsbuf = true; - si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer); /* updates DB_STENCIL_CLEAR */ + if (zstex->stencil_clear_value != (uint8_t)stencil) { + /* Update DB_STENCIL_CLEAR. */ + zstex->stencil_clear_value = stencil; + sctx->framebuffer.dirty_zsbuf = true; + si_mark_atom_dirty(sctx, &sctx->atoms.s.framebuffer); + } sctx->db_stencil_clear = true; si_mark_atom_dirty(sctx, &sctx->atoms.s.db_render_state); } |