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
+14 -4
View File
@@ -12,6 +12,12 @@
#include "util/detect_os.h"
#include "util/macros.h"
#include "util/os_time.h"
struct mesa_trace_flow {
uint64_t id;
int64_t start_time;
};
#if defined(HAVE_PERFETTO)
@@ -155,13 +161,17 @@ _mesa_trace_scope_begin(const char *format, ...)
}
static inline void *
_mesa_trace_scope_flow_begin(const char *name, uint64_t *id)
_mesa_trace_scope_flow_begin(const char *name,
struct mesa_trace_flow *flow)
{
void *scope = NULL;
if (*id == 0)
*id = util_perfetto_next_id();
_MESA_TRACE_FLOW_BEGIN(name, *id);
if (flow->id == 0) {
flow->id = util_perfetto_next_id();
flow->start_time = os_time_get_nano();
}
_MESA_TRACE_FLOW_BEGIN(name, flow->id);
_MESA_GPUVIS_TRACE_BEGIN(name);
scope = _MESA_SYSPROF_TRACE_BEGIN(name);
return scope;