vulkan/wsi: fix multiple acquires for sw without mit-shm
authorMike Blumenkrantz <michael.blumenkrantz@gmail.com>
Mon, 18 Jul 2022 01:45:32 +0000 (21:45 -0400)
committerMarge Bot <emma+marge@anholt.net>
Wed, 20 Jul 2022 15:10:15 +0000 (15:10 +0000)
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 <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17590>

src/gallium/drivers/zink/ci/zink-lvp-fails.txt
src/vulkan/wsi/wsi_common_x11.c

index c4d6172..d78ecdd 100644 (file)
@@ -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 1.0@gl-1.0-drawbuffer-modes,Fail
-spec@!opengl 1.0@gl-1.0-front-invalidate-back,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 1.0@gl-1.0-edgeflag,Fail
 spec@!opengl 1.0@gl-1.0-edgeflag-quads,Fail
 spec@!opengl 1.0@gl-1.0-no-op-paths,Fail
-spec@!opengl 1.0@gl-1.0-swapbuffers-behavior,Fail
 spec@!opengl 1.1@linestipple,Fail
 spec@!opengl 1.1@linestipple@Factor 2x,Fail
 spec@!opengl 1.1@linestipple@Factor 3x,Fail
index d3add51..4554dac 100644 (file)
@@ -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) {