anv/wsi: Use QueueSubmit to trigger the fence in AcquireNextImage
authorJason Ekstrand <jason.ekstrand@intel.com>
Thu, 3 Aug 2017 21:18:19 +0000 (14:18 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Tue, 29 Aug 2017 01:35:25 +0000 (18:35 -0700)
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
src/intel/vulkan/anv_wsi.c

index 9369f26a8fa0f5c3955150caf5e92cbd4d1595fd..00edb220b2bf5e316d4d223b857b1ef7ca76f1d6 100644 (file)
@@ -364,22 +364,25 @@ VkResult anv_GetSwapchainImagesKHR(
 }
 
 VkResult anv_AcquireNextImageKHR(
-    VkDevice                                     device,
+    VkDevice                                     _device,
     VkSwapchainKHR                               _swapchain,
     uint64_t                                     timeout,
     VkSemaphore                                  semaphore,
     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);
 
    VkResult result = swapchain->acquire_next_image(swapchain, timeout,
                                                    semaphore, pImageIndex);
 
-   /* Thanks to implicit sync, the image is ready immediately. */
+   /* Thanks to implicit sync, the image is ready immediately.  However, we
+    * should wait for the current GPU state to finish.
+    */
    if (fence)
-      fence->state = ANV_FENCE_STATE_SIGNALED;
+      anv_QueueSubmit(anv_queue_to_handle(&device->queue), 0, NULL, _fence);
 
    return result;
 }