Module: Mesa
Branch: staging/22.1
Commit: e8ba43c8f8476c9fa80b932cb4b8df713f0f64db
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e8ba43c8f8476c9fa80b932cb4b8df713f0f64db

Author: Pierre-Eric Pelloux-Prayer <[email protected]>
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 <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16053>
(cherry picked from commit fcc499d5e1deac76126de7fd0c3297298322db07)

---

 .pick_status.json           | 2 +-
 src/amd/common/ac_surface.c | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index 6bc72f1fdea..124b581d033 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -571,7 +571,7 @@
         "description": "ac/surface: adjust gfx9.pitch[*] based on surf->blk_w",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "86262b6eac0c232f4b3085cfc86cff9b7de7d11b"
     },
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);
       }
    }
 

Reply via email to