From 678bc69e725d2ee5d0c7409a33a7a43c8aa74992 Mon Sep 17 00:00:00 2001 From: Robert Mader Date: Wed, 1 Feb 2023 01:05:39 +0100 Subject: [PATCH] clutter/frame-clock: Clamp next_update_time to the current time Calculating a timestamp from the past distorts the dispatch lateness calculation, leading to an inflated max_render_time, which again increases the likelyhood of next_update_time being in the past. Fixes 99850f46459 Part-of: --- clutter/clutter/clutter-frame-clock.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clutter/clutter/clutter-frame-clock.c b/clutter/clutter/clutter-frame-clock.c index ab0a2d9ab..e4d0fb98a 100644 --- a/clutter/clutter/clutter-frame-clock.c +++ b/clutter/clutter/clutter-frame-clock.c @@ -573,6 +573,8 @@ calculate_next_update_time_us (ClutterFrameClock *frame_clock, next_presentation_time_us += refresh_interval_us; next_update_time_us = next_presentation_time_us - max_render_time_allowed_us; + if (next_update_time_us < now_us) + next_update_time_us = now_us; *out_next_update_time_us = next_update_time_us; *out_next_presentation_time_us = next_presentation_time_us;