vulkan/wsi: Get rid of the get_capabilities hook
authorJason Ekstrand <jason.ekstrand@intel.com>
Sat, 16 Jun 2018 17:27:40 +0000 (10:27 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Wed, 20 Jun 2018 15:16:03 +0000 (08:16 -0700)
Instead, we can just use get_capabilities2.  This way back-ends only
have to implement one hook.

Reviewed-by: Keith Packard <keithp@keithp.com>
src/vulkan/wsi/wsi_common.c
src/vulkan/wsi/wsi_common_display.c
src/vulkan/wsi/wsi_common_private.h
src/vulkan/wsi/wsi_common_wayland.c
src/vulkan/wsi/wsi_common_x11.c

index 142c5d8fe58cb47d7fe105604221a4b8ac2967b9..ab5b2dba0dacb0a212405dd61c3a43efbb313db1 100644 (file)
@@ -695,7 +695,16 @@ wsi_common_get_surface_capabilities(struct wsi_device *wsi_device,
    ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
    struct wsi_interface *iface = wsi_device->wsi[surface->platform];
 
-   return iface->get_capabilities(surface, pSurfaceCapabilities);
+   VkSurfaceCapabilities2KHR caps2 = {
+      .sType = VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR,
+   };
+
+   VkResult result = iface->get_capabilities2(surface, NULL, &caps2);
+
+   if (result == VK_SUCCESS)
+      *pSurfaceCapabilities = caps2.surfaceCapabilities;
+
+   return result;
 }
 
 VkResult
index 4f52e8087a6cfb687c0106dbe355475e6e898cd5..01150ffbb1b18ab989b8bb340fddfe171112bb63 100644 (file)
@@ -1436,7 +1436,6 @@ wsi_display_init_wsi(struct wsi_device *wsi_device,
    }
 
    wsi->base.get_support = wsi_display_surface_get_support;
-   wsi->base.get_capabilities = wsi_display_surface_get_capabilities;
    wsi->base.get_capabilities2 = wsi_display_surface_get_capabilities2;
    wsi->base.get_formats = wsi_display_surface_get_formats;
    wsi->base.get_formats2 = wsi_display_surface_get_formats2;
index 3d502b9fc9d5ba9ccbe6d0ca921c4a7346e570d0..9f2aacd6560a43b90d3b10935f68799b54d36cd0 100644 (file)
@@ -104,8 +104,6 @@ struct wsi_interface {
                            uint32_t queueFamilyIndex,
                            int local_fd,
                            VkBool32* pSupported);
-   VkResult (*get_capabilities)(VkIcdSurfaceBase *surface,
-                                VkSurfaceCapabilitiesKHR* pSurfaceCapabilities);
    VkResult (*get_capabilities2)(VkIcdSurfaceBase *surface,
                                  const void *info_next,
                                  VkSurfaceCapabilities2KHR* pSurfaceCapabilities);
index ec38a4e578f1518505b9e361b2aae8edc07adf7c..4a6a4a29b93ff56a59a69d5831c56932d91c03f9 100644 (file)
@@ -1010,7 +1010,6 @@ wsi_wl_init_wsi(struct wsi_device *wsi_device,
    wsi->wsi = wsi_device;
 
    wsi->base.get_support = wsi_wl_surface_get_support;
-   wsi->base.get_capabilities = wsi_wl_surface_get_capabilities;
    wsi->base.get_capabilities2 = wsi_wl_surface_get_capabilities2;
    wsi->base.get_formats = wsi_wl_surface_get_formats;
    wsi->base.get_formats2 = wsi_wl_surface_get_formats2;
index 20d7cf5a2c8bfa63ef37c0e1849197f273502b1c..7e7b3a94e4bb04bac6130fa83a81836150ccf683 100644 (file)
@@ -1469,7 +1469,6 @@ wsi_x11_init_wsi(struct wsi_device *wsi_device,
    }
 
    wsi->base.get_support = x11_surface_get_support;
-   wsi->base.get_capabilities = x11_surface_get_capabilities;
    wsi->base.get_capabilities2 = x11_surface_get_capabilities2;
    wsi->base.get_formats = x11_surface_get_formats;
    wsi->base.get_formats2 = x11_surface_get_formats2;