pvr: Align width for PBE write when creating linear image

Even if a linear image isn't created with usages declaring PBE writes,
the image might be exported and then re-imported with a usage that
allows rendering to.

Always align linear images' width for being written by PBE.

This fixes WSI creating surfaces with odd width, exporting them and
re-importing for rendering.

Backport-to: 26.0
Signed-off-by: Icenowy Zheng <zhengxingda@iscas.ac.cn>
Reviewed-by: Frank Binns <frank.binns@imgtec.com>
(cherry picked from commit 765a9f4fd9)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40752>
This commit is contained in:
Icenowy Zheng 2026-03-06 01:59:54 +08:00 committed by Eric Engestrom
parent b5547c33bb
commit ca4f356d37
2 changed files with 4 additions and 9 deletions

View file

@ -2174,7 +2174,7 @@
"description": "pvr: Align width for PBE write when creating linear image",
"nominated": true,
"nomination_type": 4,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null,
"notes": null

View file

@ -84,14 +84,9 @@ static void pvr_image_init_physical_extent(struct pvr_image *image,
assert(image->memlayout == PVR_MEMLAYOUT_LINEAR);
image->physical_extent = image->vk.extent;
/* If the image is being rendered to (written by the PBE) make sure the
* width is aligned correctly.
*/
if (image->vk.usage & (VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
VK_IMAGE_USAGE_TRANSFER_DST_BIT)) {
image->physical_extent.width =
align(image->physical_extent.width, pbe_stride_align);
}
/* Align the image for being rendered to (written by the PBE). */
image->physical_extent.width =
align(image->physical_extent.width, pbe_stride_align);
}
}