From 34273bc4eddd0c195220f305e2628d411394f028 Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 5 Apr 2024 10:18:51 -0500 Subject: [PATCH] wsi/wayland: Add timing debugging If perfetto is tracing, always send presentation feedback requests for image presentations. Signed-off-by: Derek Foreman Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 525c655aafd..f730a8273bf 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -1994,6 +1994,13 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, MESA_TRACE_FUNC_FLOW(&flow_id); + /* In case we're sending presentation feedback requests, make sure the + * queue their events are in is dispatched. + */ + struct timespec instant = {0}; + if (dispatch_present_id_queue(wsi_chain, &instant) == VK_ERROR_OUT_OF_DATE_KHR) + return VK_ERROR_OUT_OF_DATE_KHR; + /* While the specification suggests we can keep presenting already acquired * images on a retired swapchain, there is no requirement to support that. * From spec 1.3.278: @@ -2066,7 +2073,7 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, chain->fifo_ready = true; } - if (present_id > 0) { + if (present_id > 0 || util_perfetto_is_tracing_enabled()) { struct wsi_wl_present_id *id = vk_zalloc(chain->wsi_wl_surface->display->wsi_wl->alloc, sizeof(*id), sizeof(uintptr_t), VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);