From 27d27e08eae87575eb44012ebf18cf4001981201 Mon Sep 17 00:00:00 2001 From: Janne Grunau Date: Sun, 5 Jan 2025 16:11:24 +0100 Subject: [PATCH] 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 Part-of: --- src/asahi/vulkan/hk_image.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/asahi/vulkan/hk_image.c b/src/asahi/vulkan/hk_image.c index 1af4bc54fdb..dc980adddd5 100644 --- a/src/asahi/vulkan/hk_image.c +++ b/src/asahi/vulkan/hk_image.c @@ -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),