Mesa (staging/21.1): radeonsi: make the gfx9 DCC MSAA clear shader depend on the number of samples
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Apr 27 18:22:16 UTC 2021
Module: Mesa
Branch: staging/21.1
Commit: 7ba683d4901346b18e7a2626595ef15aa6eb6a13
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=7ba683d4901346b18e7a2626595ef15aa6eb6a13
Author: Marek Olšák <marek.olsak at amd.com>
Date: Tue Apr 20 05:40:46 2021 -0400
radeonsi: make the gfx9 DCC MSAA clear shader depend on the number of samples
because different DCC equations are used.
Fixes: 3120113ee77 - radeonsi: implement DCC MSAA 4x/8x fast clear using DCC equations on gfx9
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10343>
(cherry picked from commit 1f8fa964120218cb408cc9df493f31d38ae7c9af)
---
.pick_status.json | 2 +-
src/gallium/drivers/radeonsi/si_compute_blit.c | 5 +++--
src/gallium/drivers/radeonsi/si_pipe.c | 6 ++++--
src/gallium/drivers/radeonsi/si_pipe.h | 3 ++-
4 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/.pick_status.json b/.pick_status.json
index 10d2e5ff214..ebf310c5c19 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -463,7 +463,7 @@
"description": "radeonsi: make the gfx9 DCC MSAA clear shader depend on the number of samples",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "3120113ee77621964bb009f9cbd13488b087e734"
},
diff --git a/src/gallium/drivers/radeonsi/si_compute_blit.c b/src/gallium/drivers/radeonsi/si_compute_blit.c
index 92598731579..39fdbedd592 100644
--- a/src/gallium/drivers/radeonsi/si_compute_blit.c
+++ b/src/gallium/drivers/radeonsi/si_compute_blit.c
@@ -693,9 +693,10 @@ void gfx9_clear_dcc_msaa(struct si_context *sctx, struct pipe_resource *res, uin
/* These variables identify the shader variant. */
unsigned swizzle_mode = tex->surface.u.gfx9.swizzle_mode;
unsigned bpe_log2 = util_logbase2(tex->surface.bpe);
- bool samples8 = tex->buffer.b.b.nr_storage_samples == 8;
+ unsigned log2_samples = util_logbase2(tex->buffer.b.b.nr_samples);
+ bool fragments8 = tex->buffer.b.b.nr_storage_samples == 8;
bool is_array = tex->buffer.b.b.array_size > 1;
- void **shader = &sctx->cs_clear_dcc_msaa[swizzle_mode][bpe_log2][samples8][is_array];
+ void **shader = &sctx->cs_clear_dcc_msaa[swizzle_mode][bpe_log2][fragments8][log2_samples - 2][is_array];
if (!*shader)
*shader = gfx9_create_clear_dcc_msaa_cs(sctx, tex);
diff --git a/src/gallium/drivers/radeonsi/si_pipe.c b/src/gallium/drivers/radeonsi/si_pipe.c
index d204cf2e150..1739f7af612 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -272,8 +272,10 @@ static void si_destroy_context(struct pipe_context *context)
for (unsigned j = 0; j < ARRAY_SIZE(sctx->cs_clear_dcc_msaa[i]); j++) {
for (unsigned k = 0; k < ARRAY_SIZE(sctx->cs_clear_dcc_msaa[i][j]); k++) {
for (unsigned l = 0; l < ARRAY_SIZE(sctx->cs_clear_dcc_msaa[i][j][k]); l++) {
- if (sctx->cs_clear_dcc_msaa[i][j][k][l])
- sctx->b.delete_compute_state(&sctx->b, sctx->cs_clear_dcc_msaa[i][j][k][l]);
+ for (unsigned m = 0; m < ARRAY_SIZE(sctx->cs_clear_dcc_msaa[i][j][k][l]); m++) {
+ if (sctx->cs_clear_dcc_msaa[i][j][k][l][m])
+ sctx->b.delete_compute_state(&sctx->b, sctx->cs_clear_dcc_msaa[i][j][k][l][m]);
+ }
}
}
}
diff --git a/src/gallium/drivers/radeonsi/si_pipe.h b/src/gallium/drivers/radeonsi/si_pipe.h
index 442671a8c08..c9f64a144bd 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.h
+++ b/src/gallium/drivers/radeonsi/si_pipe.h
@@ -1320,7 +1320,8 @@ struct si_context {
/* Shaders. */
/* TODO: move other shaders here too */
- void *cs_clear_dcc_msaa[32][5][2][2]; /* [swizzle_mode][log2(bpe)][samples == 8][is_array] */
+ /* Only used for DCC MSAA clears with 4-8 fragments and 4-16 samples. */
+ void *cs_clear_dcc_msaa[32][5][2][3][2]; /* [swizzle_mode][log2(bpe)][fragments == 8][log2(samples)-2][is_array] */
};
/* si_blit.c */
More information about the mesa-commit
mailing list