From 8f3b58ebee413fc704fb2fa0fab06dbfe146b08a Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 16 Jun 2018 10:27:40 -0700 Subject: [PATCH] vulkan/wsi: Get rid of the get_capabilities hook Instead, we can just use get_capabilities2. This way back-ends only have to implement one hook. Reviewed-by: Keith Packard --- src/vulkan/wsi/wsi_common.c | 11 ++++++++++- src/vulkan/wsi/wsi_common_display.c | 1 - src/vulkan/wsi/wsi_common_private.h | 2 -- src/vulkan/wsi/wsi_common_wayland.c | 1 - src/vulkan/wsi/wsi_common_x11.c | 1 - 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c index 142c5d8fe58..ab5b2dba0da 100644 --- a/src/vulkan/wsi/wsi_common.c +++ b/src/vulkan/wsi/wsi_common.c @@ -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 diff --git a/src/vulkan/wsi/wsi_common_display.c b/src/vulkan/wsi/wsi_common_display.c index 4f52e8087a6..01150ffbb1b 100644 --- a/src/vulkan/wsi/wsi_common_display.c +++ b/src/vulkan/wsi/wsi_common_display.c @@ -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; diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h index 3d502b9fc9d..9f2aacd6560 100644 --- a/src/vulkan/wsi/wsi_common_private.h +++ b/src/vulkan/wsi/wsi_common_private.h @@ -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); diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index ec38a4e578f..4a6a4a29b93 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -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; diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index 20d7cf5a2c8..7e7b3a94e4b 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -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; -- 2.30.2