Verified Commit 67a3715d authored by Daniel van Vugt's avatar Daniel van Vugt Committed by Georges Basile Stavracas Neto

clutter/stage-cogl: Reduce while loop iterations

If `last_presentation_time` is zero (unsupported) or just very old
(system was idle) then we would like to avoid that triggering a large
number of loop interations. This will get us closer to the right answer
without iterating.

parent 35aa2781
......@@ -204,6 +204,19 @@ clutter_stage_cogl_schedule_update (ClutterStageWindow *stage_window,
next_presentation_time = stage_cogl->last_presentation_time + refresh_interval;
/* Get next_presentation_time closer to its final value, to reduce
* the number of while iterations below.
if (next_presentation_time < now)
int64_t last_virtual_presentation_time = now - now % refresh_interval;
int64_t hardware_clock_phase =
stage_cogl->last_presentation_time % refresh_interval;
next_presentation_time =
last_virtual_presentation_time + hardware_clock_phase;
while (next_presentation_time < now + min_render_time_allowed)
next_presentation_time += refresh_interval;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment