Mesa (master): amd/common: Always initialize gfx9 mipmap offset/pitch.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 2 11:44:35 UTC 2020


Module: Mesa
Branch: master
Commit: 973181c06cca3fe232c3a435abde31f2fc1b81ef
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=973181c06cca3fe232c3a435abde31f2fc1b81ef

Author: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
Date:   Tue Dec 31 21:28:23 2019 +0100

amd/common: Always initialize gfx9 mipmap offset/pitch.

The WSI expects pitch to be meaningful even for tiled
textures.

(It is used for the pitch in modesetting and X11)

Fixes: 824bd0830e8 "radv: return the correct pitch for linear mipmaps on GFX10"
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2301
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2304
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3245>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3245>

---

 src/amd/common/ac_surface.c | 8 +++-----
 src/amd/common/ac_surface.h | 4 ++--
 2 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 92aab57920a..5e524ceb7b6 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -1061,11 +1061,9 @@ static int gfx9_compute_miptree(ADDR_HANDLE addrlib,
 	surf->surf_size = out.surfSize;
 	surf->surf_alignment = out.baseAlign;
 
-	if (in->swizzleMode == ADDR_SW_LINEAR) {
-		for (unsigned i = 0; i < in->numMipLevels; i++) {
-			surf->u.gfx9.offset[i] = mip_info[i].offset;
-			surf->u.gfx9.pitch[i] = mip_info[i].pitch;
-		}
+	for (unsigned i = 0; i < in->numMipLevels; i++) {
+		surf->u.gfx9.offset[i] = mip_info[i].offset;
+		surf->u.gfx9.pitch[i] = mip_info[i].pitch;
 	}
 
 	if (in->flags.depth) {
diff --git a/src/amd/common/ac_surface.h b/src/amd/common/ac_surface.h
index 1e90c08b2e5..dec7b206a6a 100644
--- a/src/amd/common/ac_surface.h
+++ b/src/amd/common/ac_surface.h
@@ -152,9 +152,9 @@ struct gfx9_surf_layout {
     uint64_t                    surf_offset; /* 0 unless imported with an offset */
     /* The size of the 2D plane containing all mipmap levels. */
     uint64_t                    surf_slice_size;
-    /* Mipmap level offset within the slice in bytes. Only valid for LINEAR. */
+    /* Mipmap level offset within the slice in bytes. */
     uint32_t                    offset[RADEON_SURF_MAX_LEVELS];
-    /* Mipmap level pitch in elements. Only valid for LINEAR. */
+    /* Mipmap level pitch in elements. */
     uint32_t                    pitch[RADEON_SURF_MAX_LEVELS];
 
     uint64_t                    stencil_offset; /* separate stencil */




More information about the mesa-commit mailing list