Mesa (main): radv: Use the common WSI wrappers
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Wed Oct 13 00:36:59 UTC 2021
Module: Mesa
Branch: main
Commit: fbfd761461651403342ff4a1a8b3f0acd434eb17
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=fbfd761461651403342ff4a1a8b3f0acd434eb17
Author: Jason Ekstrand <jason at jlekstrand.net>
Date: Wed Oct 6 11:34:22 2021 -0500
radv: Use the common WSI wrappers
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>
---
src/amd/vulkan/meson.build | 2 -
src/amd/vulkan/radv_device.c | 4 +
src/amd/vulkan/radv_wsi.c | 171 +---------------------------------
src/amd/vulkan/radv_wsi_display.c | 187 --------------------------------------
src/amd/vulkan/radv_wsi_wayland.c | 53 -----------
src/amd/vulkan/radv_wsi_x11.c | 91 -------------------
6 files changed, 8 insertions(+), 500 deletions(-)
diff --git a/src/amd/vulkan/meson.build b/src/amd/vulkan/meson.build
index 2437d2bce7e..1d09248036c 100644
--- a/src/amd/vulkan/meson.build
+++ b/src/amd/vulkan/meson.build
@@ -113,12 +113,10 @@ radv_flags = cc.get_supported_arguments(['-Wimplicit-fallthrough', '-Wshadow'])
if with_platform_x11
radv_deps += dep_xcb_dri3
- libradv_files += files('radv_wsi_x11.c')
endif
if with_platform_wayland
radv_deps += dep_wayland_client
- libradv_files += files('radv_wsi_wayland.c')
endif
if system_has_kms_drm and not with_platform_android
diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index e30e308d3fc..8cf934e35db 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -619,6 +619,8 @@ radv_physical_device_try_create(struct radv_instance *instance, drmDevicePtr drm
struct vk_physical_device_dispatch_table dispatch_table;
vk_physical_device_dispatch_table_from_entrypoints(&dispatch_table,
&radv_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, NULL, &dispatch_table);
if (result != VK_SUCCESS) {
@@ -965,6 +967,7 @@ radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo,
struct vk_instance_dispatch_table dispatch_table;
vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &radv_instance_entrypoints, true);
+ vk_instance_dispatch_table_from_entrypoints(&dispatch_table, &wsi_instance_entrypoints, false);
result = vk_instance_init(&instance->vk, &radv_instance_extensions_supported, &dispatch_table,
pCreateInfo, pAllocator);
if (result != VK_SUCCESS) {
@@ -2868,6 +2871,7 @@ radv_CreateDevice(VkPhysicalDevice physicalDevice, const VkDeviceCreateInfo *pCr
} else {
vk_device_dispatch_table_from_entrypoints(&dispatch_table, &radv_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/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index c163a8124ec..a90bceeffe3 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -59,153 +59,19 @@ radv_init_wsi(struct radv_physical_device *physical_device)
physical_device->wsi_device.supports_modifiers = physical_device->rad_info.chip_class >= GFX9;
physical_device->wsi_device.set_memory_ownership = radv_wsi_set_memory_ownership;
+
+ physical_device->vk.wsi_device = &physical_device->wsi_device;
+
return VK_SUCCESS;
}
void
radv_finish_wsi(struct radv_physical_device *physical_device)
{
+ physical_device->vk.wsi_device = NULL;
wsi_device_finish(&physical_device->wsi_device, &physical_device->instance->vk.alloc);
}
-void
-radv_DestroySurfaceKHR(VkInstance _instance, VkSurfaceKHR _surface,
- const VkAllocationCallbacks *pAllocator)
-{
- RADV_FROM_HANDLE(radv_instance, instance, _instance);
- ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
-
- vk_free2(&instance->vk.alloc, pAllocator, surface);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfaceSupportKHR(VkPhysicalDevice physicalDevice, uint32_t queueFamilyIndex,
- VkSurfaceKHR surface, VkBool32 *pSupported)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_support(&device->wsi_device, queueFamilyIndex, surface,
- pSupported);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
- VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_capabilities(&device->wsi_device, surface, pSurfaceCapabilities);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice physicalDevice,
- const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
- VkSurfaceCapabilities2KHR *pSurfaceCapabilities)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_capabilities2(&device->wsi_device, pSurfaceInfo,
- pSurfaceCapabilities);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfaceCapabilities2EXT(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
- VkSurfaceCapabilities2EXT *pSurfaceCapabilities)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_capabilities2ext(&device->wsi_device, surface,
- pSurfaceCapabilities);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfaceFormatsKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
- uint32_t *pSurfaceFormatCount,
- VkSurfaceFormatKHR *pSurfaceFormats)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_formats(&device->wsi_device, surface, pSurfaceFormatCount,
- pSurfaceFormats);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfaceFormats2KHR(VkPhysicalDevice physicalDevice,
- const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
- uint32_t *pSurfaceFormatCount,
- VkSurfaceFormat2KHR *pSurfaceFormats)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_formats2(&device->wsi_device, pSurfaceInfo, pSurfaceFormatCount,
- pSurfaceFormats);
-}
-
-VkResult
-radv_GetPhysicalDeviceSurfacePresentModesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
- uint32_t *pPresentModeCount,
- VkPresentModeKHR *pPresentModes)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_surface_present_modes(&device->wsi_device, surface, pPresentModeCount,
- pPresentModes);
-}
-
-VkResult
-radv_CreateSwapchainKHR(VkDevice _device, const VkSwapchainCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator, VkSwapchainKHR *pSwapchain)
-{
- RADV_FROM_HANDLE(radv_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,
- radv_device_to_handle(device), pCreateInfo, alloc,
- pSwapchain);
-}
-
-void
-radv_DestroySwapchainKHR(VkDevice _device, VkSwapchainKHR swapchain,
- const VkAllocationCallbacks *pAllocator)
-{
- RADV_FROM_HANDLE(radv_device, device, _device);
- const VkAllocationCallbacks *alloc;
-
- if (pAllocator)
- alloc = pAllocator;
- else
- alloc = &device->vk.alloc;
-
- wsi_common_destroy_swapchain(_device, swapchain, alloc);
-}
-
-VkResult
-radv_GetSwapchainImagesKHR(VkDevice device, VkSwapchainKHR swapchain,
- uint32_t *pSwapchainImageCount, VkImage *pSwapchainImages)
-{
- return wsi_common_get_images(swapchain, pSwapchainImageCount, pSwapchainImages);
-}
-
-VkResult
-radv_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 radv_AcquireNextImage2KHR(device, &acquire_info, pImageIndex);
-}
-
VkResult
radv_AcquireNextImage2KHR(VkDevice _device, const VkAcquireNextImageInfoKHR *pAcquireInfo,
uint32_t *pImageIndex)
@@ -254,32 +120,3 @@ radv_QueuePresentKHR(VkQueue _queue, const VkPresentInfoKHR *pPresentInfo)
radv_device_to_handle(queue->device), _queue,
queue->vk.queue_family_index, pPresentInfo);
}
-
-VkResult
-radv_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;
-}
-
-VkResult
-radv_GetDeviceGroupSurfacePresentModesKHR(VkDevice device, VkSurfaceKHR surface,
- VkDeviceGroupPresentModeFlagsKHR *pModes)
-{
- *pModes = VK_DEVICE_GROUP_PRESENT_MODE_LOCAL_BIT_KHR;
-
- return VK_SUCCESS;
-}
-
-VkResult
-radv_GetPhysicalDevicePresentRectanglesKHR(VkPhysicalDevice physicalDevice, VkSurfaceKHR surface,
- uint32_t *pRectCount, VkRect2D *pRects)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_common_get_present_rectangles(&device->wsi_device, surface, pRectCount, pRects);
-}
diff --git a/src/amd/vulkan/radv_wsi_display.c b/src/amd/vulkan/radv_wsi_display.c
index 3f1a41aafd1..a84d82a8cfb 100644
--- a/src/amd/vulkan/radv_wsi_display.c
+++ b/src/amd/vulkan/radv_wsi_display.c
@@ -41,168 +41,8 @@
#define MM_PER_PIXEL (1.0 / 96.0 * 25.4)
-VkResult
-radv_GetPhysicalDeviceDisplayPropertiesKHR(VkPhysicalDevice physical_device,
- uint32_t *property_count,
- VkDisplayPropertiesKHR *properties)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_physical_device_display_properties(physical_device, &pdevice->wsi_device,
- property_count, properties);
-}
-
-VkResult
-radv_GetPhysicalDeviceDisplayProperties2KHR(VkPhysicalDevice physical_device,
- uint32_t *property_count,
- VkDisplayProperties2KHR *properties)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_physical_device_display_properties2(physical_device, &pdevice->wsi_device,
- property_count, properties);
-}
-
-VkResult
-radv_GetPhysicalDeviceDisplayPlanePropertiesKHR(VkPhysicalDevice physical_device,
- uint32_t *property_count,
- VkDisplayPlanePropertiesKHR *properties)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_physical_device_display_plane_properties(
- physical_device, &pdevice->wsi_device, property_count, properties);
-}
-
-VkResult
-radv_GetPhysicalDeviceDisplayPlaneProperties2KHR(VkPhysicalDevice physical_device,
- uint32_t *property_count,
- VkDisplayPlaneProperties2KHR *properties)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_physical_device_display_plane_properties2(
- physical_device, &pdevice->wsi_device, property_count, properties);
-}
-
-VkResult
-radv_GetDisplayPlaneSupportedDisplaysKHR(VkPhysicalDevice physical_device, uint32_t plane_index,
- uint32_t *display_count, VkDisplayKHR *displays)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_display_plane_supported_displays(physical_device, &pdevice->wsi_device,
- plane_index, display_count, displays);
-}
-
-VkResult
-radv_GetDisplayModePropertiesKHR(VkPhysicalDevice physical_device, VkDisplayKHR display,
- uint32_t *property_count, VkDisplayModePropertiesKHR *properties)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_display_mode_properties(physical_device, &pdevice->wsi_device, display,
- property_count, properties);
-}
-
-VkResult
-radv_GetDisplayModeProperties2KHR(VkPhysicalDevice physical_device, VkDisplayKHR display,
- uint32_t *property_count, VkDisplayModeProperties2KHR *properties)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_get_display_mode_properties2(physical_device, &pdevice->wsi_device, display,
- property_count, properties);
-}
-
-VkResult
-radv_CreateDisplayModeKHR(VkPhysicalDevice physical_device, VkDisplayKHR display,
- const VkDisplayModeCreateInfoKHR *create_info,
- const VkAllocationCallbacks *allocator, VkDisplayModeKHR *mode)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_display_create_display_mode(physical_device, &pdevice->wsi_device, display,
- create_info, allocator, mode);
-}
-
-VkResult
-radv_GetDisplayPlaneCapabilitiesKHR(VkPhysicalDevice physical_device, VkDisplayModeKHR mode_khr,
- uint32_t plane_index,
- VkDisplayPlaneCapabilitiesKHR *capabilities)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_get_display_plane_capabilities(physical_device, &pdevice->wsi_device, mode_khr,
- plane_index, capabilities);
-}
-
-VkResult
-radv_GetDisplayPlaneCapabilities2KHR(VkPhysicalDevice physical_device,
- const VkDisplayPlaneInfo2KHR *pDisplayPlaneInfo,
- VkDisplayPlaneCapabilities2KHR *capabilities)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_get_display_plane_capabilities2(physical_device, &pdevice->wsi_device,
- pDisplayPlaneInfo, capabilities);
-}
-
-VkResult
-radv_CreateDisplayPlaneSurfaceKHR(VkInstance _instance,
- const VkDisplaySurfaceCreateInfoKHR *create_info,
- const VkAllocationCallbacks *allocator, VkSurfaceKHR *surface)
-{
- RADV_FROM_HANDLE(radv_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);
-}
-
-VkResult
-radv_ReleaseDisplayEXT(VkPhysicalDevice physical_device, VkDisplayKHR display)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_release_display(physical_device, &pdevice->wsi_device, display);
-}
-
-#ifdef VK_USE_PLATFORM_XLIB_XRANDR_EXT
-VkResult
-radv_AcquireXlibDisplayEXT(VkPhysicalDevice physical_device, Display *dpy, VkDisplayKHR display)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physical_device);
-
- return wsi_acquire_xlib_display(physical_device, &pdevice->wsi_device, dpy, display);
-}
-
-VkResult
-radv_GetRandROutputDisplayEXT(VkPhysicalDevice physical_device, Display *dpy, RROutput output,
- VkDisplayKHR *display)
-{
- RADV_FROM_HANDLE(radv_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 */
-VkResult
-radv_DisplayPowerControlEXT(VkDevice _device, VkDisplayKHR display,
- const VkDisplayPowerInfoEXT *display_power_info)
-{
- RADV_FROM_HANDLE(radv_device, device, _device);
-
- return wsi_display_power_control(_device, &device->physical_device->wsi_device, display,
- display_power_info);
-}
-
VkResult
radv_RegisterDeviceEventEXT(VkDevice _device, const VkDeviceEventInfoEXT *device_event_info,
const VkAllocationCallbacks *allocator, VkFence *_fence)
@@ -281,30 +121,3 @@ radv_RegisterDisplayEventEXT(VkDevice _device, VkDisplayKHR display,
return ret;
}
-
-VkResult
-radv_GetSwapchainCounterEXT(VkDevice _device, VkSwapchainKHR swapchain,
- VkSurfaceCounterFlagBitsEXT flag_bits, uint64_t *value)
-{
- RADV_FROM_HANDLE(radv_device, device, _device);
-
- return wsi_get_swapchain_counter(_device, &device->physical_device->wsi_device, swapchain,
- flag_bits, value);
-}
-
-VkResult
-radv_AcquireDrmDisplayEXT(VkPhysicalDevice physicalDevice, int32_t drmFd, VkDisplayKHR display)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
-
- return wsi_acquire_drm_display(physicalDevice, &pdevice->wsi_device, drmFd, display);
-}
-
-VkResult radv_GetDrmDisplayEXT(VkPhysicalDevice physicalDevice, int32_t drmFd, uint32_t connectorId,
- VkDisplayKHR* display)
-{
- RADV_FROM_HANDLE(radv_physical_device, pdevice, physicalDevice);
-
- return wsi_get_drm_display(physicalDevice, &pdevice->wsi_device, drmFd, connectorId, display);
-}
-
diff --git a/src/amd/vulkan/radv_wsi_wayland.c b/src/amd/vulkan/radv_wsi_wayland.c
deleted file mode 100644
index 0f5751b3898..00000000000
--- a/src/amd/vulkan/radv_wsi_wayland.c
+++ /dev/null
@@ -1,53 +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 "radv_private.h"
-#include "wsi_common_wayland.h"
-
-VkBool32
-radv_GetPhysicalDeviceWaylandPresentationSupportKHR(VkPhysicalDevice physicalDevice,
- uint32_t queueFamilyIndex,
- struct wl_display *display)
-{
- RADV_FROM_HANDLE(radv_physical_device, physical_device, physicalDevice);
-
- return wsi_wl_get_presentation_support(&physical_device->wsi_device, display);
-}
-
-VkResult
-radv_CreateWaylandSurfaceKHR(VkInstance _instance, const VkWaylandSurfaceCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
-{
- RADV_FROM_HANDLE(radv_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/amd/vulkan/radv_wsi_x11.c b/src/amd/vulkan/radv_wsi_x11.c
deleted file mode 100644
index e74cadf2012..00000000000
--- a/src/amd/vulkan/radv_wsi_x11.c
+++ /dev/null
@@ -1,91 +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 <X11/Xlib-xcb.h>
-#include <X11/xshmfence.h>
-#include <xcb/dri3.h>
-#include <xcb/present.h>
-#include <xcb/xcb.h>
-
-#include "radv_private.h"
-#include "wsi_common_x11.h"
-
-VkBool32
-radv_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
- uint32_t queueFamilyIndex,
- xcb_connection_t *connection,
- xcb_visualid_t visual_id)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_get_physical_device_xcb_presentation_support(&device->wsi_device, queueFamilyIndex,
- connection, visual_id);
-}
-
-VkBool32
-radv_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
- uint32_t queueFamilyIndex, Display *dpy,
- VisualID visualID)
-{
- RADV_FROM_HANDLE(radv_physical_device, device, physicalDevice);
-
- return wsi_get_physical_device_xcb_presentation_support(&device->wsi_device, queueFamilyIndex,
- XGetXCBConnection(dpy), visualID);
-}
-
-VkResult
-radv_CreateXcbSurfaceKHR(VkInstance _instance, const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
-{
- RADV_FROM_HANDLE(radv_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);
-}
-
-VkResult
-radv_CreateXlibSurfaceKHR(VkInstance _instance, const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
- const VkAllocationCallbacks *pAllocator, VkSurfaceKHR *pSurface)
-{
- RADV_FROM_HANDLE(radv_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);
-}
More information about the mesa-commit
mailing list