From cc3e149f80b8ea044fff390425f65999983a17b5 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 23 Aug 2021 13:00:56 +1000 Subject: [PATCH] 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 Reviewed-by: Roland Scheidegger Part-of: (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 = ®ions->pRegions[i];