summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Pitoiset <samuel.pitoiset@gmail.com>2021-03-15 22:24:41 +0100
committerMarge Bot <eric+marge@anholt.net>2021-03-29 20:18:29 +0000
commitfa712d9e17448fc8fcaf5860973d123a672c40f7 (patch)
treeb7d230ec0bda3d7de3079fc641ae56464ca50335
parentda45f3f35c6e55fed8483a0d489e92d731660aed (diff)
ac/surface: do not allocate FMASK or CMASK for stencil-only surfaces on GFX9+
FMASK/CMASK make no sense with depth/stencil or stencil-only surfaces. gfx9_compute_miptree() was called twice for stencil-only surfaces, and the first call was allocating FMASK/CMASK. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9612>
-rw-r--r--src/amd/common/ac_surface.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 3bbf967772e..4b06c23fbae 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -2329,10 +2329,15 @@ static int gfx9_compute_surface(struct ac_addrlib *addrlib, const struct radeon_
surf->u.gfx9.dcc_retile_num_elements = 0;
surf->u.gfx9.dcc_retile_map = NULL;
+ const bool only_stencil =
+ (surf->flags & RADEON_SURF_SBUFFER) && !(surf->flags & RADEON_SURF_ZBUFFER);
+
/* Calculate texture layout information. */
- r = gfx9_compute_miptree(addrlib, info, config, surf, compressed, &AddrSurfInfoIn);
- if (r)
- return r;
+ if (!only_stencil) {
+ r = gfx9_compute_miptree(addrlib, info, config, surf, compressed, &AddrSurfInfoIn);
+ if (r)
+ return r;
+ }
/* Calculate texture layout information for stencil. */
if (surf->flags & RADEON_SURF_SBUFFER) {