vulkan/wsi/x11: Consistently update and return swapchain status
[mesa.git] / src / vulkan / wsi / wsi_common.h
index 65814435ce496d2d0e5b234896e0225a6e8c141b..6cf729ba025f4072b3584b44ea50e390291aaaf8 100644 (file)
  */
 #define VK_STRUCTURE_TYPE_WSI_IMAGE_CREATE_INFO_MESA (VkStructureType)1000001002
 #define VK_STRUCTURE_TYPE_WSI_MEMORY_ALLOCATE_INFO_MESA (VkStructureType)1000001003
+#define VK_STRUCTURE_TYPE_WSI_FORMAT_MODIFIER_PROPERTIES_LIST_MESA (VkStructureType)1000001004
 
 struct wsi_image_create_info {
     VkStructureType sType;
     const void *pNext;
     bool scanout;
+
+    uint32_t modifier_count;
+    const uint64_t *modifiers;
 };
 
 struct wsi_memory_allocate_info {
@@ -48,14 +52,32 @@ struct wsi_memory_allocate_info {
     bool implicit_sync;
 };
 
+struct wsi_format_modifier_properties {
+   uint64_t modifier;
+   uint32_t modifier_plane_count;
+};
+
+/* Chain in for vkGetPhysicalDeviceFormatProperties2KHR */
+struct wsi_format_modifier_properties_list {
+   VkStructureType sType;
+   const void *pNext;
+
+   uint32_t modifier_count;
+   struct wsi_format_modifier_properties *modifier_properties;
+};
+
 struct wsi_interface;
 
 #define VK_ICD_WSI_PLATFORM_MAX 5
 
 struct wsi_device {
+   VkPhysicalDevice pdevice;
    VkPhysicalDeviceMemoryProperties memory_props;
    uint32_t queue_family_count;
 
+   bool supports_modifiers;
+   uint64_t (*image_get_modifier)(VkImage image);
+
 #define WSI_CB(cb) PFN_vk##cb cb
    WSI_CB(AllocateMemory);
    WSI_CB(AllocateCommandBuffers);
@@ -79,6 +101,7 @@ struct wsi_device {
    WSI_CB(GetImageSubresourceLayout);
    WSI_CB(GetMemoryFdKHR);
    WSI_CB(GetPhysicalDeviceFormatProperties);
+   WSI_CB(GetPhysicalDeviceFormatProperties2KHR);
    WSI_CB(ResetFences);
    WSI_CB(QueueSubmit);
    WSI_CB(WaitForFences);
@@ -89,10 +112,15 @@ struct wsi_device {
 
 typedef PFN_vkVoidFunction (VKAPI_PTR *WSI_FN_GetPhysicalDeviceProcAddr)(VkPhysicalDevice physicalDevice, const char* pName);
 
-void
+VkResult
 wsi_device_init(struct wsi_device *wsi,
                 VkPhysicalDevice pdevice,
-                WSI_FN_GetPhysicalDeviceProcAddr proc_addr);
+                WSI_FN_GetPhysicalDeviceProcAddr proc_addr,
+                const VkAllocationCallbacks *alloc);
+
+void
+wsi_device_finish(struct wsi_device *wsi,
+                  const VkAllocationCallbacks *alloc);
 
 #define ICD_DEFINE_NONDISP_HANDLE_CASTS(__VkIcdType, __VkType)             \
                                                                            \
@@ -113,16 +141,6 @@ wsi_device_init(struct wsi_device *wsi,
 
 ICD_DEFINE_NONDISP_HANDLE_CASTS(VkIcdSurfaceBase, VkSurfaceKHR)
 
-VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
-                          const VkAllocationCallbacks *alloc);
-void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
-                        const VkAllocationCallbacks *alloc);
-VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
-                         const VkAllocationCallbacks *alloc,
-                         VkPhysicalDevice physical_device);
-void wsi_wl_finish_wsi(struct wsi_device *wsi_device,
-                       const VkAllocationCallbacks *alloc);
-
 VkResult
 wsi_common_get_surface_support(struct wsi_device *wsi_device,
                                int local_fd,