From 442f242a4953a10c558d9628eaadb79117648a23 Mon Sep 17 00:00:00 2001 From: Yiwei Zhang Date: Mon, 14 Jul 2025 16:39:19 -0700 Subject: [PATCH] venus: requests whole blob mem size for non-dedicated import For non-dedicated import, later import could have varied size against the same bo, so we just request the whole blob mem size for those. Part-of: --- src/virtio/vulkan/vn_device_memory.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/virtio/vulkan/vn_device_memory.c b/src/virtio/vulkan/vn_device_memory.c index f3859524cd4..a05726fe718 100644 --- a/src/virtio/vulkan/vn_device_memory.c +++ b/src/virtio/vulkan/vn_device_memory.c @@ -115,11 +115,16 @@ vn_device_memory_import_dma_buf(struct vn_device *dev, const VkMemoryType *mem_type = &dev->physical_device->memory_properties .memoryTypes[alloc_info->memoryTypeIndex]; + const VkMemoryDedicatedAllocateInfo *dedicated_info = + vk_find_struct_const(alloc_info->pNext, MEMORY_DEDICATED_ALLOCATE_INFO); + const bool is_dedicated = + dedicated_info && (dedicated_info->image != VK_NULL_HANDLE || + dedicated_info->buffer != VK_NULL_HANDLE); struct vn_renderer_bo *bo; VkResult result = vn_renderer_bo_create_from_dma_buf( - dev->renderer, alloc_info->allocationSize, fd, mem_type->propertyFlags, - &bo); + dev->renderer, is_dedicated ? alloc_info->allocationSize : 0, fd, + mem_type->propertyFlags, &bo); if (result != VK_SUCCESS) return result;