Mesa (master): vulkan/wsi/wayland: Add support for VK_KHR_get_surface_capabilities2

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue May 16 16:51:49 UTC 2017


Module: Mesa
Branch: master
Commit: 59f75dc2a4c4e5d46f43fa1b1104466d4574aa02
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=59f75dc2a4c4e5d46f43fa1b1104466d4574aa02

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Fri Mar 17 14:08:04 2017 -0700

vulkan/wsi/wayland: Add support for VK_KHR_get_surface_capabilities2

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

---

 src/vulkan/wsi/wsi_common_wayland.c | 38 +++++++++++++++++++++++++++++++++++++
 1 file changed, 38 insertions(+)

diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c
index 5c72c8aa23..cb6dd7968f 100644
--- a/src/vulkan/wsi/wsi_common_wayland.c
+++ b/src/vulkan/wsi/wsi_common_wayland.c
@@ -402,6 +402,16 @@ wsi_wl_surface_get_capabilities(VkIcdSurfaceBase *surface,
 }
 
 static VkResult
+wsi_wl_surface_get_capabilities2(VkIcdSurfaceBase *surface,
+                                 const void *info_next,
+                                 VkSurfaceCapabilities2KHR* caps)
+{
+   assert(caps->sType == VK_STRUCTURE_TYPE_SURFACE_CAPABILITIES_2_KHR);
+
+   return wsi_wl_surface_get_capabilities(surface, &caps->surfaceCapabilities);
+}
+
+static VkResult
 wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface,
 			   struct wsi_device *wsi_device,
                            uint32_t* pSurfaceFormatCount,
@@ -427,6 +437,32 @@ wsi_wl_surface_get_formats(VkIcdSurfaceBase *icd_surface,
 }
 
 static VkResult
+wsi_wl_surface_get_formats2(VkIcdSurfaceBase *icd_surface,
+			    struct wsi_device *wsi_device,
+                            const void *info_next,
+                            uint32_t* pSurfaceFormatCount,
+                            VkSurfaceFormat2KHR* pSurfaceFormats)
+{
+   VkIcdSurfaceWayland *surface = (VkIcdSurfaceWayland *)icd_surface;
+   struct wsi_wl_display *display =
+      wsi_wl_get_display(wsi_device, surface->display);
+   if (!display)
+      return VK_ERROR_OUT_OF_HOST_MEMORY;
+
+   VK_OUTARRAY_MAKE(out, pSurfaceFormats, pSurfaceFormatCount);
+
+   VkFormat *disp_fmt;
+   u_vector_foreach(disp_fmt, &display->formats) {
+      vk_outarray_append(&out, out_fmt) {
+         out_fmt->surfaceFormat.format = *disp_fmt;
+         out_fmt->surfaceFormat.colorSpace = VK_COLORSPACE_SRGB_NONLINEAR_KHR;
+      }
+   }
+
+   return vk_outarray_status(&out);
+}
+
+static VkResult
 wsi_wl_surface_get_present_modes(VkIcdSurfaceBase *surface,
                                  uint32_t* pPresentModeCount,
                                  VkPresentModeKHR* pPresentModes)
@@ -819,7 +855,9 @@ wsi_wl_init_wsi(struct wsi_device *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;
    wsi->base.get_present_modes = wsi_wl_surface_get_present_modes;
    wsi->base.create_swapchain = wsi_wl_surface_create_swapchain;
 




More information about the mesa-commit mailing list