diff options
author | Xuelian Bai <xuelian.bai@samsung.com> | 2023-05-24 11:01:46 +0800 |
---|---|---|
committer | Xuelian Bai <xuelian.bai@samsung.com> | 2024-01-16 16:22:49 +0800 |
commit | 82d89d69ac16d61475ea405fcf694907f6475d45 (patch) | |
tree | 2e9063f75cf2646dfed2da7f2c86dfc2f3baaa50 | |
parent | 54cc721b7c93901afa19c0690e922052a75f85c4 (diff) | |
download | vulkan-wsi-layer-82d89d69ac16d61475ea405fcf694907f6475d45.tar.gz vulkan-wsi-layer-82d89d69ac16d61475ea405fcf694907f6475d45.tar.bz2 vulkan-wsi-layer-82d89d69ac16d61475ea405fcf694907f6475d45.zip |
Fix bugs for hybris vulkan
1. fix failed case "dEQP-VK.api.version_check.entry_points"
Check if extension is enabled before getting handle
2. Create image with protected bit from swapchain info
3. If queue is getting failed, return error
4. Don't use old pNext pointer to avoid crash
Change-Id: I89426db18dbbd22cb39f0616990e1e3f0b021029
Signed-Off-by: Xuelian Bai <xuelian.bai@samsung.com>
-rw-r--r-- | layer/layer.cpp | 44 | ||||
-rw-r--r-- | wsi/swapchain_base.cpp | 12 |
2 files changed, 55 insertions, 1 deletions
diff --git a/layer/layer.cpp b/layer/layer.cpp index e32c945..e6c2b28 100644 --- a/layer/layer.cpp +++ b/layer/layer.cpp @@ -419,7 +419,7 @@ wsi_layer_vkGetPhysicalDeviceFeatures2KHR(VkPhysicalDevice physicalDevice, #define GET_PROC_ADDR(func) \ if (!strcmp(funcName, #func)) \ return (PFN_vkVoidFunction)&wsi_layer_##func; - +#include "private_data.hpp" VWL_VKAPI_CALL(PFN_vkVoidFunction) wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POST { @@ -439,6 +439,48 @@ wsi_layer_vkGetDeviceProcAddr(VkDevice device, const char *funcName) VWL_API_POS GET_PROC_ADDR(vkCreateImage); GET_PROC_ADDR(vkBindImageMemory2); + /* To pass cts case "dEQP-VK.api.version_check.entry_points", for some icd, it may not really + check if extension is enabled, so we handle here just for functions in this case for temp */ + if (!strcmp(funcName, "vkTrimCommandPoolKHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_MAINTENANCE1_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkCmdPushDescriptorSetKHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_PUSH_DESCRIPTOR_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkCreateSamplerYcbcrConversionKHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_SAMPLER_YCBCR_CONVERSION_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkGetSwapchainStatusKHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_SHARED_PRESENTABLE_IMAGE_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkCreateSwapchainKHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_SWAPCHAIN_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkBindBufferMemory2KHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_BIND_MEMORY_2_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkGetImageSparseMemoryRequirements2KHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME)) + return NULL; + } + else if(!strcmp(funcName, "vkGetBufferMemoryRequirements2KHR") || !strcmp(funcName, "vkGetImageMemoryRequirements2KHR")) + { + if (!layer::device_private_data::get(device).is_device_extension_enabled(VK_KHR_GET_MEMORY_REQUIREMENTS_2_EXTENSION_NAME)) + return NULL; + } return layer::device_private_data::get(device).disp.GetDeviceProcAddr(device, funcName); } diff --git a/wsi/swapchain_base.cpp b/wsi/swapchain_base.cpp index 52d4f17..f0aba48 100644 --- a/wsi/swapchain_base.cpp +++ b/wsi/swapchain_base.cpp @@ -251,6 +251,11 @@ VkResult swapchain_base::init(VkDevice device, const VkSwapchainCreateInfoKHR *s image_create_info.pQueueFamilyIndices = swapchain_create_info->pQueueFamilyIndices; image_create_info.initialLayout = VK_IMAGE_LAYOUT_UNDEFINED; + if (swapchain_create_info->flags & VK_SWAPCHAIN_CREATE_PROTECTED_BIT_KHR) + { + image_create_info.flags |= VK_IMAGE_CREATE_PROTECTED_BIT; + image_create_info.initialLayout = VK_IMAGE_LAYOUT_GENERAL; + } #if BUILD_WSI_TIZEN VkResult result = m_free_image_semaphore.init(0); #else @@ -274,6 +279,12 @@ VkResult swapchain_base::init(VkDevice device, const VkSwapchainCreateInfoKHR *s } m_device_data.disp.GetDeviceQueue(m_device, 0, 0, &m_queue); + if (!m_queue) + { + WSI_LOG_ERROR("Device Queue is NULL"); + return VK_ERROR_OUT_OF_HOST_MEMORY; + } + TRY_LOG_CALL(m_device_data.SetDeviceLoaderData(m_device, m_queue)); int res = sem_init(&m_start_present_semaphore, 0, 0); @@ -537,6 +548,7 @@ VkResult swapchain_base::get_swapchain_images(uint32_t *swapchain_image_count, V VkResult swapchain_base::create_aliased_image_handle(VkImage *image) { + m_image_create_info.pNext = NULL; return m_device_data.disp.CreateImage(m_device, &m_image_create_info, get_allocation_callbacks(), image); } |