Mesa (staging/20.1): vulkan/wsi: Don't consider VK_SUBOPTIMAL_KHR to be an error condition

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jul 6 20:42:14 UTC 2020


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

Author: Jason Ekstrand <jason at jlekstrand.net>
Date:   Sat Jun 27 08:50:47 2020 -0500

vulkan/wsi: Don't consider VK_SUBOPTIMAL_KHR to be an error condition

This was causing vkAcquireNextImageKHR to not signal the fences and
semaphores.  In the case where the semaphore was brand new, this could
cause an unsignalled syncobj to be passed into execbuffer2 which it will
reject with -EINVAL leading to VK_ERROR_DEVICE_LOST.  Thanks to Henrik
Rydgård who works on the PPSSPP project for helping me figure this out.

Fixes: ca3cfbf6f1e00 "vk: Add an initial implementation of the actual..."
Fixes: 778b51f491cfe "vulkan/wsi: Add a hooks for signaling semaphores..."
Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5672>
(cherry picked from commit b0bbb62325b829427d87acb25b00b3e0eb0343cb)

---

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

diff --git a/.pick_status.json b/.pick_status.json
index 9337f4a631b..e13e2681338 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -103,7 +103,7 @@
         "description": "vulkan/wsi: Don't consider VK_SUBOPTIMAL_KHR to be an error condition",
         "nominated": true,
         "nomination_type": 1,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": "ca3cfbf6f1e009c0208ffaa483c8a7e80394639d"
     },
diff --git a/src/vulkan/wsi/wsi_common.c b/src/vulkan/wsi/wsi_common.c
index 44454190840..5d9d86cefd8 100644
--- a/src/vulkan/wsi/wsi_common.c
+++ b/src/vulkan/wsi/wsi_common.c
@@ -1095,7 +1095,7 @@ wsi_common_acquire_next_image2(const struct wsi_device *wsi,
 
    VkResult result = swapchain->acquire_next_image(swapchain, pAcquireInfo,
                                                    pImageIndex);
-   if (result != VK_SUCCESS)
+   if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR)
       return result;
 
    if (wsi->set_memory_ownership) {
@@ -1119,7 +1119,7 @@ wsi_common_acquire_next_image2(const struct wsi_device *wsi,
                                    image->memory);
    }
 
-   return VK_SUCCESS;
+   return result;
 }
 
 VkResult
@@ -1221,7 +1221,7 @@ wsi_common_queue_present(const struct wsi_device *wsi,
          region = &regions->pRegions[i];
 
       result = swapchain->queue_present(swapchain, image_index, region);
-      if (result != VK_SUCCESS)
+      if (result != VK_SUCCESS && result != VK_SUBOPTIMAL_KHR)
          goto fail_present;
 
       if (wsi->set_memory_ownership) {



More information about the mesa-commit mailing list