mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-11 06:28:09 +02:00
venus: clarify wsi image ownership
Fix to call vn_image_bind_wsi_memory as long as the image is a wsi
image. This is needed so that we track the wsi memory in the wsi image
so that creating from swapchain info works normally on x11/wayland
platforms. This change also make it clear that ANB image owns the wsi
memory
Fixes: c4b30b604f ("venus: support VK_ANDROID_NATIVE_BUFFER_SPEC_VERSION 8")
Signed-off-by: Yiwei Zhang <zzyiwei@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30278>
This commit is contained in:
parent
c429d5025e
commit
a27e3c5078
1 changed files with 11 additions and 3 deletions
|
|
@ -431,6 +431,9 @@ vn_image_deferred_info_init(struct vn_image *img,
|
|||
info->from_external_format = true;
|
||||
}
|
||||
} break;
|
||||
case VK_STRUCTURE_TYPE_IMAGE_SWAPCHAIN_CREATE_INFO_KHR:
|
||||
img->wsi.is_wsi = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
@ -805,8 +808,12 @@ vn_image_bind_wsi_memory(struct vn_device *dev,
|
|||
}
|
||||
assert(mem && info->memory != VK_NULL_HANDLE);
|
||||
|
||||
if (img->wsi.is_wsi)
|
||||
img->wsi.memory = mem;
|
||||
#if DETECT_OS_ANDROID
|
||||
assert(img->wsi.memory);
|
||||
#else
|
||||
assert(!img->wsi.memory);
|
||||
img->wsi.memory = mem;
|
||||
#endif
|
||||
}
|
||||
|
||||
vn_async_vkBindImageMemory2(dev->primary_ring, vn_device_to_handle(dev),
|
||||
|
|
@ -825,7 +832,8 @@ vn_BindImageMemory2(VkDevice device,
|
|||
struct vn_device *dev = vn_device_from_handle(device);
|
||||
|
||||
for (uint32_t i = 0; i < bindInfoCount; i++) {
|
||||
if (pBindInfos[i].memory == VK_NULL_HANDLE)
|
||||
struct vn_image *img = vn_image_from_handle(pBindInfos[i].image);
|
||||
if (img->wsi.is_wsi)
|
||||
return vn_image_bind_wsi_memory(dev, bindInfoCount, pBindInfos);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue