From 5ba7b3f40c1ea7226b26b128a7fb82b16e481fcb Mon Sep 17 00:00:00 2001 From: Derek Foreman Date: Fri, 5 Apr 2024 08:35:06 -0500 Subject: [PATCH] wsi/wayland: Add perfetto flows to image acquisition and presentation Generate flow ids for slightly more informative swapchain profiling. Signed-off-by: Derek Foreman Part-of: --- src/vulkan/wsi/wsi_common_wayland.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/vulkan/wsi/wsi_common_wayland.c b/src/vulkan/wsi/wsi_common_wayland.c index 3c7ced0aaf0..45ffe53f9d1 100644 --- a/src/vulkan/wsi/wsi_common_wayland.c +++ b/src/vulkan/wsi/wsi_common_wayland.c @@ -140,6 +140,7 @@ struct wsi_wl_image { int shm_fd; void *shm_ptr; unsigned shm_size; + uint64_t flow_id; struct wp_linux_drm_syncobj_timeline_v1 *wl_syncobj_timeline[WSI_ES_COUNT]; }; @@ -1827,6 +1828,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; + + MESA_TRACE_FUNC_FLOW(&id); /* See comments in queue_present() */ if (chain->retired) @@ -1843,6 +1847,9 @@ wsi_wl_swapchain_acquire_next_image_explicit(struct wsi_swapchain *wsi_chain, image_index); STACK_ARRAY_FINISH(images); + if (result == VK_SUCCESS) + chain->images[*image_index].flow_id = id; + return result; } @@ -1854,6 +1861,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; + + MESA_TRACE_FUNC_FLOW(&id); /* See comments in queue_present() */ if (chain->retired) @@ -1872,6 +1882,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; + chain->images[i].flow_id = id; return (chain->suboptimal ? VK_SUBOPTIMAL_KHR : VK_SUCCESS); } } @@ -1972,6 +1983,9 @@ wsi_wl_swapchain_queue_present(struct wsi_swapchain *wsi_chain, { struct wsi_wl_swapchain *chain = (struct wsi_wl_swapchain *)wsi_chain; bool queue_dispatched = false; + uint64_t flow_id = chain->images[image_index].flow_id; + + MESA_TRACE_FUNC_FLOW(&flow_id); /* While the specification suggests we can keep presenting already acquired * images on a retired swapchain, there is no requirement to support that.