WIP: clutter-stage-cogl: Never cache the update_time [performance]
Previously we would calculate the stage update_time
once per frame and
keep returning the same value until it was cleared.
The problem with that was that by the time we came to render we were using
the wrong update_time
. It was out of date because it had been calculated
from an old value of last_presentation_time
and not the latest one. The
effect of this was that we would briefly schedule frames faster than the
refresh rate, filling the buffer queue. Once the queue was full we would be
throttled to the correct refresh rate by SwapBuffers
but the buffer queue
would remain full (triple buffered) causing visible lag.
The solution is to not cache update_time
, just recalculate it more often.
This way as we race against the pending presentation event, after it
completes we are able to recalculate the correct update_time
before
rendering. Thus avoiding rendering too early and avoiding filling triple
buffers when we only want double buffering.
Closes: #334 (closed)