WIP: clutter-stage-cogl: Don't skip past the next frame [performance]
last_presentation_time is usually a little in the past, although
sometimes slightly in the future. When it's over 2ms (
the past that would trigger the while loop to count up so that the next
update_time is in the future.
The problem with that is for common values of
which are only 2-8ms ago, incrementing
also means counting past the next physical frame that we haven't rendered
yet. And so mutter would skip a frame.
The reason nobody noticed these missed frames very often was because the bug had three accidental workarounds built-in:
Prior to 3.32, the offending code was only reachable in Xorg sessions. It was never reached in Wayland sessions because it hadn't been implemented yet (e9e4b2b7).
For Xorg sessions, frames are being over-scheduled with triple buffering. This avoids missed frames by often prerendering one more than intended. (#334 (closed)).
sync_delayis presently high enough (2ms) to push the
update_timeinto the future in some cases, often avoiding the erroneous while loop.
Now we modify the while loop to accept an
update_time that's still
slightly in the past. So providing there's still at least half a frame
of render time we try to make the next frame instead of skipping over it.
The master clock already supports update times in the past just fine, as
it treats them the same as being told to wake up immediately.