wsi/x11: Synchronously check for error from xcb_present_pixmap

Yes this is a round trip, but X_PresentPixmap is not itself a blocking
operation, it just instructs the server to do the next presentation at
some time. More importantly, if _we_ don't catch the presentation error,
xlib's error queue will, and the calling code is certainly not prepared
to handle errors from Present.

Forcing the round trip here is also a bit more correct semantically.
This is the end of the Vulkan client part of the present queue, and the
X_PresentPixmap request transfers the queue operation to the server, so
we should not return until we are sure the handoff has happened.

Fixes some flakiness with piglit@glx-visuals-* with zink+radv.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17685>
This commit is contained in:
Adam Jackson 2022-07-21 12:32:59 -04:00
parent 747913377f
commit 2b3b7b692b
4 changed files with 21 additions and 22 deletions

View File

@ -42,7 +42,6 @@ glx@glx-copy-sub-buffer samples=2,Fail
glx@glx-copy-sub-buffer samples=4,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Crash
glx@glx-visuals-stencil,Crash
glx@glx_arb_create_context_es2_profile@invalid opengl es version,Fail
# X error 167 (GLXBadFBConfig (9)) was generated, but X error 8 was expected.
glx@glx_arb_create_context_no_error@no error,Crash

View File

@ -13,9 +13,8 @@ spec@arb_compute_variable_group_size@local-size
# "X connection to :99 broken (explicit kill or server shutdown)."
glx@glx-multi-context-ib-1
# depth/stencil visuals
# depth visuals
glx@glx-visuals-depth
glx@glx-visuals-stencil
# mysterious
glx@glx-shader-sharing

View File

@ -39,7 +39,6 @@ glx@glx-swap-copy,Fail
glx@glx-swap-pixmap-bad,Fail
glx@glx-visuals-depth,Crash
glx@glx-visuals-depth -pixmap,Crash
glx@glx-visuals-stencil,Crash
glx@glx-visuals-stencil -pixmap,Crash
# #6322

View File

@ -1261,24 +1261,26 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index,
image->serial = (uint32_t) chain->send_sbc;
xcb_void_cookie_t cookie =
xcb_present_pixmap(chain->conn,
chain->window,
image->pixmap,
image->serial,
0, /* valid */
image->update_area, /* update */
0, /* x_off */
0, /* y_off */
XCB_NONE, /* target_crtc */
XCB_NONE,
image->sync_fence,
options,
target_msc,
divisor,
remainder, 0, NULL);
xcb_discard_reply(chain->conn, cookie.sequence);
xcb_flush(chain->conn);
xcb_present_pixmap_checked(chain->conn,
chain->window,
image->pixmap,
image->serial,
0, /* valid */
image->update_area, /* update */
0, /* x_off */
0, /* y_off */
XCB_NONE, /* target_crtc */
XCB_NONE,
image->sync_fence,
options,
target_msc,
divisor,
remainder, 0, NULL);
xcb_generic_error_t *error = xcb_request_check(chain->conn, cookie);
if (error) {
free(error);
return x11_swapchain_result(chain, VK_ERROR_SURFACE_LOST_KHR);
}
return x11_swapchain_result(chain, VK_SUCCESS);
}