From fcc499d5e1deac76126de7fd0c3297298322db07 Mon Sep 17 00:00:00 2001 From: Pierre-Eric Pelloux-Prayer Date: Wed, 20 Apr 2022 11:09:40 +0200 Subject: [PATCH] ac/surface: adjust gfx9.pitch[*] based on surf->blk_w MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Part-of: --- 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); } }