From 8f23dba130d17edf0fcfeec7bb8a032dccaed0a0 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Wed, 6 Aug 2025 06:32:20 +0000 Subject: [PATCH] panvk: ensure wsi memory is bound at offset 0 No apps or tests have hit the spec corner case yet, but in theory they could pass invalid offset and expect the impl to ignore it for wsi alias binding. This change ensures the offset is zero, which aligns with common wsi side binding as well as obeying the dedicated allocation requirement. Fixes: 187956bd51a ("panvk: adopt wsi_common_get_memory") Reviewed-by: Erik Faye-Lund Acked-by: Lars-Ivar Hesselberg Simonsen Reviewed-by: Faith Ekstrand Part-of: (cherry picked from commit 2f54020f293f388def106e7729664407f412108a) --- .pick_status.json | 2 +- src/panfrost/vulkan/panvk_image.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index ba89352b782..bda3e5e0241 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -5924,7 +5924,7 @@ "description": "panvk: ensure wsi memory is bound at offset 0", "nominated": true, "nomination_type": 2, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "187956bd51ad1ade4bf6f7a2b289aea29340e718", "notes": null diff --git a/src/panfrost/vulkan/panvk_image.c b/src/panfrost/vulkan/panvk_image.c index edc921c3667..a6515afbd9a 100644 --- a/src/panfrost/vulkan/panvk_image.c +++ b/src/panfrost/vulkan/panvk_image.c @@ -681,6 +681,7 @@ panvk_image_bind(struct panvk_device *dev, const VkBindImageMemoryInfo *bind_info) { VK_FROM_HANDLE(panvk_image, image, bind_info->image); VK_FROM_HANDLE(panvk_device_memory, mem, bind_info->memory); + uint64_t offset = bind_info->memoryOffset; if (!mem) { #if DETECT_OS_ANDROID @@ -694,6 +695,7 @@ panvk_image_bind(struct panvk_device *dev, VkDeviceMemory mem_handle = wsi_common_get_memory( swapchain_info->swapchain, swapchain_info->imageIndex); mem = panvk_device_memory_from_handle(mem_handle); + offset = 0; #endif } @@ -705,12 +707,12 @@ panvk_image_bind(struct panvk_device *dev, const uint8_t plane = panvk_plane_index(image->vk.format, plane_info->planeAspect); return panvk_image_plane_bind(dev, &image->planes[plane], mem->bo, - mem->addr.dev, bind_info->memoryOffset); + mem->addr.dev, offset); } else { for (unsigned plane = 0; plane < image->plane_count; plane++) { VkResult result = panvk_image_plane_bind(dev, &image->planes[plane], mem->bo, - mem->addr.dev, bind_info->memoryOffset); + mem->addr.dev, offset); if (result != VK_SUCCESS) return result; }