summaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/radeonsi/si_clear.c
diff options
context:
space:
mode:
authorMarek Olšák <[email protected]>2017-11-28 21:37:26 +0100
committerMarek Olšák <[email protected]>2017-11-29 18:21:30 +0100
commit8a58724ac998cd57f43e3c6a2dee1a7efdc47417 (patch)
tree6d37705667d6a5c7224fa0fba249297978e21607 /src/gallium/drivers/radeonsi/si_clear.c
parent980bf9a27e83879982af6b1cdc87ed4da4f54807 (diff)
radeonsi: unify code setting dirty_level_mask for fast clear
Reviewed-by: Nicolai Hähnle <[email protected]>
Diffstat (limited to 'src/gallium/drivers/radeonsi/si_clear.c')
-rw-r--r--src/gallium/drivers/radeonsi/si_clear.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/src/gallium/drivers/radeonsi/si_clear.c b/src/gallium/drivers/radeonsi/si_clear.c
index 29e63c7e82b..00589caf5be 100644
--- a/src/gallium/drivers/radeonsi/si_clear.c
+++ b/src/gallium/drivers/radeonsi/si_clear.c
@@ -419,10 +419,12 @@ static void si_do_fast_color_clear(struct si_context *sctx,
tex->num_slow_clears++;
}
+ bool need_decompress_pass = false;
+
/* Try to clear DCC first, otherwise try CMASK. */
if (vi_dcc_enabled(tex, 0)) {
uint32_t reset_value;
- bool clear_words_needed, cleared_cmask = false;
+ bool clear_words_needed;
if (sctx->screen->b.debug_flags & DBG(NO_DCC_CLEAR))
continue;
@@ -446,19 +448,14 @@ static void si_do_fast_color_clear(struct si_context *sctx,
si_clear_buffer(&sctx->b.b, &tex->cmask_buffer->b.b,
tex->cmask.offset, tex->cmask.size,
0xCCCCCCCC, R600_COHERENCY_CB_META);
- cleared_cmask = true;
+ need_decompress_pass = true;
}
vi_dcc_clear_level(sctx, tex, 0, reset_value);
- if (clear_words_needed || cleared_cmask) {
- bool need_compressed_update = !tex->dirty_level_mask;
-
- tex->dirty_level_mask |= 1 << level;
+ if (clear_words_needed)
+ need_decompress_pass = true;
- if (need_compressed_update)
- p_atomic_inc(&sctx->screen->b.compressed_colortex_counter);
- }
tex->separate_dcc_dirty = true;
} else {
/* 128-bit formats are unusupported */
@@ -480,13 +477,13 @@ static void si_do_fast_color_clear(struct si_context *sctx,
si_clear_buffer(&sctx->b.b, &tex->cmask_buffer->b.b,
tex->cmask.offset, tex->cmask.size, 0,
R600_COHERENCY_CB_META);
+ need_decompress_pass = true;
+ }
- bool need_compressed_update = !tex->dirty_level_mask;
-
+ if (need_decompress_pass &&
+ !(tex->dirty_level_mask & (1 << level))) {
tex->dirty_level_mask |= 1 << level;
-
- if (need_compressed_update)
- p_atomic_inc(&sctx->screen->b.compressed_colortex_counter);
+ p_atomic_inc(&sctx->screen->b.compressed_colortex_counter);
}
/* We can change the micro tile mode before a full clear. */