radeonsi: don't set VGT_LS_HS_CONFIG if it doesn't change
authorMarek Olšák <marek.olsak@amd.com>
Thu, 31 May 2018 01:24:06 +0000 (21:24 -0400)
committerMarek Olšák <marek.olsak@amd.com>
Thu, 14 Jun 2018 02:00:25 +0000 (22:00 -0400)
Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
src/gallium/drivers/radeonsi/si_gfx_cs.c
src/gallium/drivers/radeonsi/si_pipe.h
src/gallium/drivers/radeonsi/si_state_draw.c

index d1596a31774c194a26c71bd239d71238043f7388..b81773e01a077d7656ec6db07d6d4b2282681275 100644 (file)
@@ -318,6 +318,7 @@ void si_begin_new_gfx_cs(struct si_context *ctx)
        ctx->last_tcs = NULL;
        ctx->last_tes_sh_base = -1;
        ctx->last_num_tcs_input_cp = -1;
+       ctx->last_ls_hs_config = -1; /* impossible value */
 
        ctx->cs_shader_state.initialized = false;
 
index e7f6b45ccc68679d1adc4df44e1ace9821b66c36..ea199d3924de1ef7b13470cc6fa6638223e5cdfb 100644 (file)
@@ -916,6 +916,7 @@ struct si_context {
        int                     last_tes_sh_base;
        bool                    last_tess_uses_primid;
        unsigned                last_num_patches;
+       int                     last_ls_hs_config;
 
        /* Debug state. */
        bool                    is_debug;
index 845ec468aec0d0a10abc56a316ef0615fee37d96..42522c012915b72d58275c4e3abfd09e2ee35f8d 100644 (file)
@@ -280,12 +280,16 @@ static void si_emit_derived_tess_state(struct si_context *sctx,
                       S_028B58_HS_NUM_INPUT_CP(num_tcs_input_cp) |
                       S_028B58_HS_NUM_OUTPUT_CP(num_tcs_output_cp);
 
-       if (sctx->chip_class >= CIK)
-               radeon_set_context_reg_idx(cs, R_028B58_VGT_LS_HS_CONFIG, 2,
-                                          ls_hs_config);
-       else
-               radeon_set_context_reg(cs, R_028B58_VGT_LS_HS_CONFIG,
-                                      ls_hs_config);
+       if (sctx->last_ls_hs_config != ls_hs_config) {
+               if (sctx->chip_class >= CIK) {
+                       radeon_set_context_reg_idx(cs, R_028B58_VGT_LS_HS_CONFIG, 2,
+                                                  ls_hs_config);
+               } else {
+                       radeon_set_context_reg(cs, R_028B58_VGT_LS_HS_CONFIG,
+                                              ls_hs_config);
+               }
+               sctx->last_ls_hs_config = ls_hs_config;
+       }
 }
 
 static unsigned si_num_prims_for_vertices(const struct pipe_draw_info *info)