Mesa (main): ac/surface: adjust gfx9.pitch[*] based on surf->blk_w

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 22 17:49:57 UTC 2022


Module: Mesa
Branch: main
Commit: fcc499d5e1deac76126de7fd0c3297298322db07
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=fcc499d5e1deac76126de7fd0c3297298322db07

Author: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Date:   Wed Apr 20 11:09:40 2022 +0200

ac/surface: adjust gfx9.pitch[*] based on surf->blk_w

This is the same as 8275dc1ed57, but since gfx9.pitch[...] is
used for linear surfaces since 86262b6eac0 we need to update
it as well.

Fixes: 86262b6eac0 ("radeonsi,radv: fix usages of surf_pitch")
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16053>

---

 src/amd/common/ac_surface.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index 788d205d3ba..7d21f817f7a 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -1702,9 +1702,11 @@ static int gfx9_compute_miptree(struct ac_addrlib *addrlib, const struct radeon_
    }
 
    if (in->swizzleMode == ADDR_SW_LINEAR) {
+      int alignment = 256 / surf->bpe;
       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;
+         /* Adjust pitch like we did for surf_pitch */
+         surf->u.gfx9.pitch[i] = align(mip_info[i].pitch / surf->blk_w, alignment);
       }
    }
 



More information about the mesa-commit mailing list