Mesa (main): vulkan/wsi/x11: Delete the wrapper entrypoints

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Oct 13 00:36:59 UTC 2021


Module: Mesa
Branch: main
Commit: 8ade418144613c2568cf695325fc4c9459c4c50e
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8ade418144613c2568cf695325fc4c9459c4c50e

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Wed Oct  6 12:29:10 2021 -0500

vulkan/wsi/x11: Delete the wrapper entrypoints

Acked-by: Chia-I Wu <olvaffe at gmail.com>
Acked-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13234>

---

 src/vulkan/wsi/wsi_common_x11.c | 97 ++++++++++++-----------------------------
 src/vulkan/wsi/wsi_common_x11.h | 41 -----------------
 2 files changed, 27 insertions(+), 111 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index df9abb46a45..199c9351bb2 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -49,7 +49,6 @@
 #include "vk_enum_to_str.h"
 #include "wsi_common_entrypoints.h"
 #include "wsi_common_private.h"
-#include "wsi_common_x11.h"
 #include "wsi_common_queue.h"
 
 #ifdef HAVE_SYS_SHM_H
@@ -471,12 +470,14 @@ visual_has_alpha(xcb_visualtype_t *visual, unsigned depth)
    return (all_mask & ~rgb_mask) != 0;
 }
 
-VkBool32 wsi_get_physical_device_xcb_presentation_support(
-    struct wsi_device *wsi_device,
-    uint32_t                                    queueFamilyIndex,
-    xcb_connection_t*                           connection,
-    xcb_visualid_t                              visual_id)
+VKAPI_ATTR VkBool32 VKAPI_CALL
+wsi_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
+                                               uint32_t queueFamilyIndex,
+                                               xcb_connection_t *connection,
+                                               xcb_visualid_t visual_id)
 {
+   VK_FROM_HANDLE(vk_physical_device, pdevice, physicalDevice);
+   struct wsi_device *wsi_device = pdevice->wsi_device;
    struct wsi_x11_connection *wsi_conn =
       wsi_x11_get_connection(wsi_device, connection);
 
@@ -498,32 +499,16 @@ VkBool32 wsi_get_physical_device_xcb_presentation_support(
    return true;
 }
 
-VKAPI_ATTR VkBool32 VKAPI_CALL
-wsi_GetPhysicalDeviceXcbPresentationSupportKHR(VkPhysicalDevice physicalDevice,
-                                               uint32_t queueFamilyIndex,
-                                               xcb_connection_t *connection,
-                                               xcb_visualid_t visual_id)
-{
-   VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
-
-   return wsi_get_physical_device_xcb_presentation_support(device->wsi_device,
-                                                           queueFamilyIndex,
-                                                           connection,
-                                                           visual_id);
-}
-
 VKAPI_ATTR VkBool32 VKAPI_CALL
 wsi_GetPhysicalDeviceXlibPresentationSupportKHR(VkPhysicalDevice physicalDevice,
                                                 uint32_t queueFamilyIndex,
                                                 Display *dpy,
                                                 VisualID visualID)
 {
-   VK_FROM_HANDLE(vk_physical_device, device, physicalDevice);
-
-   return wsi_get_physical_device_xcb_presentation_support(device->wsi_device,
-                                                           queueFamilyIndex,
-                                                           XGetXCBConnection(dpy),
-                                                           visualID);
+   return wsi_GetPhysicalDeviceXcbPresentationSupportKHR(physicalDevice,
+                                                         queueFamilyIndex,
+                                                         XGetXCBConnection(dpy),
+                                                         visualID);
 }
 
 static xcb_connection_t*
@@ -806,25 +791,6 @@ x11_surface_get_present_rectangles(VkIcdSurfaceBase *icd_surface,
    return vk_outarray_status(&out);
 }
 
-VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
-				const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
-				VkSurfaceKHR *pSurface)
-{
-   VkIcdSurfaceXcb *surface;
-
-   surface = vk_alloc(pAllocator, sizeof *surface, 8,
-                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
-   if (surface == NULL)
-      return VK_ERROR_OUT_OF_HOST_MEMORY;
-
-   surface->base.platform = VK_ICD_WSI_PLATFORM_XCB;
-   surface->connection = pCreateInfo->connection;
-   surface->window = pCreateInfo->window;
-
-   *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
-   return VK_SUCCESS;
-}
-
 VKAPI_ATTR VkResult VKAPI_CALL
 wsi_CreateXcbSurfaceKHR(VkInstance _instance,
                         const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
@@ -832,31 +798,17 @@ wsi_CreateXcbSurfaceKHR(VkInstance _instance,
                         VkSurfaceKHR *pSurface)
 {
    VK_FROM_HANDLE(vk_instance, instance, _instance);
-   const VkAllocationCallbacks *alloc;
+   VkIcdSurfaceXcb *surface;
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XCB_SURFACE_CREATE_INFO_KHR);
 
-   if (pAllocator)
-     alloc = pAllocator;
-   else
-     alloc = &instance->alloc;
-
-   return wsi_create_xcb_surface(alloc, pCreateInfo, pSurface);
-}
-
-VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
-				 const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
-				 VkSurfaceKHR *pSurface)
-{
-   VkIcdSurfaceXlib *surface;
-
-   surface = vk_alloc(pAllocator, sizeof *surface, 8,
-                      VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+   surface = vk_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
+                       VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
    if (surface == NULL)
       return VK_ERROR_OUT_OF_HOST_MEMORY;
 
-   surface->base.platform = VK_ICD_WSI_PLATFORM_XLIB;
-   surface->dpy = pCreateInfo->dpy;
+   surface->base.platform = VK_ICD_WSI_PLATFORM_XCB;
+   surface->connection = pCreateInfo->connection;
    surface->window = pCreateInfo->window;
 
    *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
@@ -870,16 +822,21 @@ wsi_CreateXlibSurfaceKHR(VkInstance _instance,
                          VkSurfaceKHR *pSurface)
 {
    VK_FROM_HANDLE(vk_instance, instance, _instance);
-   const VkAllocationCallbacks *alloc;
+   VkIcdSurfaceXlib *surface;
 
    assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_XLIB_SURFACE_CREATE_INFO_KHR);
 
-   if (pAllocator)
-     alloc = pAllocator;
-   else
-     alloc = &instance->alloc;
+   surface = vk_alloc2(&instance->alloc, pAllocator, sizeof *surface, 8,
+                       VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
+   if (surface == NULL)
+      return VK_ERROR_OUT_OF_HOST_MEMORY;
 
-   return wsi_create_xlib_surface(alloc, pCreateInfo, pSurface);
+   surface->base.platform = VK_ICD_WSI_PLATFORM_XLIB;
+   surface->dpy = pCreateInfo->dpy;
+   surface->window = pCreateInfo->window;
+
+   *pSurface = VkIcdSurfaceBase_to_handle(&surface->base);
+   return VK_SUCCESS;
 }
 
 struct x11_image {
diff --git a/src/vulkan/wsi/wsi_common_x11.h b/src/vulkan/wsi/wsi_common_x11.h
deleted file mode 100644
index e4b1e94a8c8..00000000000
--- a/src/vulkan/wsi/wsi_common_x11.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * 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.
- */
-#ifndef WSI_COMMON_X11_H
-#define WSI_COMMON_X11_H
-
-#include "wsi_common.h"
-
-VkBool32 wsi_get_physical_device_xcb_presentation_support(
-    struct wsi_device *wsi_device,
-    uint32_t                                    queueFamilyIndex,
-    xcb_connection_t*                           connection,
-    xcb_visualid_t                              visual_id);
-
-VkResult wsi_create_xcb_surface(const VkAllocationCallbacks *pAllocator,
-				const VkXcbSurfaceCreateInfoKHR *pCreateInfo,
-				VkSurfaceKHR *pSurface);
-
-VkResult wsi_create_xlib_surface(const VkAllocationCallbacks *pAllocator,
-				 const VkXlibSurfaceCreateInfoKHR *pCreateInfo,
-				 VkSurfaceKHR *pSurface);
-#endif



More information about the mesa-commit mailing list