mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 07:08:04 +02:00
venus: refactor vn_android_get_wsi_memory to return VkDeviceMemory
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41145>
This commit is contained in:
parent
f91520f75b
commit
d4ae409365
3 changed files with 18 additions and 22 deletions
|
|
@ -375,9 +375,9 @@ vn_android_image_from_anb(struct vn_device *dev,
|
|||
return VK_SUCCESS;
|
||||
}
|
||||
|
||||
struct vn_device_memory *
|
||||
vn_android_get_wsi_memory_from_bind_info(
|
||||
struct vn_device *dev, const VkBindImageMemoryInfo *bind_info)
|
||||
VkDeviceMemory
|
||||
vn_android_get_wsi_memory(struct vn_device *dev,
|
||||
const VkBindImageMemoryInfo *bind_info)
|
||||
{
|
||||
const VkNativeBufferANDROID *anb_info =
|
||||
vk_find_struct_const(bind_info->pNext, NATIVE_BUFFER_ANDROID);
|
||||
|
|
@ -388,9 +388,9 @@ vn_android_get_wsi_memory_from_bind_info(
|
|||
dev, img->base.vk.android_deferred_create_info, anb_info,
|
||||
&dev->base.vk.alloc, &img);
|
||||
if (result != VK_SUCCESS)
|
||||
return NULL;
|
||||
return VK_NULL_HANDLE;
|
||||
|
||||
return img->wsi.anb_mem;
|
||||
return vn_device_memory_to_handle(img->wsi.anb_mem);
|
||||
}
|
||||
|
||||
static VkResult
|
||||
|
|
|
|||
|
|
@ -28,9 +28,9 @@ vn_android_image_from_anb(struct vn_device *dev,
|
|||
const VkAllocationCallbacks *alloc,
|
||||
struct vn_image **out_img);
|
||||
|
||||
struct vn_device_memory *
|
||||
vn_android_get_wsi_memory_from_bind_info(
|
||||
struct vn_device *dev, const VkBindImageMemoryInfo *bind_info);
|
||||
VkDeviceMemory
|
||||
vn_android_get_wsi_memory(struct vn_device *dev,
|
||||
const VkBindImageMemoryInfo *bind_info);
|
||||
|
||||
VkResult
|
||||
vn_android_device_import_ahb(struct vn_device *dev,
|
||||
|
|
@ -49,12 +49,11 @@ vn_android_image_from_anb(UNUSED struct vn_device *dev,
|
|||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
||||
static inline struct vn_device_memory *
|
||||
vn_android_get_wsi_memory_from_bind_info(
|
||||
UNUSED struct vn_device *dev,
|
||||
UNUSED const VkBindImageMemoryInfo *bind_info)
|
||||
static inline VkDeviceMemory
|
||||
vn_android_get_wsi_memory(UNUSED struct vn_device *dev,
|
||||
UNUSED const VkBindImageMemoryInfo *bind_info)
|
||||
{
|
||||
return NULL;
|
||||
return VK_NULL_HANDLE;
|
||||
}
|
||||
|
||||
static inline VkResult
|
||||
|
|
|
|||
|
|
@ -691,13 +691,11 @@ vn_image_bind_wsi_memory(struct vn_device *dev,
|
|||
|
||||
for (uint32_t i = 0; i < count; i++) {
|
||||
VkBindImageMemoryInfo *info = &local_infos[i];
|
||||
struct vn_device_memory *mem =
|
||||
vn_device_memory_from_handle(info->memory);
|
||||
|
||||
if (!mem) {
|
||||
if (info->memory == VK_NULL_HANDLE) {
|
||||
#ifdef VK_USE_PLATFORM_ANDROID_KHR
|
||||
mem = vn_android_get_wsi_memory_from_bind_info(dev, info);
|
||||
if (!mem) {
|
||||
info->memory = vn_android_get_wsi_memory(dev, info);
|
||||
if (info->memory == VK_NULL_HANDLE) {
|
||||
STACK_ARRAY_FINISH(local_infos);
|
||||
return VK_ERROR_OUT_OF_HOST_MEMORY;
|
||||
}
|
||||
|
|
@ -707,13 +705,12 @@ vn_image_bind_wsi_memory(struct vn_device *dev,
|
|||
BIND_IMAGE_MEMORY_SWAPCHAIN_INFO_KHR);
|
||||
assert(swapchain_info);
|
||||
|
||||
mem = vn_device_memory_from_handle(wsi_common_get_memory(
|
||||
swapchain_info->swapchain, swapchain_info->imageIndex));
|
||||
info->memory = wsi_common_get_memory(swapchain_info->swapchain,
|
||||
swapchain_info->imageIndex);
|
||||
#endif
|
||||
info->memory = vn_device_memory_to_handle(mem);
|
||||
info->memoryOffset = 0;
|
||||
}
|
||||
assert(mem && info->memory != VK_NULL_HANDLE);
|
||||
assert(info->memory != VK_NULL_HANDLE);
|
||||
}
|
||||
|
||||
vn_async_vkBindImageMemory2(dev->primary_ring, vn_device_to_handle(dev),
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue