radeonsi: don't set the CB clear color registers for 0/1 clear colors on Raven2
authorMarek Olšák <marek.olsak@amd.com>
Tue, 30 Oct 2018 00:48:33 +0000 (20:48 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Fri, 9 Nov 2018 19:55:04 +0000 (14:55 -0500)
and add has_dcc_constant_encode.

src/gallium/drivers/radeonsi/si_clear.c
src/gallium/drivers/radeonsi/si_pipe.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state.c

index 3f5375337a195f851329a51149a1fb9dbe8d7c8c..9026f61dc0a754d48821ec15baecebedf6d3b41d 100644 (file)
@@ -212,8 +212,8 @@ static bool vi_get_fast_clear_parameters(enum pipe_format base_format,
        }
 
        /* This doesn't need ELIMINATE_FAST_CLEAR.
-        * CB uses both the DCC clear codes and the CB clear color registers,
-        * so they must match.
+        * On chips predating Raven2, the DCC clear codes and the CB clear
+        * color registers must match.
         */
        *eliminate_needed = false;
 
@@ -548,6 +548,12 @@ static void si_do_fast_color_clear(struct si_context *sctx,
 
                *buffers &= ~clear_bit;
 
+               /* Chips with DCC constant encoding don't need to set the clear
+                * color registers for DCC clear values 0 and 1.
+                */
+               if (sctx->screen->has_dcc_constant_encode && !eliminate_needed)
+                       continue;
+
                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);
index 490a3714836032c35b283dcce15c5f52965bed91..ba406bee9224cd4355d092c70c4d064d2e2235dc 100644 (file)
@@ -1029,6 +1029,7 @@ struct pipe_screen *radeonsi_screen_create(struct radeon_winsys *ws,
                                           sscreen->info.family == CHIP_RAVEN;
        sscreen->has_ls_vgpr_init_bug = sscreen->info.family == CHIP_VEGA10 ||
                                        sscreen->info.family == CHIP_RAVEN;
+       sscreen->has_dcc_constant_encode = sscreen->info.family == CHIP_RAVEN2;
 
        if (sscreen->debug_flags & DBG(DPBB)) {
                sscreen->dpbb_allowed = true;
index 0807c8ddacc2bfd3fee1d1a1fe97f377a3ffa70f..023e0f0a0f9d61ac024eada53484f4d35277adec 100644 (file)
@@ -445,6 +445,7 @@ struct si_screen {
        bool                            clear_db_cache_before_clear;
        bool                            has_msaa_sample_loc_bug;
        bool                            has_ls_vgpr_init_bug;
+       bool                            has_dcc_constant_encode;
        bool                            dpbb_allowed;
        bool                            dfsm_allowed;
        bool                            llvm_has_working_vgpr_indexing;
index 0293bdfa79100970ebff93ee93fd1205dceca891..e3b45fa6ea7dbaa98c4d0eca33057ef71be01ec1 100644 (file)
@@ -121,7 +121,7 @@ static void si_emit_cb_render_state(struct si_context *sctx)
                                S_028424_OVERWRITE_COMBINER_MRT_SHARING_DISABLE(1) |
                                S_028424_OVERWRITE_COMBINER_WATERMARK(watermark) |
                                S_028424_OVERWRITE_COMBINER_DISABLE(oc_disable) |
-                               S_028424_DISABLE_CONSTANT_ENCODE_REG(sctx->family == CHIP_RAVEN2));
+                               S_028424_DISABLE_CONSTANT_ENCODE_REG(sctx->screen->has_dcc_constant_encode));
        }
 
        /* RB+ register settings. */