hk: Use rowPitch from VkImageDrmFormatModifierExplicitCreateInfoEXT

Imported linear images may have an arbitrary row pitch. As long as it is
aligned to 16 agx can support. Initialize `.linear_stride_B` from the
supplied parameter and let ail verify it.

Fixes gtk dmabuf based tests with a pitch aligned to 256.

Signed-off-by: Janne Grunau <j@jannau.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/33682>
This commit is contained in:
Janne Grunau
2025-01-05 16:11:24 +01:00
committed by Marge Bot
parent 5d9e600ce9
commit 27d27e08ea
+7
View File
@@ -824,11 +824,18 @@ hk_image_init(struct hk_device *dev, struct hk_image *image,
enum ail_tiling tiling =
hk_map_tiling(dev, pCreateInfo, plane, image->vk.drm_format_mod);
uint32_t linear_stride_B = 0;
if (mod_explicit_info &&
image->vk.drm_format_mod == DRM_FORMAT_MOD_LINEAR)
linear_stride_B = mod_explicit_info->pPlaneLayouts[plane].rowPitch;
image->planes[plane].layout = (struct ail_layout){
.tiling = tiling,
.mipmapped_z = pCreateInfo->imageType == VK_IMAGE_TYPE_3D,
.format = hk_format_to_pipe_format(format),
.linear_stride_B = linear_stride_B,
.width_px = pCreateInfo->extent.width / width_scale,
.height_px = pCreateInfo->extent.height / height_scale,
.depth_px = MAX2(pCreateInfo->extent.depth, pCreateInfo->arrayLayers),