meson: Add mising git_sha1.h dependency.
[mesa.git] / src / vulkan / wsi / wsi_common_private.h
index d8290b69331bf4d24731b56dddb56e89d290d7ac..4b569d54704805699c7f491fa83bc4d8dd56cca2 100644 (file)
@@ -24,6 +24,7 @@
 #define WSI_COMMON_PRIVATE_H
 
 #include "wsi_common.h"
+#include "vulkan/util/vk_object.h"
 
 struct wsi_image {
    VkImage image;
@@ -44,11 +45,13 @@ struct wsi_image {
 };
 
 struct wsi_swapchain {
+   struct vk_object_base base;
+
    const struct wsi_device *wsi;
 
    VkDevice device;
    VkAllocationCallbacks alloc;
-   VkFence fences[3];
+   VkFence* fences;
    VkPresentModeKHR present_mode;
    uint32_t image_count;
 
@@ -69,6 +72,9 @@ struct wsi_swapchain {
                              const VkPresentRegionKHR *damage);
 };
 
+bool
+wsi_device_matches_drm_fd(const struct wsi_device *wsi, int drm_fd);
+
 VkResult
 wsi_swapchain_init(const struct wsi_device *wsi,
                    struct wsi_swapchain *chain,
@@ -76,6 +82,10 @@ wsi_swapchain_init(const struct wsi_device *wsi,
                    const VkSwapchainCreateInfoKHR *pCreateInfo,
                    const VkAllocationCallbacks *pAllocator);
 
+enum VkPresentModeKHR
+wsi_swapchain_get_present_mode(struct wsi_device *wsi,
+                               const VkSwapchainCreateInfoKHR *pCreateInfo);
+
 void wsi_swapchain_finish(struct wsi_swapchain *chain);
 
 VkResult
@@ -101,9 +111,9 @@ struct wsi_interface {
    VkResult (*get_support)(VkIcdSurfaceBase *surface,
                            struct wsi_device *wsi_device,
                            uint32_t queueFamilyIndex,
-                           int local_fd,
                            VkBool32* pSupported);
    VkResult (*get_capabilities2)(VkIcdSurfaceBase *surface,
+                                 struct wsi_device *wsi_device,
                                  const void *info_next,
                                  VkSurfaceCapabilities2KHR* pSurfaceCapabilities);
    VkResult (*get_formats)(VkIcdSurfaceBase *surface,
@@ -120,20 +130,19 @@ struct wsi_interface {
                                  VkPresentModeKHR* pPresentModes);
    VkResult (*get_present_rectangles)(VkIcdSurfaceBase *surface,
                                       struct wsi_device *wsi_device,
-                                      int local_fd,
                                       uint32_t* pRectCount,
                                       VkRect2D* pRects);
    VkResult (*create_swapchain)(VkIcdSurfaceBase *surface,
                                 VkDevice device,
                                 struct wsi_device *wsi_device,
-                                int local_fd,
                                 const VkSwapchainCreateInfoKHR* pCreateInfo,
                                 const VkAllocationCallbacks* pAllocator,
                                 struct wsi_swapchain **swapchain);
 };
 
 VkResult wsi_x11_init_wsi(struct wsi_device *wsi_device,
-                          const VkAllocationCallbacks *alloc);
+                          const VkAllocationCallbacks *alloc,
+                          const struct driOptionCache *dri_options);
 void wsi_x11_finish_wsi(struct wsi_device *wsi_device,
                         const VkAllocationCallbacks *alloc);
 VkResult wsi_wl_init_wsi(struct wsi_device *wsi_device,
@@ -152,23 +161,7 @@ void
 wsi_display_finish_wsi(struct wsi_device *wsi_device,
                        const VkAllocationCallbacks *alloc);
 
-#define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType)              \
-                                                                           \
-   static inline struct __wsi_type *                                       \
-   __wsi_type ## _from_handle(__VkType _handle)                            \
-   {                                                                       \
-      return (struct __wsi_type *)(uintptr_t) _handle;                     \
-   }                                                                       \
-                                                                           \
-   static inline __VkType                                                  \
-   __wsi_type ## _to_handle(struct __wsi_type *_obj)                       \
-   {                                                                       \
-      return (__VkType)(uintptr_t) _obj;                                   \
-   }
-
-#define WSI_FROM_HANDLE(__wsi_type, __name, __handle) \
-   struct __wsi_type *__name = __wsi_type ## _from_handle(__handle)
-
-WSI_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, VkSwapchainKHR)
+VK_DEFINE_NONDISP_HANDLE_CASTS(wsi_swapchain, base, VkSwapchainKHR,
+                               VK_OBJECT_TYPE_SWAPCHAIN_KHR)
 
 #endif /* WSI_COMMON_PRIVATE_H */