mesa/src/panfrost
Olivia Lee e278a89fdd panvk/perfetto: improve clock synchronization using CLOCK_MONOTONIC_RAW
On Mali, GPU timestamp cycle counts are mapped to the arch counter, and
so advance at the same rate as CNTVCT (with a fixed offset). The kernel
applies gradual NTP adjustments to CLOCK_BOOTTIME by modifying the rate
of the cycle->ns conversion slightly from the nominal frequency of the
clock, which causes it to drift from the GPU clock's ns values (which
just use the nominal frequency). On a rock5b, I measured this drift in
the 25-30µs/s range.

Perfetto's clock synchronization applies a fixed offset between each
clock snapshot, and so does not handle clocks with significantly
different rates and infrequent snapshots well. For panvk, we emit
snapshots once per second, and so the drift results in an error of
~25µs right before the next snapshot. This is significant for measuring
the latency of CPU<->GPU operations, and shows up as a sawtooth pattern
on the measured latency distribution over time.

CLOCK_MONOTONIC_RAW does not have the NTP adjustment, and so the only
source of drift is error in the shift/mult approximation that the kernel
uses for cycle->ns. This error is very small, and so by emitting CPU
trace events against CLOCK_MONOTONIC_RAW instead of CLOCK_BOOTTIME, we
can get much more accurate synchronization.

Signed-off-by: Olivia Lee <olivia.lee@collabora.com>
Reviewed-by: Eric R. Smith <eric.smith@collabora.com>
Reviewed-by: Mary Guillemard <mary.guillemard@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/34390>
2025-08-19 09:50:36 +00:00
..
ci panvk: Use indirect path for indexed draw on JM 2025-08-04 12:12:55 +00:00
clc nir/precompiled: add shader stage option to nir_precompiled_build_variant 2025-07-09 13:14:41 +01:00
compiler pan/bi: Revamp bi_optimize_nir 2025-08-11 11:38:57 +00:00
drm-shim panfrost: Fix group priorities in drm-shim 2025-02-05 13:30:29 +00:00
ds pan: Use a consistent pan_ prefix across src/panfrost/* 2025-05-21 14:58:20 +02:00
genxml panvk: Fix IUB decode 2025-08-11 10:12:29 +00:00
lib all: rename gl_shader_stage to mesa_shader_stage 2025-08-06 10:28:40 +08:00
libpan panvk: add a meta command for transitioning image layout 2025-08-12 12:43:10 +00:00
midgard all: rename gl_shader_stage_uses_workgroup to mesa_shader_stage_uses_workgroup 2025-08-06 10:28:41 +08:00
perf build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
shared build: avoid redefining unreachable() which is standard in C23 2025-07-31 17:49:42 +00:00
tools pan: Use a consistent pan_ prefix across src/panfrost/* 2025-05-21 14:58:20 +02:00
util panvk: rewrite pan_nir_lower_static_noperspective 2025-08-07 10:33:36 +00:00
vulkan panvk/perfetto: improve clock synchronization using CLOCK_MONOTONIC_RAW 2025-08-19 09:50:36 +00:00
.clang-format panvk: Add basic infrastructure for shader variants 2025-07-21 16:52:44 +00:00
meson.build panfrost: Move genxml out of pan/lib 2025-05-09 09:33:38 +00:00