summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPierre-Eric Pelloux-Prayer <[email protected]>2020-06-03 18:20:15 +0200
committerEric Engestrom <[email protected]>2020-06-10 19:39:17 +0200
commit05d10b257b22d275229c786d6d03bc2fb65d34ec (patch)
tree213b2fdfe992eb79580a4492d7fc0f34b0da8e12
parentbd61a3d1e62c11abc2ed540d91397fe34b770d34 (diff)
ac/surface: fix epitch when modifying surf_pitch
This is needed otherwise it can cause bad rendering of UYVY files. The align(..., 256 / surf->bpe) constraint comes from addrlib. Fixes: 69aadc49331 ("radeonsi: fix surf_pitch for subsampled surface") Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5314> (cherry picked from commit 8275dc1ed575888f46b4e54d29e56ca63b1accaf)
-rw-r--r--.pick_status.json2
-rw-r--r--src/amd/common/ac_surface.c8
2 files changed, 7 insertions, 3 deletions
diff --git a/.pick_status.json b/.pick_status.json
index 807a214ef6b..6950c823fc8 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -130,7 +130,7 @@
"description": "ac/surface: fix epitch when modifying surf_pitch",
"nominated": true,
"nomination_type": 1,
- "resolution": 0,
+ "resolution": 1,
"master_sha": null,
"because_sha": "69aadc493310bb7306d10559bf48412eb5865962"
},
diff --git a/src/amd/common/ac_surface.c b/src/amd/common/ac_surface.c
index cbbb1dd1cac..288b8b71771 100644
--- a/src/amd/common/ac_surface.c
+++ b/src/amd/common/ac_surface.c
@@ -1146,10 +1146,14 @@ static int gfx9_compute_miptree(ADDR_HANDLE addrlib,
surf->u.gfx9.surf_slice_size = out.sliceSize;
surf->u.gfx9.surf_pitch = out.pitch;
- if (!compressed && surf->blk_w > 1 && out.pitch == out.pixelPitch) {
+ if (!compressed && surf->blk_w > 1 && out.pitch == out.pixelPitch &&
+ surf->u.gfx9.surf.swizzle_mode == ADDR_SW_LINEAR) {
/* Adjust surf_pitch to be in elements units,
* not in pixels */
- surf->u.gfx9.surf_pitch /= surf->blk_w;
+ surf->u.gfx9.surf_pitch =
+ align(surf->u.gfx9.surf_pitch / surf->blk_w, 256 / surf->bpe);
+ surf->u.gfx9.surf.epitch = MAX2(surf->u.gfx9.surf.epitch,
+ surf->u.gfx9.surf_pitch * surf->blk_w - 1);
}
surf->u.gfx9.surf_height = out.height;
surf->surf_size = out.surfSize;