[Mesa-dev] [PATCH 24/28] vulkan/wsi: Move wsi_swapchain to wsi_common_private.h

Jason Ekstrand jason at jlekstrand.net
Thu Nov 16 21:29:12 UTC 2017


The drivers no longer poke at this directly.
---
 src/vulkan/wsi/wsi_common.h         | 46 +------------------------------------
 src/vulkan/wsi/wsi_common_private.h | 46 +++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+), 45 deletions(-)

diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 10b4607..6755b7a 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -41,32 +41,7 @@ struct wsi_image_create_info {
 };
 
 struct wsi_device;
-
-struct wsi_swapchain {
-   const struct wsi_device *wsi;
-
-   VkDevice device;
-   VkAllocationCallbacks alloc;
-   VkFence fences[3];
-   VkPresentModeKHR present_mode;
-   uint32_t image_count;
-
-   bool use_prime_blit;
-
-   /* Command pools, one per queue family */
-   VkCommandPool *cmd_pools;
-
-   VkResult (*destroy)(struct wsi_swapchain *swapchain,
-                       const VkAllocationCallbacks *pAllocator);
-   struct wsi_image *(*get_wsi_image)(struct wsi_swapchain *swapchain,
-                                      uint32_t image_index);
-   VkResult (*acquire_next_image)(struct wsi_swapchain *swap_chain,
-                                  uint64_t timeout, VkSemaphore semaphore,
-                                  uint32_t *image_index);
-   VkResult (*queue_present)(struct wsi_swapchain *swap_chain,
-                             uint32_t image_index,
-                             const VkPresentRegionKHR *damage);
-};
+struct wsi_swapchain;
 
 struct wsi_interface {
    VkResult (*get_support)(VkIcdSurfaceBase *surface,
@@ -158,25 +133,6 @@ struct wsi_callbacks {
 };
 #undef WSI_CB
 
-#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)
-
 #define ICD_DEFINE_NONDISP_HANDLE_CASTS(__VkIcdType, __VkType)             \
                                                                            \
    static inline __VkIcdType *                                             \
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 28abf6c..3fa68f0 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -41,6 +41,32 @@ struct wsi_image {
    int fd;
 };
 
+struct wsi_swapchain {
+   const struct wsi_device *wsi;
+
+   VkDevice device;
+   VkAllocationCallbacks alloc;
+   VkFence fences[3];
+   VkPresentModeKHR present_mode;
+   uint32_t image_count;
+
+   bool use_prime_blit;
+
+   /* Command pools, one per queue family */
+   VkCommandPool *cmd_pools;
+
+   VkResult (*destroy)(struct wsi_swapchain *swapchain,
+                       const VkAllocationCallbacks *pAllocator);
+   struct wsi_image *(*get_wsi_image)(struct wsi_swapchain *swapchain,
+                                      uint32_t image_index);
+   VkResult (*acquire_next_image)(struct wsi_swapchain *swap_chain,
+                                  uint64_t timeout, VkSemaphore semaphore,
+                                  uint32_t *image_index);
+   VkResult (*queue_present)(struct wsi_swapchain *swap_chain,
+                             uint32_t image_index,
+                             const VkPresentRegionKHR *damage);
+};
+
 VkResult
 wsi_swapchain_init(const struct wsi_device *wsi,
                    struct wsi_swapchain *chain,
@@ -64,4 +90,24 @@ void
 wsi_destroy_image(const struct wsi_swapchain *chain,
                   struct wsi_image *image);
 
+
+#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)
+
 #endif /* WSI_COMMON_PRIVATE_H */
-- 
2.5.0.400.gff86faf



More information about the mesa-dev mailing list