Mesa (main): vulkan/wsi/sw: wait for image fence before submitting to queue

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Aug 23 17:52:43 UTC 2021


Module: Mesa
Branch: main
Commit: 0cddfba3287cab2060c28b05247008bdd1c9905c
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0cddfba3287cab2060c28b05247008bdd1c9905c

Author: Dave Airlie <airlied at redhat.com>
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 <michael.blumenkrantz at gmail.com>
Reviewed-by: Roland Scheidegger <sroland at vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12502>

---

 src/vulkan/wsi/wsi_common.c | 4 ++++
 1 file changed, 4 insertions(+)

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];



More information about the mesa-commit mailing list