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 <ginu.jacob@arm.com>
Change-Id: Ieb9c2f3360d6f7c06167fb8096a398adaf71cdd2
This commit is contained in:
Ginu Jacob 2025-07-28 11:43:34 +01:00
parent 1016e4d2e9
commit 27430b2138

View file

@ -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<std::reference_wrapper<swapchain_presentation_timing>> 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())
{