Mesa (staging/19.2): anv/wsi: signal the semaphore in the acquireNextImage

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Nov 20 00:56:27 UTC 2019


Module: Mesa
Branch: staging/19.2
Commit: a390cf739fec05ffd00dbe382c1fad33422d23d1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a390cf739fec05ffd00dbe382c1fad33422d23d1

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Thu Jul 11 15:21:04 2019 +0300

anv/wsi: signal the semaphore in the acquireNextImage

We seem to have forgotten about the semaphore in the
acquireNextImageInfo.

v2: Signal semaphore/fence regardless of presentation status (Jason)

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: <mesa-stable at lists.freedesktop.org>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
(cherry picked from commit edc6606d4e515707b22674a0b3357c02de52378e)

---

 src/intel/vulkan/anv_wsi.c | 24 ++++++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/anv_wsi.c b/src/intel/vulkan/anv_wsi.c
index 9edadb13d2d..0ba25b1f847 100644
--- a/src/intel/vulkan/anv_wsi.c
+++ b/src/intel/vulkan/anv_wsi.c
@@ -247,12 +247,28 @@ VkResult anv_AcquireNextImage2KHR(
                                                     pAcquireInfo,
                                                     pImageIndex);
 
-   /* Thanks to implicit sync, the image is ready immediately.  However, we
-    * should wait for the current GPU state to finish.
+   /* Thanks to implicit sync, the image is ready immediately. However, we
+    * should wait for the current GPU state to finish. Regardless of the
+    * result of the presentation, we need to signal the semaphore & fence.
     */
+
+   if (pAcquireInfo->semaphore != VK_NULL_HANDLE) {
+      /* Put a dummy semaphore in temporary, this is the fastest way to avoid
+       * any kind of work yet still provide some kind of synchronization. This
+       * only works because the Mesa WSI code always returns an image
+       * immediately if available.
+       */
+      ANV_FROM_HANDLE(anv_semaphore, semaphore, pAcquireInfo->semaphore);
+      anv_semaphore_reset_temporary(device, semaphore);
+
+      struct anv_semaphore_impl *impl = &semaphore->temporary;
+
+      impl->type = ANV_SEMAPHORE_TYPE_DUMMY;
+   }
+
    if (pAcquireInfo->fence != VK_NULL_HANDLE) {
-      anv_QueueSubmit(anv_queue_to_handle(&device->queue), 0, NULL,
-                      pAcquireInfo->fence);
+      result = anv_QueueSubmit(anv_queue_to_handle(&device->queue),
+                               0, NULL, pAcquireInfo->fence);
    }
 
    return result;




More information about the mesa-commit mailing list