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 99850f4645

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2819>
This commit is contained in:
Robert Mader 2023-02-01 01:05:39 +01:00 committed by Marge Bot
parent be649bdad2
commit 678bc69e72

View File

@ -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;