From 27430b2138a9434c7697a356f8156f3ecd3b906c Mon Sep 17 00:00:00 2001 From: Ginu Jacob Date: Mon, 28 Jul 2025 11:43:34 +0100 Subject: [PATCH] Retry mechanism for Wayland image presented event In this change, when performing dispatch_queue for the present timing VK_PRESENT_STAGE_IMAGE_FIRST_PIXEL_OUT_BIT_EXT stage a retry mechanism is implemented to dispatch Wayland events until there are no more events in the queue or till we get the Wayland presented event. Signed-off-by: Ginu Jacob Change-Id: Ieb9c2f3360d6f7c06167fb8096a398adaf71cdd2 --- wsi/wayland/present_timing_handler.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/wsi/wayland/present_timing_handler.cpp b/wsi/wayland/present_timing_handler.cpp index 4541d14..49a937a 100644 --- a/wsi/wayland/present_timing_handler.cpp +++ b/wsi/wayland/present_timing_handler.cpp @@ -137,12 +137,19 @@ void wsi_ext_present_timing_wayland::pixelout_callback(uint32_t image_index, uin VkResult wsi_ext_present_timing_wayland::get_pixel_out_timing_to_queue( uint32_t image_index, std::optional> stage_timing_optional) { - if (!m_timestamp_first_pixel_out[image_index].has_value()) + /* Try to get the event until there are no more events in + * the queue or till we get the presentation callback. */ + while (!m_timestamp_first_pixel_out[image_index].has_value()) { - if (dispatch_queue(m_display, m_queue, 0) < 0) + int res = dispatch_queue(m_display, m_queue, 0); + if (res < 0) { return VK_ERROR_SURFACE_LOST_KHR; } + else if (res == 0) + { + break; + } } if (m_timestamp_first_pixel_out[image_index].has_value()) {