From 5dcb9f918ddc6517bb1face005ad4d0f0aed17cb Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Sat, 22 Mar 2025 17:56:28 -0700 Subject: [PATCH] panvk: fix memory requirement query for aliased disjoint image The spec allows to create aliased disjoint image for a specific plane of a multi-planar image, and the format can be R8. When querying memory requirement of such image, VkImagePlaneMemoryRequirementsInfo is not required to be chained although it has the disjoint bit. This change fixes to look for aspect info from plane memory info only when that's chained. The implementation can be passive here as the spec VU has sufficient guarantees for the validity around. See below VU for details: - VUID-VkImageMemoryRequirementsInfo2-image-01589 - VUID-VkImageMemoryRequirementsInfo2-image-01590 - VUID-VkImageMemoryRequirementsInfo2-image-02279 - VUID-VkImageMemoryRequirementsInfo2-image-02280 Meanwhile, the existing disjoint check for size info is kept as is for the special handling of VK_FORMAT_D32_SFLOAT_S8_UINT. Test: dEQP-VK.ycbcr.plane_view.memory_alias.* pass with venus-on-panvk Fixes: 412c2863315 ("panvk: Enable multiplane images and image views") Reviewed-by: Rebecca Mckeever Part-of: --- src/panfrost/vulkan/panvk_image.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/panfrost/vulkan/panvk_image.c b/src/panfrost/vulkan/panvk_image.c index 055da6b6809..8358fea2169 100644 --- a/src/panfrost/vulkan/panvk_image.c +++ b/src/panfrost/vulkan/panvk_image.c @@ -446,7 +446,7 @@ panvk_GetImageMemoryRequirements2(VkDevice device, vk_find_struct_const(pInfo->pNext, IMAGE_PLANE_MEMORY_REQUIREMENTS_INFO); const bool disjoint = is_disjoint(image); const VkImageAspectFlags aspects = - disjoint ? plane_info->planeAspect : image->vk.aspects; + plane_info ? plane_info->planeAspect : image->vk.aspects; uint8_t plane = panvk_plane_index(image->vk.format, aspects); const uint64_t size = disjoint ? image->planes[plane].layout.data_size :