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

List:       kde-commits
Subject:    [kde-workspace/KDE/4.11] kwin: kwin: Prepare the backend interface for EXT_buffer_age
From:       Fredrik_Höglund <fredrik () kde ! org>
Date:       2013-12-12 0:39:51
Message-ID: E1VquJj-0005Bp-6G () scm ! kde ! org
[Download RAW message or body]

Git commit 50b222a4618e6d6e4cd5d7f206f4f529669c7579 by Fredrik Höglund.
Committed on 21/11/2013 at 09:39.
Pushed by fredrik into branch 'KDE/4.11'.

kwin: Prepare the backend interface for EXT_buffer_age

Allow prepareRenderingFrame() to return a region that will be
repainted in addition to the damaged region.

Pass both the damaged region and the repainted region, which
may be larger, as parameters to endRenderingFrame().

M  +6    -3    kwin/egl_wayland_backend.cpp
M  +2    -2    kwin/egl_wayland_backend.h
M  +6    -3    kwin/eglonxbackend.cpp
M  +2    -2    kwin/eglonxbackend.h
M  +5    -3    kwin/glxbackend.cpp
M  +2    -2    kwin/glxbackend.h
M  +1    -1    kwin/scene_opengl.cpp
M  +10   -3    kwin/scene_opengl.h

http://commits.kde.org/kde-workspace/50b222a4618e6d6e4cd5d7f206f4f529669c7579

diff --git a/kwin/egl_wayland_backend.cpp b/kwin/egl_wayland_backend.cpp
index 32dd2ee..b229cdd 100644
--- a/kwin/egl_wayland_backend.cpp
+++ b/kwin/egl_wayland_backend.cpp
@@ -816,17 +816,20 @@ SceneOpenGL::TexturePrivate *EglWaylandBackend::createBackendTexture(SceneOpenGL
     return new EglWaylandTexture(texture, this);
 }
 
-void EglWaylandBackend::prepareRenderingFrame()
+QRegion EglWaylandBackend::prepareRenderingFrame()
 {
     if (!lastDamage().isEmpty())
         present();
+
     eglWaitNative(EGL_CORE_NATIVE_ENGINE);
     startRenderTimer();
+
+    return QRegion();
 }
 
-void EglWaylandBackend::endRenderingFrame(const QRegion &damage)
+void EglWaylandBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
 {
-    setLastDamage(damage);
+    setLastDamage(renderedRegion);
     glFlush();
 }
 
diff --git a/kwin/egl_wayland_backend.h b/kwin/egl_wayland_backend.h
index 6651937..719da4b 100644
--- a/kwin/egl_wayland_backend.h
+++ b/kwin/egl_wayland_backend.h
@@ -264,8 +264,8 @@ public:
     virtual ~EglWaylandBackend();
     virtual void screenGeometryChanged(const QSize &size);
     virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
-    virtual void prepareRenderingFrame();
-    virtual void endRenderingFrame(const QRegion &damage);
+    virtual QRegion prepareRenderingFrame();
+    virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion);
     Shm *shm();
 
 protected:
diff --git a/kwin/eglonxbackend.cpp b/kwin/eglonxbackend.cpp
index e28945e..08762c5 100644
--- a/kwin/eglonxbackend.cpp
+++ b/kwin/eglonxbackend.cpp
@@ -320,7 +320,7 @@ SceneOpenGL::TexturePrivate *EglOnXBackend::createBackendTexture(SceneOpenGL::Te
     return new EglTexture(texture, this);
 }
 
-void EglOnXBackend::prepareRenderingFrame()
+QRegion EglOnXBackend::prepareRenderingFrame()
 {
     if (gs_tripleBufferNeedsDetection) {
         // the composite timer floors the repaint frequency. This can pollute our triple buffering
@@ -330,14 +330,17 @@ void EglOnXBackend::prepareRenderingFrame()
         // fllush the buffer queue
         usleep(1000);
     }
+
     present();
     startRenderTimer();
     eglWaitNative(EGL_CORE_NATIVE_ENGINE);
+
+    return QRegion();
 }
 
-void EglOnXBackend::endRenderingFrame(const QRegion &damage)
+void EglOnXBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
 {
-    setLastDamage(damage);
+    setLastDamage(renderedRegion);
 
     if (!blocksForRetrace()) {
         // This also sets lastDamage to empty which prevents the frame from
diff --git a/kwin/eglonxbackend.h b/kwin/eglonxbackend.h
index 9283fbe..60ac553 100644
--- a/kwin/eglonxbackend.h
+++ b/kwin/eglonxbackend.h
@@ -34,8 +34,8 @@ public:
     virtual ~EglOnXBackend();
     virtual void screenGeometryChanged(const QSize &size);
     virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
-    virtual void prepareRenderingFrame();
-    virtual void endRenderingFrame(const QRegion &damage);
+    virtual QRegion prepareRenderingFrame();
+    virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion);
 
 protected:
     virtual void present();
diff --git a/kwin/glxbackend.cpp b/kwin/glxbackend.cpp
index 70973b2..96f6817 100644
--- a/kwin/glxbackend.cpp
+++ b/kwin/glxbackend.cpp
@@ -493,7 +493,7 @@ SceneOpenGL::TexturePrivate *GlxBackend::createBackendTexture(SceneOpenGL::Textu
     return new GlxTexture(texture, this);
 }
 
-void GlxBackend::prepareRenderingFrame()
+QRegion GlxBackend::prepareRenderingFrame()
 {
     if (gs_tripleBufferNeedsDetection) {
         // the composite timer floors the repaint frequency. This can pollute our triple buffering
@@ -506,11 +506,13 @@ void GlxBackend::prepareRenderingFrame()
     present();
     startRenderTimer();
     glXWaitX();
+
+    return QRegion();
 }
 
-void GlxBackend::endRenderingFrame(const QRegion &damage)
+void GlxBackend::endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion)
 {
-    setLastDamage(damage);
+    setLastDamage(renderedRegion);
 
     if (!blocksForRetrace()) {
         // This also sets lastDamage to empty which prevents the frame from
diff --git a/kwin/glxbackend.h b/kwin/glxbackend.h
index 11b9079..ce3b3f4 100644
--- a/kwin/glxbackend.h
+++ b/kwin/glxbackend.h
@@ -44,8 +44,8 @@ public:
     virtual ~GlxBackend();
     virtual void screenGeometryChanged(const QSize &size);
     virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture);
-    virtual void prepareRenderingFrame();
-    virtual void endRenderingFrame(const QRegion &damage);
+    virtual QRegion prepareRenderingFrame();
+    virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion);
 
 protected:
     virtual void present();
diff --git a/kwin/scene_opengl.cpp b/kwin/scene_opengl.cpp
index a1bf789..f3fdfbb 100644
--- a/kwin/scene_opengl.cpp
+++ b/kwin/scene_opengl.cpp
@@ -372,7 +372,7 @@ qint64 SceneOpenGL::paint(QRegion damage, ToplevelList toplevels)
     checkGLError("Paint2");
 #endif
 
-    m_backend->endRenderingFrame(damage);
+    m_backend->endRenderingFrame(damage, damage);
 
     // do cleanup
     stacking_order.clear();
diff --git a/kwin/scene_opengl.h b/kwin/scene_opengl.h
index 699c8f2..baad5dd 100644
--- a/kwin/scene_opengl.h
+++ b/kwin/scene_opengl.h
@@ -461,21 +461,28 @@ public:
     }
     virtual void screenGeometryChanged(const QSize &size) = 0;
     virtual SceneOpenGL::TexturePrivate *createBackendTexture(SceneOpenGL::Texture *texture) = 0;
+
     /**
      * @brief Backend specific code to prepare the rendering of a frame including flushing the
      * previously rendered frame to the screen if the backend works this way.
+     *
+     * @return A region that if not empty will be repainted in addition to the damaged region
      **/
-    virtual void prepareRenderingFrame() = 0;
+    virtual QRegion prepareRenderingFrame() = 0;
+
     /**
      * @brief Backend specific code to handle the end of rendering a frame.
      *
-     * @param damage The actual updated region in this frame
+     * @param renderedRegion The possibly larger region that has been rendered
+     * @param damagedRegion The damaged region that should be posted
      **/
-    virtual void endRenderingFrame(const QRegion &damage) = 0;
+    virtual void endRenderingFrame(const QRegion &renderedRegion, const QRegion &damagedRegion) = 0;
+
     /**
      * @brief Compositor is going into idle mode, flushes any pending paints.
      **/
     void idle();
+
     /**
      * @return bool Whether the scene needs to flush a frame.
      **/

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

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