Use swap events to drive repaints

Review Request #121590 - Created Dec. 18, 2014 and updated

Information
Fredrik Höglund
kwin
master
Reviewers
kwin

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.


  
Aleix Pol Gonzalez

I tried it, it didn't break, seems to work fine. Can't really tell if it's more performant.

  1. And that test was with the Intel driver.

    One thing I forgot to mention is that this patch has no effect unless you're using Qt 5.4.

  2. Good, I'm using 5.4 anyway.

    Still running with the patch, no crashes.

Martin Flöser

Approach looks good to me. What I find "sad" about it is that it increases the differences in behavior between the drivers.

Loading...