From f8bfdc4bbb692011f025686c28c836a481fd3548 Mon Sep 17 00:00:00 2001 From: David Stern Date: Tue, 26 Mar 2024 12:27:44 -0400 Subject: [PATCH] vulkan/wsi/x11: Explicitly discard errors from xcb_present_pixmap. Errors produced by the call to `xcb_present_pixmap` should be explicitly discarded to ensure they don't leak into the application event loop. Reviewed-By: Mike Blumenkrantz Fixes: 2b885b23 ("vk/wsi/x11: stop roundtripping on presentation") Part-of: (cherry picked from commit 82ed8aadea26770331974b8d3abab56f13c7fc8d) --- .pick_status.json | 2 +- src/vulkan/wsi/wsi_common_x11.c | 32 +++++++++++++++++--------------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/.pick_status.json b/.pick_status.json index 47cb023d2ac..48c3acdce30 100644 --- a/.pick_status.json +++ b/.pick_status.json @@ -2524,7 +2524,7 @@ "description": "vulkan/wsi/x11: Explicitly discard errors from xcb_present_pixmap.", "nominated": true, "nomination_type": 1, - "resolution": 0, + "resolution": 1, "main_sha": null, "because_sha": "2b885b233f7a6300ae88732c179888c02788493d", "notes": null diff --git a/src/vulkan/wsi/wsi_common_x11.c b/src/vulkan/wsi/wsi_common_x11.c index f6d711297e3..692ff0f33fc 100644 --- a/src/vulkan/wsi/wsi_common_x11.c +++ b/src/vulkan/wsi/wsi_common_x11.c @@ -1625,21 +1625,23 @@ x11_present_to_x11_dri3(struct x11_swapchain *chain, uint32_t image_index, image->present_queued = true; image->serial = (uint32_t) chain->send_sbc; - 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_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); return x11_swapchain_result(chain, VK_SUCCESS); }