summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/amd/vulkan/radv_wsi.c15
-rw-r--r--src/intel/vulkan/anv_wsi.c19
-rw-r--r--src/vulkan/wsi/wsi_common.c14
-rw-r--r--src/vulkan/wsi/wsi_common.h8
4 files changed, 43 insertions, 13 deletions
diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index d00e0281689..d864a9f613f 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -206,18 +206,23 @@ VkResult radv_GetSwapchainImagesKHR(
}
VkResult radv_AcquireNextImageKHR(
- VkDevice device,
- VkSwapchainKHR _swapchain,
+ VkDevice _device,
+ VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
VkFence _fence,
uint32_t* pImageIndex)
{
- RADV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
+ RADV_FROM_HANDLE(radv_device, device, _device);
+ struct radv_physical_device *pdevice = device->physical_device;
RADV_FROM_HANDLE(radv_fence, fence, _fence);
- VkResult result = swapchain->acquire_next_image(swapchain, timeout, semaphore,
- pImageIndex);
+ VkResult result = wsi_common_acquire_next_image(&pdevice->wsi_device,
+ _device,
+ swapchain,
+ timeout,
+ semaphore,
+ pImageIndex);
if (fence && (result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR)) {
fence->submitted = true;
diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 62368a10a06..6f5aaf6b704 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -234,24 +234,27 @@ VkResult anv_GetSwapchainImagesKHR(
VkResult anv_AcquireNextImageKHR(
VkDevice _device,
- VkSwapchainKHR _swapchain,
+ VkSwapchainKHR swapchain,
uint64_t timeout,
VkSemaphore semaphore,
- VkFence _fence,
+ VkFence fence,
uint32_t* pImageIndex)
{
ANV_FROM_HANDLE(anv_device, device, _device);
- ANV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
- ANV_FROM_HANDLE(anv_fence, fence, _fence);
+ struct anv_physical_device *pdevice = &device->instance->physicalDevice;
- VkResult result = swapchain->acquire_next_image(swapchain, timeout,
- semaphore, pImageIndex);
+ VkResult result = wsi_common_acquire_next_image(&pdevice->wsi_device,
+ _device,
+ swapchain,
+ timeout,
+ semaphore,
+ pImageIndex);
/* Thanks to implicit sync, the image is ready immediately. However, we
* should wait for the current GPU state to finish.
*/
- if (fence)
- anv_QueueSubmit(anv_queue_to_handle(&device->queue), 0, NULL, _fence);
+ if (fence != VK_NULL_HANDLE)
+ anv_QueueSubmit(anv_queue_to_handle(&device->queue), 0, NULL, fence);
return result;
}
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 69cb71dfdbc..50680a6fd75 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -540,6 +540,20 @@ wsi_common_get_images(VkSwapchainKHR _swapchain,
}
VkResult
+wsi_common_acquire_next_image(const struct wsi_device *wsi,
+ VkDevice device,
+ VkSwapchainKHR _swapchain,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ uint32_t *pImageIndex)
+{
+ WSI_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
+
+ return swapchain->acquire_next_image(swapchain, timeout,
+ semaphore, pImageIndex);
+}
+
+VkResult
wsi_common_queue_present(const struct wsi_device *wsi,
VkDevice device,
VkQueue queue,
diff --git a/src/vulkan/wsi/wsi_common.h b/src/vulkan/wsi/wsi_common.h
index 6ed10b85921..aab6ca1c271 100644
--- a/src/vulkan/wsi/wsi_common.h
+++ b/src/vulkan/wsi/wsi_common.h
@@ -221,6 +221,14 @@ wsi_common_get_images(VkSwapchainKHR _swapchain,
VkImage *pSwapchainImages);
VkResult
+wsi_common_acquire_next_image(const struct wsi_device *wsi,
+ VkDevice device,
+ VkSwapchainKHR swapchain,
+ uint64_t timeout,
+ VkSemaphore semaphore,
+ uint32_t *pImageIndex);
+
+VkResult
wsi_common_create_swapchain(struct wsi_device *wsi,
VkDevice device,
int fd,