[Mesa-dev] [PATCH 1/2] vulkan/wsi: Get rid of the get_capabilities hook
Jason Ekstrand
jason at jlekstrand.net
Sat Jun 16 17:58:41 UTC 2018
Instead, we can just use get_capabilities2. This way back-ends only
have to implement one hook.
---
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 db546929f91..16bbbcd3c1b 100644
--- a/src/vulkan/wsi/wsi_common_display.c
+++ b/src/vulkan/wsi/wsi_common_display.c
@@ -1540,7 +1540,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.17.1
More information about the mesa-dev
mailing list