summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXuelian Bai <xuelian.bai@samsung.com>2022-06-10 09:49:26 +0800
committerXuelian Bai <xuelian.bai@samsung.com>2023-10-19 10:04:35 +0800
commitf6c1b8e6c832283b59787b37d4e9bea08bda5740 (patch)
tree569514a92046176c6f716154e27a0ec5efcbc86c
parent5863cc46b616dec67fd5869322f4835abab8d7c3 (diff)
downloadvulkan-wsi-layer-f6c1b8e6c832283b59787b37d4e9bea08bda5740.tar.gz
vulkan-wsi-layer-f6c1b8e6c832283b59787b37d4e9bea08bda5740.tar.bz2
vulkan-wsi-layer-f6c1b8e6c832283b59787b37d4e9bea08bda5740.zip
Fix crash when enable validation layer
When creating surface, validation layer will call WrapNew() function to generate hash and return uint64_t hash id in returned VkSurfaceKHR, this will be an invalid address in 32-bit platform, and also we can't get correct pIcdSurface structure from it. So don't use VkSurfaceKHR surface parameter in get_surface_* functions. Change-Id: I4434295887431509ab99664ceb41edf0c154b361 Signed-Off-by: Xuelian Bai <xuelian.bai@samsung.com>
-rw-r--r--wsi/tizen/surface_properties.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/wsi/tizen/surface_properties.cpp b/wsi/tizen/surface_properties.cpp
index cb55f25..0f3b4af 100644
--- a/wsi/tizen/surface_properties.cpp
+++ b/wsi/tizen/surface_properties.cpp
@@ -64,24 +64,23 @@ surface_properties &surface_properties::get_instance()
VkResult surface_properties::get_surface_capabilities(VkPhysicalDevice physical_device,
VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
{
- VkIcdSurfaceWayland *vk_surf = reinterpret_cast<VkIcdSurfaceWayland *>(surface);
tpl_result_t res;
- if (vk_surf == NULL || vk_surf->display == NULL || vk_surf->surface == NULL)
+ if (specific_surface == NULL || specific_surface->get_wl_display() == NULL)
return VK_ERROR_SURFACE_LOST_KHR;
- tpl_display_t *tpl_display = tpl_display_get_with_backend_type(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(vk_surf->display));
+ tpl_display_t *tpl_display = tpl_display_get_with_backend_type(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(specific_surface->get_wl_display()));
if (tpl_display) {
tpl_object_reference(reinterpret_cast<tpl_object_t *>(tpl_display));
} else {
- tpl_display = tpl_display_create(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(vk_surf->display));
+ tpl_display = tpl_display_create(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(specific_surface->get_wl_display()));
}
if (!tpl_display)
return VK_ERROR_SURFACE_LOST_KHR;
int cnt_min = 0, cnt_max = 0;
- res = tpl_display_query_supported_buffer_count_from_native_window(tpl_display, vk_surf->display, &cnt_min, &cnt_max);
+ res = tpl_display_query_supported_buffer_count_from_native_window(tpl_display, specific_surface->get_wl_display(), &cnt_min, &cnt_max);
if (res != TPL_ERROR_NONE) {
return VK_ERROR_SURFACE_LOST_KHR;
}
@@ -189,24 +188,23 @@ VkResult surface_properties::get_surface_formats_2(VkPhysicalDevice physical_dev
VkResult surface_properties::get_surface_present_modes(VkPhysicalDevice physical_device, VkSurfaceKHR surface,
uint32_t *pPresentModeCount, VkPresentModeKHR *pPresentModes)
{
- VkIcdSurfaceWayland *vk_surf = reinterpret_cast<VkIcdSurfaceWayland *>(surface);
VkResult res = VK_SUCCESS;
- if (vk_surf == NULL || vk_surf->display == NULL || vk_surf->surface == NULL)
+ if (specific_surface == NULL || specific_surface->get_wl_display() == NULL)
return VK_ERROR_SURFACE_LOST_KHR;
- tpl_display_t *tpl_display = tpl_display_get_with_backend_type(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(vk_surf->display));
+ tpl_display_t *tpl_display = tpl_display_get_with_backend_type(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(specific_surface->get_wl_display()));
if (tpl_display) {
tpl_object_reference(reinterpret_cast<tpl_object_t *>(tpl_display));
} else {
- tpl_display = tpl_display_create(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(vk_surf->display));
+ tpl_display = tpl_display_create(TPL_BACKEND_WAYLAND_VULKAN_WSI_THREAD, reinterpret_cast<tpl_handle_t>(specific_surface->get_wl_display()));
}
if (!tpl_display)
return VK_ERROR_SURFACE_LOST_KHR;
int tplModes;
- if (tpl_display_query_supported_present_modes_from_native_window(tpl_display, vk_surf->display, &tplModes) != TPL_ERROR_NONE) {
+ if (tpl_display_query_supported_present_modes_from_native_window(tpl_display, specific_surface->get_wl_display(), &tplModes) != TPL_ERROR_NONE) {
return VK_ERROR_SURFACE_LOST_KHR;
}