From 5824130389f2333ec44b48814b3e5e84ac297006 Mon Sep 17 00:00:00 2001 From: Chia-I Wu Date: Sat, 6 Jul 2019 12:12:51 -0700 Subject: [PATCH] anv: fix VkExternalBufferProperties for host allocation It was reported as unsupported previously. It should be importable and is compatible with itself. Signed-off-by: Chia-I Wu Fixes: 69cc6272fbc199 ("anv: Implement VK_EXT_external_memory_host") Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_formats.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 8a5b6827666..9aa89d7b21d 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -974,6 +974,13 @@ static const VkExternalMemoryProperties prime_fd_props = { VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT, }; +static const VkExternalMemoryProperties userptr_props = { + .externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT, + .exportFromImportedHandleTypes = 0, + .compatibleHandleTypes = + VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT, +}; + static const VkExternalMemoryProperties android_buffer_props = { .externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT | VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT, @@ -1159,6 +1166,9 @@ void anv_GetPhysicalDeviceExternalBufferProperties( case VK_EXTERNAL_MEMORY_HANDLE_TYPE_DMA_BUF_BIT_EXT: pExternalBufferProperties->externalMemoryProperties = prime_fd_props; return; + case VK_EXTERNAL_MEMORY_HANDLE_TYPE_HOST_ALLOCATION_BIT_EXT: + pExternalBufferProperties->externalMemoryProperties = userptr_props; + return; case VK_EXTERNAL_MEMORY_HANDLE_TYPE_ANDROID_HARDWARE_BUFFER_BIT_ANDROID: if (physical_device->supported_extensions.ANDROID_external_memory_android_hardware_buffer) { pExternalBufferProperties->externalMemoryProperties = android_buffer_props; -- 2.30.2