summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-11-16 12:26:26 -0800
committerJason Ekstrand <[email protected]>2017-12-04 10:04:19 -0800
commitc1b1be5196f38776405b58c01a6f138a0f031edb (patch)
tree87fea676eab0b3371e8c540ea66dc51baccfb3ad /src/vulkan
parent82931dc007bf6e485a4add7a875133b8ed48de55 (diff)
vulkan/wsi: Add wrappers for all of the surface queries
This lets us move wsi_interface to wsi_common_private.h Reviewed-by: Dave Airlie <[email protected]> Reviewed-by: Chad Versace <[email protected]>
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/wsi/wsi_common.c77
-rw-r--r--src/vulkan/wsi/wsi_common.h72
-rw-r--r--src/vulkan/wsi/wsi_common_private.h34
3 files changed, 148 insertions, 35 deletions
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 50680a6fd75..a303aabf2c4 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -488,6 +488,83 @@ wsi_destroy_image(const struct wsi_swapchain *chain,
}
VkResult
+wsi_common_get_surface_support(struct wsi_device *wsi_device,
+ int local_fd,
+ uint32_t queueFamilyIndex,
+ VkSurfaceKHR _surface,
+ const VkAllocationCallbacks *alloc,
+ VkBool32* pSupported)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
+ struct wsi_interface *iface = wsi_device->wsi[surface->platform];
+
+ return iface->get_support(surface, wsi_device, alloc,
+ queueFamilyIndex, local_fd, pSupported);
+}
+
+VkResult
+wsi_common_get_surface_capabilities(struct wsi_device *wsi_device,
+ VkSurfaceKHR _surface,
+ VkSurfaceCapabilitiesKHR *pSurfaceCapabilities)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
+ struct wsi_interface *iface = wsi_device->wsi[surface->platform];
+
+ return iface->get_capabilities(surface, pSurfaceCapabilities);
+}
+
+VkResult
+wsi_common_get_surface_capabilities2(struct wsi_device *wsi_device,
+ const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
+ VkSurfaceCapabilities2KHR *pSurfaceCapabilities)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, pSurfaceInfo->surface);
+ struct wsi_interface *iface = wsi_device->wsi[surface->platform];
+
+ return iface->get_capabilities2(surface, pSurfaceInfo->pNext,
+ pSurfaceCapabilities);
+}
+
+VkResult
+wsi_common_get_surface_formats(struct wsi_device *wsi_device,
+ VkSurfaceKHR _surface,
+ uint32_t *pSurfaceFormatCount,
+ VkSurfaceFormatKHR *pSurfaceFormats)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
+ struct wsi_interface *iface = wsi_device->wsi[surface->platform];
+
+ return iface->get_formats(surface, wsi_device,
+ pSurfaceFormatCount, pSurfaceFormats);
+}
+
+VkResult
+wsi_common_get_surface_formats2(struct wsi_device *wsi_device,
+ const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
+ uint32_t *pSurfaceFormatCount,
+ VkSurfaceFormat2KHR *pSurfaceFormats)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, pSurfaceInfo->surface);
+ struct wsi_interface *iface = wsi_device->wsi[surface->platform];
+
+ return iface->get_formats2(surface, wsi_device, pSurfaceInfo->pNext,
+ pSurfaceFormatCount, pSurfaceFormats);
+}
+
+VkResult
+wsi_common_get_surface_present_modes(struct wsi_device *wsi_device,
+ VkSurfaceKHR _surface,
+ uint32_t *pPresentModeCount,
+ VkPresentModeKHR *pPresentModes)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, _surface);
+ struct wsi_interface *iface = wsi_device->wsi[surface->platform];
+
+ return iface->get_present_modes(surface, pPresentModeCount,
+ pPresentModes);
+}
+
+VkResult
wsi_common_create_swapchain(struct wsi_device *wsi,
VkDevice device,
int fd,
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 32a7e731321..5e705755019 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -48,41 +48,7 @@ struct wsi_memory_allocate_info {
bool implicit_sync;
};
-struct wsi_device;
-struct wsi_swapchain;
-
-struct wsi_interface {
- VkResult (*get_support)(VkIcdSurfaceBase *surface,
- struct wsi_device *wsi_device,
- const VkAllocationCallbacks *alloc,
- 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);
- VkResult (*get_formats)(VkIcdSurfaceBase *surface,
- struct wsi_device *wsi_device,
- uint32_t* pSurfaceFormatCount,
- VkSurfaceFormatKHR* pSurfaceFormats);
- VkResult (*get_formats2)(VkIcdSurfaceBase *surface,
- struct wsi_device *wsi_device,
- const void *info_next,
- uint32_t* pSurfaceFormatCount,
- VkSurfaceFormat2KHR* pSurfaceFormats);
- VkResult (*get_present_modes)(VkIcdSurfaceBase *surface,
- uint32_t* pPresentModeCount,
- VkPresentModeKHR* pPresentModes);
- 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);
-};
+struct wsi_interface;
#define VK_ICD_WSI_PLATFORM_MAX 5
@@ -171,6 +137,42 @@ 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,
+ uint32_t queueFamilyIndex,
+ VkSurfaceKHR surface,
+ const VkAllocationCallbacks *alloc,
+ VkBool32* pSupported);
+
+VkResult
+wsi_common_get_surface_capabilities(struct wsi_device *wsi_device,
+ VkSurfaceKHR surface,
+ VkSurfaceCapabilitiesKHR *pSurfaceCapabilities);
+
+VkResult
+wsi_common_get_surface_capabilities2(struct wsi_device *wsi_device,
+ const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
+ VkSurfaceCapabilities2KHR *pSurfaceCapabilities);
+
+VkResult
+wsi_common_get_surface_formats(struct wsi_device *wsi_device,
+ VkSurfaceKHR surface,
+ uint32_t *pSurfaceFormatCount,
+ VkSurfaceFormatKHR *pSurfaceFormats);
+
+VkResult
+wsi_common_get_surface_formats2(struct wsi_device *wsi_device,
+ const VkPhysicalDeviceSurfaceInfo2KHR *pSurfaceInfo,
+ uint32_t *pSurfaceFormatCount,
+ VkSurfaceFormat2KHR *pSurfaceFormats);
+
+VkResult
+wsi_common_get_surface_present_modes(struct wsi_device *wsi_device,
+ VkSurfaceKHR surface,
+ uint32_t *pPresentModeCount,
+ VkPresentModeKHR *pPresentModes);
+
+VkResult
wsi_common_get_images(VkSwapchainKHR _swapchain,
uint32_t *pSwapchainImageCount,
VkImage *pSwapchainImages);
diff --git a/src/vulkan/wsi/wsi_common_private.h b/src/vulkan/wsi/wsi_common_private.h
index 3fa68f03249..e29a239bd78 100644
--- a/src/vulkan/wsi/wsi_common_private.h
+++ b/src/vulkan/wsi/wsi_common_private.h
@@ -91,6 +91,40 @@ wsi_destroy_image(const struct wsi_swapchain *chain,
struct wsi_image *image);
+struct wsi_interface {
+ VkResult (*get_support)(VkIcdSurfaceBase *surface,
+ struct wsi_device *wsi_device,
+ const VkAllocationCallbacks *alloc,
+ 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);
+ VkResult (*get_formats)(VkIcdSurfaceBase *surface,
+ struct wsi_device *wsi_device,
+ uint32_t* pSurfaceFormatCount,
+ VkSurfaceFormatKHR* pSurfaceFormats);
+ VkResult (*get_formats2)(VkIcdSurfaceBase *surface,
+ struct wsi_device *wsi_device,
+ const void *info_next,
+ uint32_t* pSurfaceFormatCount,
+ VkSurfaceFormat2KHR* pSurfaceFormats);
+ VkResult (*get_present_modes)(VkIcdSurfaceBase *surface,
+ uint32_t* pPresentModeCount,
+ VkPresentModeKHR* pPresentModes);
+ 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);
+};
+
+
#define WSI_DEFINE_NONDISP_HANDLE_CASTS(__wsi_type, __VkType) \
\
static inline struct __wsi_type * \