From 531437d7f609427843040b1855485c95227eafec Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Wed, 6 Oct 2021 11:39:06 -0500 Subject: [PATCH] turnip: Use the common WSI wrappers Reviewed-by: Emma Anholt Part-of: --- src/freedreno/vulkan/meson.build | 2 - src/freedreno/vulkan/tu_device.c | 6 + src/freedreno/vulkan/tu_wsi.c | 197 +--------------------------- src/freedreno/vulkan/tu_wsi_display.c | 239 ---------------------------------- src/freedreno/vulkan/tu_wsi_wayland.c | 59 --------- src/freedreno/vulkan/tu_wsi_x11.c | 104 --------------- 6 files changed, 8 insertions(+), 599 deletions(-) delete mode 100644 src/freedreno/vulkan/tu_wsi_wayland.c delete mode 100644 src/freedreno/vulkan/tu_wsi_x11.c diff --git a/src/freedreno/vulkan/meson.build b/src/freedreno/vulkan/meson.build index ec63bf5..9a1a464 100644 --- a/src/freedreno/vulkan/meson.build +++ b/src/freedreno/vulkan/meson.build @@ -61,13 +61,11 @@ tu_wsi = false if with_platform_x11 tu_deps += dep_xcb_dri3 - libtu_files += files('tu_wsi_x11.c') tu_wsi = true endif if with_platform_wayland tu_deps += dep_wayland_client - libtu_files += files('tu_wsi_wayland.c') tu_wsi = true endif diff --git a/src/freedreno/vulkan/tu_device.c b/src/freedreno/vulkan/tu_device.c index 359685c..aff3698 100644 --- a/src/freedreno/vulkan/tu_device.c +++ b/src/freedreno/vulkan/tu_device.c @@ -261,6 +261,8 @@ tu_physical_device_init(struct tu_physical_device *device, struct vk_physical_device_dispatch_table dispatch_table; vk_physical_device_dispatch_table_from_entrypoints( &dispatch_table, &tu_physical_device_entrypoints, true); + vk_physical_device_dispatch_table_from_entrypoints( + &dispatch_table, &wsi_physical_device_entrypoints, false); result = vk_physical_device_init(&device->vk, &instance->vk, &supported_extensions, @@ -347,6 +349,8 @@ tu_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, struct vk_instance_dispatch_table dispatch_table; vk_instance_dispatch_table_from_entrypoints( &dispatch_table, &tu_instance_entrypoints, true); + vk_instance_dispatch_table_from_entrypoints( + &dispatch_table, &wsi_instance_entrypoints, false); result = vk_instance_init(&instance->vk, &tu_instance_extensions_supported, @@ -1427,6 +1431,8 @@ tu_CreateDevice(VkPhysicalDevice physicalDevice, struct vk_device_dispatch_table dispatch_table; vk_device_dispatch_table_from_entrypoints( &dispatch_table, &tu_device_entrypoints, true); + vk_device_dispatch_table_from_entrypoints( + &dispatch_table, &wsi_device_entrypoints, false); result = vk_device_init(&device->vk, &physical_device->vk, &dispatch_table, pCreateInfo, pAllocator); diff --git a/src/freedreno/vulkan/tu_wsi.c b/src/freedreno/vulkan/tu_wsi.c index 54c0495..932ab41 100644 --- a/src/freedreno/vulkan/tu_wsi.c +++ b/src/freedreno/vulkan/tu_wsi.c @@ -51,6 +51,7 @@ tu_wsi_init(struct tu_physical_device *physical_device) return result; physical_device->wsi_device.supports_modifiers = true; + physical_device->vk.wsi_device = &physical_device->wsi_device; return VK_SUCCESS; } @@ -58,171 +59,11 @@ tu_wsi_init(struct tu_physical_device *physical_device) void tu_wsi_finish(struct tu_physical_device *physical_device) { + physical_device->vk.wsi_device = NULL; wsi_device_finish(&physical_device->wsi_device, &physical_device->instance->vk.alloc); } -VKAPI_ATTR void VKAPI_CALL -tu_DestroySurfaceKHR(VkInstance _instance, - VkSurfaceKHR _surface, - const VkAllocationCallbacks *pAllocator) -{ - TU_FROM_HANDLE(tu_instance, instance, _instance); - ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface); - - vk_free2(&instance->vk.alloc, pAllocator, surface); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - VkSurfaceKHR surface, - VkBool32 *pSupported) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_support( - &device->wsi_device, queueFamilyIndex, surface, pSupported); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfaceCapabilitiesKHR( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - VkSurfaceCapabilitiesKHR *pSurfaceCapabilities) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_capabilities(&device->wsi_device, surface, - pSurfaceCapabilities); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfaceCapabilities2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, - VkSurfaceCapabilities2KHR *pSurfaceCapabilities) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_capabilities2( - &device->wsi_device, pSurfaceInfo, pSurfaceCapabilities); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfaceCapabilities2EXT( - VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - VkSurfaceCapabilities2EXT *pSurfaceCapabilities) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_capabilities2ext( - &device->wsi_device, surface, pSurfaceCapabilities); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t *pSurfaceFormatCount, - VkSurfaceFormatKHR *pSurfaceFormats) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_formats( - &device->wsi_device, surface, pSurfaceFormatCount, pSurfaceFormats); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfaceFormats2KHR( - VkPhysicalDevice physicalDevice, - const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo, - uint32_t *pSurfaceFormatCount, - VkSurfaceFormat2KHR *pSurfaceFormats) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_formats2(&device->wsi_device, pSurfaceInfo, - pSurfaceFormatCount, - pSurfaceFormats); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t *pPresentModeCount, - VkPresentModeKHR *pPresentModes) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_surface_present_modes( - &device->wsi_device, surface, pPresentModeCount, pPresentModes); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_CreateSwapchainKHR(VkDevice _device, - const VkSwapchainCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSwapchainKHR *pSwapchain) -{ - TU_FROM_HANDLE(tu_device, device, _device); - const VkAllocationCallbacks *alloc; - if (pAllocator) - alloc = pAllocator; - else - alloc = &device->vk.alloc; - - return wsi_common_create_swapchain(&device->physical_device->wsi_device, - tu_device_to_handle(device), - pCreateInfo, alloc, pSwapchain); -} - -VKAPI_ATTR void VKAPI_CALL -tu_DestroySwapchainKHR(VkDevice _device, - VkSwapchainKHR swapchain, - const VkAllocationCallbacks *pAllocator) -{ - TU_FROM_HANDLE(tu_device, device, _device); - const VkAllocationCallbacks *alloc; - - if (pAllocator) - alloc = pAllocator; - else - alloc = &device->vk.alloc; - - wsi_common_destroy_swapchain(_device, swapchain, alloc); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetSwapchainImagesKHR(VkDevice device, - VkSwapchainKHR swapchain, - uint32_t *pSwapchainImageCount, - VkImage *pSwapchainImages) -{ - return wsi_common_get_images(swapchain, pSwapchainImageCount, - pSwapchainImages); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_AcquireNextImageKHR(VkDevice device, - VkSwapchainKHR swapchain, - uint64_t timeout, - VkSemaphore semaphore, - VkFence fence, - uint32_t *pImageIndex) -{ - VkAcquireNextImageInfoKHR acquire_info = { - .sType = VK_STRUCTURE_TYPE_ACQUIRE_NEXT_IMAGE_INFO_KHR, - .swapchain = swapchain, - .timeout = timeout, - .semaphore = semaphore, - .fence = fence, - .deviceMask = 0, - }; - - return tu_AcquireNextImage2KHR(device, &acquire_info, pImageIndex); -} - VKAPI_ATTR VkResult VKAPI_CALL tu_AcquireNextImage2KHR(VkDevice _device, const VkAcquireNextImageInfoKHR *pAcquireInfo, @@ -255,37 +96,3 @@ tu_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo) tu_device_to_handle(queue->device), _queue, queue->vk.queue_family_index, pPresentInfo); } - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDeviceGroupPresentCapabilitiesKHR( - VkDevice device, VkDeviceGroupPresentCapabilitiesKHR *pCapabilities) -{ - memset(pCapabilities->presentMask, 0, sizeof(pCapabilities->presentMask)); - pCapabilities->presentMask[0] = 0x1; - pCapabilities->modes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; - - return VK_SUCCESS; -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDeviceGroupSurfacePresentModesKHR( - VkDevice device, - VkSurfaceKHR surface, - VkDeviceGroupPresentModeFlagsKHR *pModes) -{ - *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR; - - return VK_SUCCESS; -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, - VkSurfaceKHR surface, - uint32_t *pRectCount, - VkRect2D *pRects) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_common_get_present_rectangles(&device->wsi_device, surface, - pRectCount, pRects); -} diff --git a/src/freedreno/vulkan/tu_wsi_display.c b/src/freedreno/vulkan/tu_wsi_display.c index 877a02a..fce8d7a 100644 --- a/src/freedreno/vulkan/tu_wsi_display.c +++ b/src/freedreno/vulkan/tu_wsi_display.c @@ -34,232 +34,9 @@ #include "util/debug.h" #include "wsi_common_display.h" -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device, - uint32_t *property_count, - VkDisplayPropertiesKHR *properties) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_physical_device_display_properties( - physical_device, - &pdevice->wsi_device, - property_count, - properties); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physical_device, - uint32_t *property_count, - VkDisplayProperties2KHR *properties) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_physical_device_display_properties2( - physical_device, - &pdevice->wsi_device, - property_count, - properties); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceDisplayPlanePropertiesKHR( - VkPhysicalDevice physical_device, - uint32_t *property_count, - VkDisplayPlanePropertiesKHR *properties) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_physical_device_display_plane_properties( - physical_device, - &pdevice->wsi_device, - property_count, - properties); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetPhysicalDeviceDisplayPlaneProperties2KHR( - VkPhysicalDevice physical_device, - uint32_t *property_count, - VkDisplayPlaneProperties2KHR *properties) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_physical_device_display_plane_properties2( - physical_device, - &pdevice->wsi_device, - property_count, - properties); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device, - uint32_t plane_index, - uint32_t *display_count, - VkDisplayKHR *displays) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_display_plane_supported_displays( - physical_device, - &pdevice->wsi_device, - plane_index, - display_count, - displays); -} - - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device, - VkDisplayKHR display, - uint32_t *property_count, - VkDisplayModePropertiesKHR *properties) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_display_mode_properties(physical_device, - &pdevice->wsi_device, - display, - property_count, - properties); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDisplayModeProperties2KHR(VkPhysicalDevice physical_device, - VkDisplayKHR display, - uint32_t *property_count, - VkDisplayModeProperties2KHR *properties) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_get_display_mode_properties2(physical_device, - &pdevice->wsi_device, - display, - property_count, - properties); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_CreateDisplayModeKHR(VkPhysicalDevice physical_device, - VkDisplayKHR display, - const VkDisplayModeCreateInfoKHR *create_info, - const VkAllocationCallbacks *allocator, - VkDisplayModeKHR *mode) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_display_create_display_mode(physical_device, - &pdevice->wsi_device, - display, - create_info, - allocator, - mode); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device, - VkDisplayModeKHR mode_khr, - uint32_t plane_index, - VkDisplayPlaneCapabilitiesKHR *capabilities) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_get_display_plane_capabilities(physical_device, - &pdevice->wsi_device, - mode_khr, - plane_index, - capabilities); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physical_device, - const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo, - VkDisplayPlaneCapabilities2KHR *capabilities) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_get_display_plane_capabilities2(physical_device, - &pdevice->wsi_device, - pDisplayPlaneInfo, - capabilities); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_CreateDisplayPlaneSurfaceKHR( - VkInstance _instance, - const VkDisplaySurfaceCreateInfoKHR *create_info, - const VkAllocationCallbacks *allocator, - VkSurfaceKHR *surface) -{ - TU_FROM_HANDLE(tu_instance, instance, _instance); - const VkAllocationCallbacks *alloc; - - if (allocator) - alloc = allocator; - else - alloc = &instance->vk.alloc; - - return wsi_create_display_surface(_instance, alloc, - create_info, surface); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_ReleaseDisplayEXT(VkPhysicalDevice physical_device, - VkDisplayKHR display) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_release_display(physical_device, - &pdevice->wsi_device, - display); -} - -#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT -VKAPI_ATTR VkResult VKAPI_CALL -tu_AcquireXlibDisplayEXT(VkPhysicalDevice physical_device, - Display *dpy, - VkDisplayKHR display) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_acquire_xlib_display(physical_device, - &pdevice->wsi_device, - dpy, - display); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device, - Display *dpy, - RROutput output, - VkDisplayKHR *display) -{ - TU_FROM_HANDLE(tu_physical_device, pdevice, physical_device); - - return wsi_get_randr_output_display(physical_device, - &pdevice->wsi_device, - dpy, - output, - display); -} -#endif /* VK_USE_PLATFORM_XLIB_XRANDR_EXT */ - /* VK_EXT_display_control */ VKAPI_ATTR VkResult VKAPI_CALL -tu_DisplayPowerControlEXT(VkDevice _device, - VkDisplayKHR display, - const VkDisplayPowerInfoEXT *display_power_info) -{ - TU_FROM_HANDLE(tu_device, device, _device); - - return wsi_display_power_control(_device, - &device->physical_device->wsi_device, - display, - display_power_info); -} - -VKAPI_ATTR VkResult VKAPI_CALL tu_RegisterDeviceEventEXT(VkDevice _device, const VkDeviceEventInfoEXT *device_event_info, const VkAllocationCallbacks *allocator, @@ -333,19 +110,3 @@ tu_RegisterDisplayEventEXT(VkDevice _device, return ret; } - -VKAPI_ATTR VkResult VKAPI_CALL -tu_GetSwapchainCounterEXT(VkDevice _device, - VkSwapchainKHR swapchain, - VkSurfaceCounterFlagBitsEXT flag_bits, - uint64_t *value) -{ - TU_FROM_HANDLE(tu_device, device, _device); - - return wsi_get_swapchain_counter(_device, - &device->physical_device->wsi_device, - swapchain, - flag_bits, - value); -} - diff --git a/src/freedreno/vulkan/tu_wsi_wayland.c b/src/freedreno/vulkan/tu_wsi_wayland.c deleted file mode 100644 index f8c74c9..0000000 --- a/src/freedreno/vulkan/tu_wsi_wayland.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright © 2016 Red Hat - * based on intel anv code: - * Copyright © 2015 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include "tu_private.h" - -#include "wsi_common_wayland.h" - -VKAPI_ATTR VkBool32 VKAPI_CALL -tu_GetPhysicalDeviceWaylandPresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - struct wl_display *display) -{ - TU_FROM_HANDLE(tu_physical_device, physical_device, physicalDevice); - - return wsi_wl_get_presentation_support(&physical_device->wsi_device, - display); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_CreateWaylandSurfaceKHR(VkInstance _instance, - const VkWaylandSurfaceCreateInfoKHR *pCreateInfo, - const VkAllocationCallbacks *pAllocator, - VkSurfaceKHR *pSurface) -{ - TU_FROM_HANDLE(tu_instance, instance, _instance); - const VkAllocationCallbacks *alloc; - assert(pCreateInfo->sType == - VK_STRUCTURE_TYPE_WAYLAND_SURFACE_CREATE_INFO_KHR); - - if (pAllocator) - alloc = pAllocator; - else - alloc = &instance->vk.alloc; - - return wsi_create_wl_surface(alloc, pCreateInfo, pSurface); -} diff --git a/src/freedreno/vulkan/tu_wsi_x11.c b/src/freedreno/vulkan/tu_wsi_x11.c deleted file mode 100644 index 53af31a..0000000 --- a/src/freedreno/vulkan/tu_wsi_x11.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright © 2016 Red Hat. - * Copyright © 2016 Bas Nieuwenhuizen - * - * based mostly on anv driver which is: - * Copyright © 2015 Intel Corporation - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -#include -#include -#include -#include -#include - -#include "wsi_common_x11.h" -#include "tu_private.h" - -VKAPI_ATTR VkBool32 VKAPI_CALL -tu_GetPhysicalDeviceXcbPresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - xcb_connection_t* connection, - xcb_visualid_t visual_id) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_get_physical_device_xcb_presentation_support( - &device->wsi_device, - queueFamilyIndex, - connection, visual_id); -} - -VKAPI_ATTR VkBool32 VKAPI_CALL -tu_GetPhysicalDeviceXlibPresentationSupportKHR( - VkPhysicalDevice physicalDevice, - uint32_t queueFamilyIndex, - Display* dpy, - VisualID visualID) -{ - TU_FROM_HANDLE(tu_physical_device, device, physicalDevice); - - return wsi_get_physical_device_xcb_presentation_support( - &device->wsi_device, - queueFamilyIndex, - XGetXCBConnection(dpy), visualID); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_CreateXcbSurfaceKHR( - VkInstance _instance, - const VkXcbSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface) -{ - TU_FROM_HANDLE(tu_instance, instance, _instance); - const VkAllocationCallbacks *alloc; - assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR); - - if (pAllocator) - alloc = pAllocator; - else - alloc = &instance->vk.alloc; - - return wsi_create_xcb_surface(alloc, pCreateInfo, pSurface); -} - -VKAPI_ATTR VkResult VKAPI_CALL -tu_CreateXlibSurfaceKHR( - VkInstance _instance, - const VkXlibSurfaceCreateInfoKHR* pCreateInfo, - const VkAllocationCallbacks* pAllocator, - VkSurfaceKHR* pSurface) -{ - TU_FROM_HANDLE(tu_instance, instance, _instance); - const VkAllocationCallbacks *alloc; - - assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR); - - if (pAllocator) - alloc = pAllocator; - else - alloc = &instance->vk.alloc; - - return wsi_create_xlib_surface(alloc, pCreateInfo, pSurface); -} -- 2.7.4