radeonsi: disable VRS flat shading for selected 8xMSAA and thick tiling cases

for better slow clear performance

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28725>
This commit is contained in:
Marek Olšák
2024-03-25 15:06:52 -04:00
committed by Marge Bot
parent 86131c25a1
commit 38f74d6277
3 changed files with 12 additions and 1 deletions
+1
View File
@@ -803,6 +803,7 @@ struct si_framebuffer {
bool DB_has_shader_readable_metadata;
bool all_DCC_pipe_aligned;
bool has_dcc_msaa;
bool disable_vrs_flat_shading;
};
enum si_quant_mode
+10
View File
@@ -3132,6 +3132,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
sctx->framebuffer.all_DCC_pipe_aligned = true;
sctx->framebuffer.has_dcc_msaa = false;
sctx->framebuffer.min_bytes_per_pixel = 0;
sctx->framebuffer.disable_vrs_flat_shading = false;
for (i = 0; i < state->nr_cbufs; i++) {
if (!state->cbufs[i])
@@ -3190,6 +3191,14 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
if (!sctx->framebuffer.min_bytes_per_pixel ||
tex->surface.bpe < sctx->framebuffer.min_bytes_per_pixel)
sctx->framebuffer.min_bytes_per_pixel = tex->surface.bpe;
/* Disable VRS flat shading where it decreases performance.
* This gives the best results for slow clears for AMD_TEST=blitperf on Navi31.
*/
if ((sctx->framebuffer.nr_samples == 8 && tex->surface.bpe != 2) ||
(tex->surface.thick_tiling && tex->surface.bpe == 4 &&
util_format_get_nr_components(surf->base.format) == 4))
sctx->framebuffer.disable_vrs_flat_shading = true;
}
struct si_texture *zstex = NULL;
@@ -3285,6 +3294,7 @@ static void si_set_framebuffer_state(struct pipe_context *ctx,
si_ps_key_update_framebuffer_rasterizer_sample_shading(sctx);
si_vs_ps_key_update_rast_prim_smooth_stipple(sctx);
si_update_ps_inputs_read_or_disabled(sctx);
si_update_vrs_flat_shading(sctx);
sctx->do_update_shaders = true;
if (!sctx->decompression_enabled) {
@@ -3713,7 +3713,7 @@ void si_update_vrs_flat_shading(struct si_context *sctx)
struct si_state_rasterizer *rs = sctx->queued.named.rasterizer;
struct si_shader_info *info = &sctx->shader.ps.cso->info;
bool allow_flat_shading =
info->allow_flat_shading &&
info->allow_flat_shading && !sctx->framebuffer.disable_vrs_flat_shading &&
!rs->line_smooth && !rs->poly_smooth && !rs->poly_stipple_enable &&
!rs->point_smooth && (rs->flatshade || !info->uses_interp_color);