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: 187956bd51 ("panvk: adopt wsi_common_get_memory")
Reviewed-by: Erik Faye-Lund <erik.faye-lund@collabora.com>
Acked-by: Lars-Ivar Hesselberg Simonsen <lars-ivar.simonsen@arm.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36603>
(cherry picked from commit 2f54020f29)
This commit is contained in:
Yiwei Zhang 2025-08-06 06:32:20 +00:00 committed by Eric Engestrom
parent 7c4b200707
commit 8f23dba130
2 changed files with 5 additions and 3 deletions

View file

@ -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

View file

@ -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;
}