From 7c0caf5727db2411051287a50ba5d0bb0d1ec909 Mon Sep 17 00:00:00 2001 From: Daniel van Vugt Date: Tue, 18 Jul 2023 14:10:34 +0800 Subject: [PATCH] clutter/frame-clock: Limit jitter measurements to one frame interval (100%) Measurements above 100% were originally allowed to show when frame skipping was occurring so you didn't have to also check the frame rate. But that also resulted in arbitrarily high jitter values being reported when returning from idle. And those are frequent enough to look like a bug or untrustworthy so let's not do that anymore. Taking the remainder of a high jitter value is still a meaningful jitter value. Fixes: https://gitlab.gnome.org/GNOME/mutter/-/issues/2906 Part-of: --- clutter/clutter/clutter-frame-clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index e4a4302f8..63d349ace 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -745,7 +745,8 @@ clutter_frame_clock_dispatch (ClutterFrameClock *frame_clock, dispatch_interval_us = time_us - frame_clock->last_dispatch_time_us; jitter_us = llabs (dispatch_interval_us - - frame_clock->last_dispatch_interval_us); + frame_clock->last_dispatch_interval_us) % + frame_clock->refresh_interval_us; frame_clock->last_dispatch_interval_us = dispatch_interval_us; CLUTTER_NOTE (FRAME_TIMINGS, "dispatch jitter %5ldµs (%3ld%%)", jitter_us,