wsi/wayland: Add perfetto flows to image acquisition and presentation

Generate flow ids for slightly more informative swapchain profiling.

Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28634>
This commit is contained in:
Derek Foreman 2024-04-05 08:35:06 -05:00 committed by Marge Bot
parent 16b8dbedfa
commit 5ba7b3f40c
1 changed files with 14 additions and 0 deletions

View File

@ -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.