loader/wayland: Move acquisition time tracking into perfetto flows

We only use the acquisition time for calculating latency for perfetto
tracks later, and the acquisition time should ideally be the start of the
perfetto flow.

This has been more or less true with very small error margin for vk wsi,
but the wayland EGL buffer handling is a lot more complicated. Moving the
time check into the flow start will make re-using this code for EGL much
simpler.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32757>
This commit is contained in:
Derek Foreman
2025-01-29 11:18:52 -06:00
parent 336cbc499f
commit b3e3f0fc2e
4 changed files with 37 additions and 31 deletions
+8 -9
View File
@@ -2321,7 +2321,7 @@ struct wsi_wl_present_id {
* which uses frame callback to signal DRI3 COMPLETE. */
struct wl_callback *frame;
uint64_t present_id;
uint64_t flow_id;
struct mesa_trace_flow flow;
uint64_t submission_time;
const VkAllocationCallbacks *alloc;
struct wsi_wl_swapchain *chain;
@@ -2578,9 +2578,9 @@ wsi_wl_swapchain_acquire_next_image_explicit(struct wsi_swapchain *wsi_chain,
uint32_t *image_index)
{
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
uint64_t id = 0;
struct mesa_trace_flow flow = { 0 };
MESA_TRACE_FUNC_FLOW(&id);
MESA_TRACE_FUNC_FLOW(&flow);
/* See comments in queue_present() */
if (chain->retired)
@@ -2603,7 +2603,7 @@ wsi_wl_swapchain_acquire_next_image_explicit(struct wsi_swapchain *wsi_chain,
STACK_ARRAY_FINISH(images);
if (result == VK_SUCCESS) {
loader_wayland_buffer_set_flow(&chain->images[*image_index].wayland_buffer, id);
loader_wayland_buffer_set_flow(&chain->images[*image_index].wayland_buffer, &flow);
if (chain->suboptimal)
result = VK_SUBOPTIMAL_KHR;
}
@@ -2619,9 +2619,9 @@ wsi_wl_swapchain_acquire_next_image_implicit(struct wsi_swapchain *wsi_chain,
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
struct timespec start_time, end_time;
struct timespec rel_timeout;
uint64_t id = 0;
struct mesa_trace_flow flow = { 0 };
MESA_TRACE_FUNC_FLOW(&id);
MESA_TRACE_FUNC_FLOW(&flow);
/* See comments in queue_present() */
if (chain->retired)
@@ -2649,7 +2649,7 @@ wsi_wl_swapchain_acquire_next_image_implicit(struct wsi_swapchain *wsi_chain,
/* We found a non-busy image */
*image_index = i;
chain->images[i].busy = true;
loader_wayland_buffer_set_flow(&chain->images[i].wayland_buffer, id);
loader_wayland_buffer_set_flow(&chain->images[i].wayland_buffer, &flow);
return (chain->suboptimal ? VK_SUBOPTIMAL_KHR : VK_SUCCESS);
}
}
@@ -2844,9 +2844,8 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain,
struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain;
bool timestamped = false;
bool queue_dispatched = false;
uint64_t flow_id = chain->images[image_index].wayland_buffer.flow_id;
MESA_TRACE_FUNC_FLOW(&flow_id);
MESA_TRACE_FUNC_FLOW(&chain->images[image_index].wayland_buffer.flow);
/* In case we're sending presentation feedback requests, make sure the
* queue their events are in is dispatched.