From 4ac94d0deed2c1bf1b47f512340c66cf9bde80c7 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Thu, 13 Jul 2017 11:18:39 -0700 Subject: [PATCH] anv: Drop support for VK_KHX_external_memory_* MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit These have been formally deprecated by Khronos never to be shipped again. The KHR versions should be implemented/used instead. Reviewed-by: Samuel Iglesias Gonsálvez Reviewed-by: Lionel Landwerlin --- src/intel/vulkan/anv_device.c | 84 ++----------------------- src/intel/vulkan/anv_entrypoints_gen.py | 3 - src/intel/vulkan/anv_formats.c | 79 ----------------------- 3 files changed, 5 insertions(+), 161 deletions(-) diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index d3607deccfc..7c269608202 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -437,10 +437,6 @@ static const VkExtensionProperties global_extensions[] = { .specVersion = 6, }, #endif - { - .extensionName = VK_KHX_EXTERNAL_MEMORY_CAPABILITIES_EXTENSION_NAME, - .specVersion = 1, - }, { .extensionName = VK_KHX_EXTERNAL_SEMAPHORE_CAPABILITIES_EXTENSION_NAME, .specVersion = 1, @@ -476,14 +472,6 @@ static const VkExtensionProperties device_extensions[] = { .extensionName = VK_KHR_SWAPCHAIN_EXTENSION_NAME, .specVersion = 68, }, - { - .extensionName = VK_KHX_EXTERNAL_MEMORY_EXTENSION_NAME, - .specVersion = 1, - }, - { - .extensionName = VK_KHX_EXTERNAL_MEMORY_FD_EXTENSION_NAME, - .specVersion = 1, - }, { .extensionName = VK_KHX_EXTERNAL_SEMAPHORE_EXTENSION_NAME, .specVersion = 1, @@ -905,8 +893,6 @@ void anv_GetPhysicalDeviceProperties2KHR( VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2KHR* pProperties) { - ANV_FROM_HANDLE(anv_physical_device, pdevice, physicalDevice); - anv_GetPhysicalDeviceProperties(physicalDevice, &pProperties->properties); vk_foreach_struct(ext, pProperties->pNext) { @@ -919,16 +905,6 @@ void anv_GetPhysicalDeviceProperties2KHR( break; } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ID_PROPERTIES_KHX: { - VkPhysicalDeviceIDPropertiesKHX *id_props = - (VkPhysicalDeviceIDPropertiesKHX *)ext; - memcpy(id_props->deviceUUID, pdevice->device_uuid, VK_UUID_SIZE); - memcpy(id_props->driverUUID, pdevice->driver_uuid, VK_UUID_SIZE); - /* The LUID is for Windows. */ - id_props->deviceLUIDValid = false; - break; - } - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_MULTIVIEW_PROPERTIES_KHX: { VkPhysicalDeviceMultiviewPropertiesKHX *properties = (VkPhysicalDeviceMultiviewPropertiesKHX *)ext; @@ -1572,31 +1548,11 @@ VkResult anv_AllocateMemory( mem->map = NULL; mem->map_size = 0; - const VkImportMemoryFdInfoKHX *fd_info = - vk_find_struct_const(pAllocateInfo->pNext, IMPORT_MEMORY_FD_INFO_KHX); - - /* The Vulkan spec permits handleType to be 0, in which case the struct is - * ignored. - */ - if (fd_info && fd_info->handleType) { - /* At the moment, we only support the OPAQUE_FD memory type which is - * just a GEM buffer. - */ - assert(fd_info->handleType == - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX); - - result = anv_bo_cache_import(device, &device->bo_cache, - fd_info->fd, pAllocateInfo->allocationSize, - &mem->bo); - if (result != VK_SUCCESS) - goto fail; - } else { - result = anv_bo_cache_alloc(device, &device->bo_cache, - pAllocateInfo->allocationSize, - &mem->bo); - if (result != VK_SUCCESS) - goto fail; - } + result = anv_bo_cache_alloc(device, &device->bo_cache, + pAllocateInfo->allocationSize, + &mem->bo); + if (result != VK_SUCCESS) + goto fail; assert(mem->type->heapIndex < pdevice->memory.heap_count); if (pdevice->memory.heaps[mem->type->heapIndex].supports_48bit_addresses) @@ -1615,36 +1571,6 @@ VkResult anv_AllocateMemory( return result; } -VkResult anv_GetMemoryFdKHX( - VkDevice device_h, - VkDeviceMemory memory_h, - VkExternalMemoryHandleTypeFlagBitsKHX handleType, - int* pFd) -{ - ANV_FROM_HANDLE(anv_device, dev, device_h); - ANV_FROM_HANDLE(anv_device_memory, mem, memory_h); - - /* We support only one handle type. */ - assert(handleType == VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX); - - return anv_bo_cache_export(dev, &dev->bo_cache, mem->bo, pFd); -} - -VkResult anv_GetMemoryFdPropertiesKHX( - VkDevice device_h, - VkExternalMemoryHandleTypeFlagBitsKHX handleType, - int fd, - VkMemoryFdPropertiesKHX* pMemoryFdProperties) -{ - /* The valid usage section for this function says: - * - * "handleType must not be one of the handle types defined as opaque." - * - * Since we only handle opaque handles for now, there are no FD properties. - */ - return VK_ERROR_INVALID_EXTERNAL_HANDLE_KHX; -} - void anv_FreeMemory( VkDevice _device, VkDeviceMemory _mem, diff --git a/src/intel/vulkan/anv_entrypoints_gen.py b/src/intel/vulkan/anv_entrypoints_gen.py index f1b4b0c95e1..0de83fabd60 100644 --- a/src/intel/vulkan/anv_entrypoints_gen.py +++ b/src/intel/vulkan/anv_entrypoints_gen.py @@ -46,9 +46,6 @@ SUPPORTED_EXTENSIONS = [ 'VK_KHR_wayland_surface', 'VK_KHR_xcb_surface', 'VK_KHR_xlib_surface', - 'VK_KHX_external_memory', - 'VK_KHX_external_memory_capabilities', - 'VK_KHX_external_memory_fd', 'VK_KHX_external_semaphore', 'VK_KHX_external_semaphore_capabilities', 'VK_KHX_external_semaphore_fd', diff --git a/src/intel/vulkan/anv_formats.c b/src/intel/vulkan/anv_formats.c index 0bc81d12dab..424db66ec22 100644 --- a/src/intel/vulkan/anv_formats.c +++ b/src/intel/vulkan/anv_formats.c @@ -650,25 +650,12 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties( pImageFormatProperties); } -static const VkExternalMemoryPropertiesKHX prime_fd_props = { - /* If we can handle external, then we can both import and export it. */ - .externalMemoryFeatures = VK_EXTERNAL_MEMORY_FEATURE_EXPORTABLE_BIT_KHX | - VK_EXTERNAL_MEMORY_FEATURE_IMPORTABLE_BIT_KHX, - /* For the moment, let's not support mixing and matching */ - .exportFromImportedHandleTypes = - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX, - .compatibleHandleTypes = - VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX, -}; - VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR( VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2KHR* base_info, VkImageFormatProperties2KHR* base_props) { ANV_FROM_HANDLE(anv_physical_device, physical_device, physicalDevice); - const VkPhysicalDeviceExternalImageFormatInfoKHX *external_info = NULL; - VkExternalImageFormatPropertiesKHX *external_props = NULL; VkResult result; result = anv_get_image_format_properties(physical_device, base_info, @@ -679,9 +666,6 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR( /* Extract input structs */ vk_foreach_struct_const(s, base_info->pNext) { switch (s->sType) { - case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_EXTERNAL_IMAGE_FORMAT_INFO_KHX: - external_info = (const void *) s; - break; default: anv_debug_ignored_stype(s->sType); break; @@ -691,42 +675,12 @@ VkResult anv_GetPhysicalDeviceImageFormatProperties2KHR( /* Extract output structs */ vk_foreach_struct(s, base_props->pNext) { switch (s->sType) { - case VK_STRUCTURE_TYPE_EXTERNAL_IMAGE_FORMAT_PROPERTIES_KHX: - external_props = (void *) s; - break; default: anv_debug_ignored_stype(s->sType); break; } } - /* From the Vulkan 1.0.42 spec: - * - * If handleType is 0, vkGetPhysicalDeviceImageFormatProperties2KHR will - * behave as if VkPhysicalDeviceExternalImageFormatInfoKHX was not - * present and VkExternalImageFormatPropertiesKHX will be ignored. - */ - if (external_info && external_info->handleType != 0) { - switch (external_info->handleType) { - case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX: - if (external_props) - external_props->externalMemoryProperties = prime_fd_props; - break; - default: - /* From the Vulkan 1.0.42 spec: - * - * If handleType is not compatible with the [parameters] specified - * in VkPhysicalDeviceImageFormatInfo2KHR, then - * vkGetPhysicalDeviceImageFormatProperties2KHR returns - * VK_ERROR_FORMAT_NOT_SUPPORTED. - */ - result = vk_errorf(VK_ERROR_FORMAT_NOT_SUPPORTED, - "unsupported VkExternalMemoryTypeFlagBitsKHX 0x%x", - external_info->handleType); - goto fail; - } - } - return VK_SUCCESS; fail: @@ -767,36 +721,3 @@ void anv_GetPhysicalDeviceSparseImageFormatProperties2KHR( /* Sparse images are not yet supported. */ *pPropertyCount = 0; } - -void anv_GetPhysicalDeviceExternalBufferPropertiesKHX( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceExternalBufferInfoKHX* pExternalBufferInfo, - VkExternalBufferPropertiesKHX* pExternalBufferProperties) -{ - /* The Vulkan 1.0.42 spec says "handleType must be a valid - * VkExternalMemoryHandleTypeFlagBitsKHX value" in - * VkPhysicalDeviceExternalBufferInfoKHX. This differs from - * VkPhysicalDeviceExternalImageFormatInfoKHX, which surprisingly permits - * handleType == 0. - */ - assert(pExternalBufferInfo->handleType != 0); - - /* All of the current flags are for sparse which we don't support yet. - * Even when we do support it, doing sparse on external memory sounds - * sketchy. Also, just disallowing flags is the safe option. - */ - if (pExternalBufferInfo->flags) - goto unsupported; - - switch (pExternalBufferInfo->handleType) { - case VK_EXTERNAL_MEMORY_HANDLE_TYPE_OPAQUE_FD_BIT_KHX: - pExternalBufferProperties->externalMemoryProperties = prime_fd_props; - return; - default: - goto unsupported; - } - - unsupported: - pExternalBufferProperties->externalMemoryProperties = - (VkExternalMemoryPropertiesKHX) {0}; -} -- 2.30.2