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

Author: Mike Blumenkrantz <[email protected]>
Date:   Sun Jul 17 21:45:32 2022 -0400

vulkan/wsi: fix multiple acquires for sw without mit-shm

in this case, lying about having multiple images and then returning the
same image every time doesn't work, so use the busy flag
and return an available image when possible

Reviewed-by: Dave Airlie <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17590>

---

 src/gallium/drivers/zink/ci/zink-lvp-fails.txt | 10 ++++------
 src/vulkan/wsi/wsi_common_x11.c                | 12 +++++++++---
 2 files changed, 13 insertions(+), 9 deletions(-)

diff --git a/src/gallium/drivers/zink/ci/zink-lvp-fails.txt 
b/src/gallium/drivers/zink/ci/zink-lvp-fails.txt
index c4d6172eaaa..d78ecdd158c 100644
--- a/src/gallium/drivers/zink/ci/zink-lvp-fails.txt
+++ b/src/gallium/drivers/zink/ci/zink-lvp-fails.txt
@@ -110,16 +110,15 @@ spec@arb_framebuffer_object@fbo-blit-scaled-linear,Fail
 # #6270
 spec@arb_shader_texture_lod@execution@arb_shader_texture_lod-texgradcube,Fail
 
+# #6905
+glx@glx-swap-copy,Fail
+
 #kopper regressions/changes
-fast_color_clear@fcc-front-buffer-distraction,Fail
 glx@extension string sanity,Fail
-spec@!opengl [email protected],Fail
-spec@!opengl [email protected],Fail
 spec@egl_chromium_sync_control@conformance,Fail
 
spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_msc_and_sbc_test,Fail
 
spec@egl_chromium_sync_control@conformance@eglGetSyncValuesCHROMIUM_ust_test,Fail
-spec@ext_framebuffer_blit@fbo-sys-blit,Fail
-spec@ext_framebuffer_blit@fbo-sys-sub-blit,Fail
+
 
 dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_center,Fail
 dEQP-GLES3.functional.clipping.line.wide_line_clip_viewport_corner,Fail
@@ -171,7 +170,6 @@ shaders@point-vertex-id gl_vertexid gl_instanceid 
divisor,Fail
 spec@!opengl [email protected],Fail
 spec@!opengl [email protected],Fail
 spec@!opengl [email protected],Fail
-spec@!opengl [email protected],Fail
 spec@!opengl 1.1@linestipple,Fail
 spec@!opengl 1.1@linestipple@Factor 2x,Fail
 spec@!opengl 1.1@linestipple@Factor 3x,Fail
diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c
index d3add512fab..4554dac9808 100644
--- a/src/vulkan/wsi/wsi_common_x11.c
+++ b/src/vulkan/wsi/wsi_common_x11.c
@@ -1298,6 +1298,7 @@ x11_present_to_x11_sw(struct x11_swapchain *chain, 
uint32_t image_index,
    int stride_b = image->base.row_pitches[0];
    size_t size = (hdr_len + stride_b * chain->extent.height) >> 2;
    uint64_t max_req_len = xcb_get_maximum_request_length(chain->conn);
+   chain->images[image_index].busy = false;
 
    if (size < max_req_len) {
       cookie = xcb_put_image(chain->conn, XCB_IMAGE_FORMAT_Z_PIXMAP,
@@ -1363,10 +1364,15 @@ x11_acquire_next_image(struct wsi_swapchain *anv_chain,
    if (chain->status < 0)
       return chain->status;
 
-   /* For software drivers and without shared memory we only render to a 
single image. */
    if (chain->base.wsi->sw && !chain->has_mit_shm) {
-      *image_index = 0;
-      return VK_SUCCESS;
+      for (unsigned i = 0; i < chain->base.image_count; i++) {
+         if (!chain->images[i].busy) {
+            *image_index = i;
+            chain->images[i].busy = true;
+            return VK_SUCCESS;
+         }
+      }
+      return VK_NOT_READY;
    }
 
    if (chain->has_acquire_queue) {

Reply via email to