WIP: clutter-stage-cogl: Avoid missed frames & stutter [performance]
A few things in clutter-stage-cogl
were causing missed frames and
stutter.
First:
if (stage_cogl->last_presentation_time == 0||
stage_cogl->last_presentation_time < now - 150000)
{
stage_cogl->update_time = now;
return;
}
wasn't causing a missed frame but would cause the next frame to have
an irregular update time (one not on refresh_interval
). This would make
animations spatially out of position and appeared to stutter even when
at full frame rate.
Second:
while (stage_cogl->update_time < now)
stage_cogl->update_time += refresh_interval;
mistakenly thought an update_time
in the past is a bug and so would skip
a frame. But it's not a bug, it's a feature - telling the caller that
we're running a bit late for the next frame. But if they start rendering
immediately they can often catch up and avoid skipping a frame.
Third:
if (stage_cogl->pending_swaps)
return -1; /* in the future, indefinite */
created an error condition that didn't need to exist and would deceive the caller into thinking we can't precisely calculate the next update time. But we can, so this is no longer an error.
Fixing these results in a noticeable improvement in Gnome Shell's icon grid animation smoothness. And hopefully elsewhere too.