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

Author: Dave Airlie <[email protected]>
Date:   Mon Aug 23 13:00:56 2021 +1000

vulkan/wsi/sw: wait for image fence before submitting to queue

With hw devices, when you submit a present, implicit sync will
make sure the work submitted to the gpu on the client will end
up happening before the present work submitted on the server.

However with sw paths there is no real GPU, the lavapipe fake
GPU thread is client side only and presenting is done directly
from the pixmap (or later shared pixmap). In order for this to
make sense the wsi common code should wait for the fence on the
image before queueing the submit to the server so that all
client works has been flushed to the pixmap before the copy or
present operation is submitted.

Fixes: 8004fa9c9501 ("vulkan/wsi: add sw support. (v2)")
Acked-By: Mike Blumenkrantz <[email protected]>
Reviewed-by: Roland Scheidegger <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12502>
(cherry picked from commit 0cddfba3287cab2060c28b05247008bdd1c9905c)

---

 .pick_status.json           | 2 +-
 src/vulkan/wsi/wsi_common.c | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/.pick_status.json b/.pick_status.json
index 1856e514c01..85e00f92083 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -463,7 +463,7 @@
         "description": "vulkan/wsi/sw: wait for image fence before submitting 
to queue",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "main_sha": null,
         "because_sha": "8004fa9c9501d91669ac51d32c9a9143286ca7ea"
     },
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index b1360edb911..292bb976da8 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -653,6 +653,10 @@ wsi_common_queue_present(const struct wsi_device *wsi,
       if (result != VK_SUCCESS)
          goto fail_present;
 
+      if (wsi->sw)
+             wsi->WaitForFences(device, 1, &swapchain->fences[image_index],
+                                true, ~0ull);
+
       const VkPresentRegionKHR *region = NULL;
       if (regions && regions->pRegions)
          region = &regions->pRegions[i];

Reply via email to