summaryrefslogtreecommitdiffstats
path: root/src/vulkan
diff options
context:
space:
mode:
Diffstat (limited to 'src/vulkan')
-rw-r--r--src/vulkan/wsi/wsi_common.c38
-rw-r--r--src/vulkan/wsi/wsi_common.h12
2 files changed, 50 insertions, 0 deletions
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index d420e48a007..69cb71dfdbc 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -115,6 +115,9 @@ fail:
void
wsi_swapchain_finish(struct wsi_swapchain *chain)
{
+ for (unsigned i = 0; i < ARRAY_SIZE(chain->fences); i++)
+ chain->wsi->DestroyFence(chain->device, chain->fences[i], &chain->alloc);
+
for (uint32_t i = 0; i < chain->wsi->queue_family_count; i++) {
chain->wsi->DestroyCommandPool(chain->device, chain->cmd_pools[i],
&chain->alloc);
@@ -485,6 +488,41 @@ wsi_destroy_image(const struct wsi_swapchain *chain,
}
VkResult
+wsi_common_create_swapchain(struct wsi_device *wsi,
+ VkDevice device,
+ int fd,
+ const VkSwapchainCreateInfoKHR *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator,
+ VkSwapchainKHR *pSwapchain)
+{
+ ICD_FROM_HANDLE(VkIcdSurfaceBase, surface, pCreateInfo->surface);
+ struct wsi_interface *iface = wsi->wsi[surface->platform];
+ struct wsi_swapchain *swapchain;
+
+ VkResult result = iface->create_swapchain(surface, device, wsi, fd,
+ pCreateInfo, pAllocator,
+ &swapchain);
+ if (result != VK_SUCCESS)
+ return result;
+
+ *pSwapchain = wsi_swapchain_to_handle(swapchain);
+
+ return VK_SUCCESS;
+}
+
+void
+wsi_common_destroy_swapchain(VkDevice device,
+ VkSwapchainKHR _swapchain,
+ const VkAllocationCallbacks *pAllocator)
+{
+ WSI_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
+ if (!swapchain)
+ return;
+
+ swapchain->destroy(swapchain, pAllocator);
+}
+
+VkResult
wsi_common_get_images(VkSwapchainKHR _swapchain,
uint32_t *pSwapchainImageCount,
VkImage *pSwapchainImages)
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 9ff28e76f33..6ed10b85921 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -221,6 +221,18 @@ wsi_common_get_images(VkSwapchainKHR _swapchain,
VkImage *pSwapchainImages);
VkResult
+wsi_common_create_swapchain(struct wsi_device *wsi,
+ VkDevice device,
+ int fd,
+ const VkSwapchainCreateInfoKHR *pCreateInfo,
+ const VkAllocationCallbacks *pAllocator,
+ VkSwapchainKHR *pSwapchain);
+void
+wsi_common_destroy_swapchain(VkDevice device,
+ VkSwapchainKHR swapchain,
+ const VkAllocationCallbacks *pAllocator);
+
+VkResult
wsi_common_queue_present(const struct wsi_device *wsi,
VkDevice device_h,
VkQueue queue_h,