[Mesa-dev] [PATCH 2/4] radv: handle signal semaphore on image acquire properly

Dave Airlie airlied at gmail.com
Thu Jul 20 03:38:12 UTC 2017


From: Dave Airlie <airlied at redhat.com>

We haven't done anything with this before, and this seems to
lead to a slow down in deferred of about 40-50 fps, but we do
need to start signalling semaphores properly with syncobjs.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/amd/vulkan/radv_wsi.c | 20 +++++++++++++++++---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_wsi.c b/src/amd/vulkan/radv_wsi.c
index ab3dcd6..38338d2 100644
--- a/src/amd/vulkan/radv_wsi.c
+++ b/src/amd/vulkan/radv_wsi.c
@@ -425,17 +425,19 @@ VkResult radv_GetSwapchainImagesKHR(
 }
 
 VkResult radv_AcquireNextImageKHR(
-	VkDevice                                     device,
+	VkDevice                                     _device,
 	VkSwapchainKHR                               _swapchain,
 	uint64_t                                     timeout,
-	VkSemaphore                                  semaphore,
+	VkSemaphore                                  _semaphore,
 	VkFence                                      _fence,
 	uint32_t*                                    pImageIndex)
 {
 	RADV_FROM_HANDLE(wsi_swapchain, swapchain, _swapchain);
 	RADV_FROM_HANDLE(radv_fence, fence, _fence);
+	RADV_FROM_HANDLE(radv_device, device, _device);
+	RADV_FROM_HANDLE(radeon_winsys_sem, semaphore, _semaphore);
 
-	VkResult result = swapchain->acquire_next_image(swapchain, timeout, semaphore,
+	VkResult result = swapchain->acquire_next_image(swapchain, timeout, _semaphore,
 	                                                pImageIndex);
 
 	if (fence && (result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR)) {
@@ -443,6 +445,18 @@ VkResult radv_AcquireNextImageKHR(
 		fence->signalled = true;
 	}
 
+	if (semaphore && (result == VK_SUCCESS || result == VK_SUBOPTIMAL_KHR)) {
+		struct radv_queue *queue = device->queues[RADV_QUEUE_GENERAL];
+		struct radeon_winsys_cs *cs = queue->device->empty_cs[queue->queue_family_index];
+		struct radeon_winsys_ctx *ctx = queue->hw_ctx;
+
+		queue->device->ws->cs_submit(ctx, queue->queue_idx,
+					     &cs,
+					     1, NULL, NULL,
+					     NULL, 0,
+					     &semaphore, 1, false, NULL);
+	}
+
 	return result;
 }
 
-- 
2.9.4



More information about the mesa-dev mailing list