From 9c021b0bc2e4f0d2698f36db41224645ed31b6dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Fri, 30 Jun 2023 17:44:15 +0200 Subject: [PATCH] clutter/frame-clock: Clamp recorded maxima to refresh interval clutter_frame_clock_compute_max_render_time_us clamps to the refresh interval anyway, so the only effect a higher recorded maximum can have is to delay it falling below the refresh interval again. Part-of: --- clutter/clutter/clutter-frame-clock.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index 86494bd09..e4a4302f8 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -349,9 +349,10 @@ clutter_frame_clock_notify_presented (ClutterFrameClock *frame_clock, swap_to_flip_us); frame_clock->shortterm_max_update_duration_us = - MAX (frame_clock->shortterm_max_update_duration_us, - frame_clock->last_dispatch_lateness_us + dispatch_to_swap_us + - MAX (swap_to_rendering_done_us, swap_to_flip_us)); + CLAMP (frame_clock->last_dispatch_lateness_us + dispatch_to_swap_us + + MAX (swap_to_rendering_done_us, swap_to_flip_us), + frame_clock->shortterm_max_update_duration_us, + frame_clock->refresh_interval_us); maybe_update_longterm_max_duration_us (frame_clock, frame_info);