Use swap events to drive repaints
Don't start the composite timer at the end of performPaint() when a buffer swap is pending and vsync is enabled. Instead set m_composeAtSwapCompletion to true so performPaint() gets called again as soon as the swap completes. This makes the repaint cycle look like this: scene->paint() SwapBuffers() Process events · · Swap completes Fetch and reset damage (if applicable) scene->paint() SwapBuffers() Process events · · Swap completes ... This results in a noticeable improvement in animation smoothness with drivers that support GLX_INTEL_swap_event, since we're now able to consistently render at the monitor refresh rate.
This commit is contained in:
parent
02d0a5bb7d
commit
38f1945c6c
1 changed files with 5 additions and 1 deletions
|
@ -663,7 +663,11 @@ void Compositor::performCompositing()
|
|||
// is called the next time. If there would be nothing pending, it will not restart the timer and
|
||||
// scheduleRepaint() would restart it again somewhen later, called from functions that
|
||||
// would again add something pending.
|
||||
scheduleRepaint();
|
||||
if (m_bufferSwapPending && m_scene->syncsToVBlank()) {
|
||||
m_composeAtSwapCompletion = true;
|
||||
} else {
|
||||
scheduleRepaint();
|
||||
}
|
||||
}
|
||||
|
||||
bool Compositor::windowRepaintsPending() const
|
||||
|
|
Loading…
Reference in a new issue