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>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/40250>
This commit is contained in:
Icenowy Zheng 2026-03-06 01:59:54 +08:00 committed by Marge Bot
parent 0d8e2354ed
commit 765a9f4fd9

View file

@ -94,14 +94,9 @@ static void pvr_image_plane_init_physical_extent(
assert(image->memlayout == PVR_MEMLAYOUT_LINEAR);
plane->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)) {
plane->physical_extent.width =
align(plane->physical_extent.width, pbe_stride_align);
}
/* Align the image for being rendered to (written by the PBE). */
plane->physical_extent.width =
align(plane->physical_extent.width, pbe_stride_align);
if (image->vk.tiling == VK_IMAGE_TILING_DRM_FORMAT_MODIFIER_EXT) {
const VkImageDrmFormatModifierExplicitCreateInfoEXT *explicit_mod =