[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kwin] /: Use swap events to drive repaints
From:       Fredrik_Höglund <fredrik () kde ! org>
Date:       2015-01-06 6:55:04
Message-ID: E1Y8O2i-0001ky-Bk () scm ! kde ! org
[Download RAW message or body]

Git commit 38f1945c6c437cad14e9c22929ab7947009de8e5 by Fredrik Höglund.
Committed on 13/12/2014 at 13:26.
Pushed by fredrik into branch 'master'.

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.

M  +5    -1    composite.cpp

http://commits.kde.org/kwin/38f1945c6c437cad14e9c22929ab7947009de8e5

diff --git a/composite.cpp b/composite.cpp
index c4145a3..1ded8e9 100644
--- a/composite.cpp
+++ b/composite.cpp
@@ -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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic