radeonsi/gfx11: always set MSAA_NUM_SAMPLES=0 for DCC_DECOMPRESS

hw requirement

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/21041>
This commit is contained in:
Marek Olšák
2023-01-24 18:29:28 -05:00
committed by Marge Bot
parent 8532cb8e7e
commit a29218b557
3 changed files with 25 additions and 3 deletions

View File

@@ -467,6 +467,12 @@ static void si_blit_decompress_color(struct si_context *sctx, struct si_texture
if (need_dcc_decompress) {
custom_blend = sctx->custom_blend_dcc_decompress;
/* DCC_DECOMPRESS and ELIMINATE_FAST_CLEAR require MSAA_NUM_SAMPLES=0. */
if (sctx->gfx_level >= GFX11) {
sctx->gfx11_force_msaa_num_samples_zero = true;
si_mark_atom_dirty(sctx, &sctx->atoms.s.msaa_config);
}
assert(vi_dcc_enabled(tex, first_level));
/* disable levels without DCC */
@@ -475,8 +481,10 @@ static void si_blit_decompress_color(struct si_context *sctx, struct si_texture
level_mask &= ~(1 << i);
}
} else if (tex->surface.fmask_size) {
assert(sctx->gfx_level < GFX11);
custom_blend = sctx->custom_blend_fmask_decompress;
} else {
assert(sctx->gfx_level < GFX11);
custom_blend = sctx->custom_blend_eliminate_fastclear;
}
@@ -542,6 +550,12 @@ static void si_blit_decompress_color(struct si_context *sctx, struct si_texture
si_make_CB_shader_coherent(sctx, tex->buffer.b.b.nr_samples, vi_dcc_enabled(tex, first_level),
tex->surface.u.gfx9.color.dcc.pipe_aligned);
/* Restore gfx11_force_msaa_num_samples_zero. */
if (sctx->gfx11_force_msaa_num_samples_zero) {
sctx->gfx11_force_msaa_num_samples_zero = false;
si_mark_atom_dirty(sctx, &sctx->atoms.s.msaa_config);
}
expand_fmask:
if (need_fmask_expand && tex->surface.fmask_offset && !tex->fmask_is_identity) {
assert(sctx->gfx_level < GFX11); /* no FMASK on gfx11 */

View File

@@ -1006,13 +1006,14 @@ struct si_context {
unsigned wait_mem_number;
uint16_t prefetch_L2_mask;
bool blitter_running;
bool suppress_update_ps_colorbuf0_slot;
bool blitter_running:1;
bool suppress_update_ps_colorbuf0_slot:1;
bool is_noop:1;
bool has_graphics:1;
bool gfx_flush_in_progress : 1;
bool gfx_last_ib_is_busy : 1;
bool compute_is_busy : 1;
bool gfx11_force_msaa_num_samples_zero:1;
int8_t pipeline_stats_enabled; /* -1 = unknown, 0 = disabled, 1 = enabled */
unsigned num_gfx_cs_flushes;
@@ -1914,6 +1915,9 @@ static inline bool vi_tc_compat_htile_enabled(struct si_texture *tex, unsigned l
static inline unsigned si_get_ps_iter_samples(struct si_context *sctx)
{
if (sctx->gfx11_force_msaa_num_samples_zero)
return 1;
if (sctx->ps_uses_fbfetch)
return sctx->framebuffer.nr_color_samples;

View File

@@ -3824,6 +3824,10 @@ static void si_emit_msaa_config(struct si_context *sctx)
*/
coverage_samples = si_get_num_coverage_samples(sctx);
/* DCC_DECOMPRESS and ELIMINATE_FAST_CLEAR require MSAA_NUM_SAMPLES=0. */
if (sctx->gfx_level >= GFX11 && sctx->gfx11_force_msaa_num_samples_zero)
coverage_samples = 1;
/* The DX10 diamond test is not required by GL and decreases line rasterization
* performance, so don't use it.
*/
@@ -3857,7 +3861,7 @@ static void si_emit_msaa_config(struct si_context *sctx)
sctx->smoothing_enabled) {
if (sctx->framebuffer.state.zsbuf) {
z_samples = sctx->framebuffer.state.zsbuf->texture->nr_samples;
z_samples = MAX2(1, z_samples);
z_samples = MIN2(MAX2(1, z_samples), coverage_samples);
} else {
z_samples = coverage_samples;
}