From dbc48c91f92acbef9828afbdf89c7b929d3305ce Mon Sep 17 00:00:00 2001 From: Philipp Knechtges Date: Thu, 12 Jan 2012 21:01:56 +0100 Subject: [PATCH] kwin: don't wait for vsync when nothing has been painted --- scene_opengl_egl.cpp | 5 +++-- scene_opengl_glx.cpp | 4 +++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/scene_opengl_egl.cpp b/scene_opengl_egl.cpp index dbda7816a7..7a198b0f6f 100644 --- a/scene_opengl_egl.cpp +++ b/scene_opengl_egl.cpp @@ -190,7 +190,9 @@ void SceneOpenGL::paint(QRegion damage, ToplevelList toplevels) if (m_overlayWindow->window()) // show the window only after the first pass, since m_overlayWindow->show(); // that pass may take long lastRenderTime = renderTimer.elapsed(); - flushBuffer(mask, damage); + if (!damage.isEmpty()) { + flushBuffer(mask, damage); + } // do cleanup stacking_order.clear(); checkGLError("PostPaint"); @@ -203,7 +205,6 @@ void SceneOpenGL::waitSync() void SceneOpenGL::flushBuffer(int mask, QRegion damage) { - Q_UNUSED(damage) glFlush(); if (mask & PAINT_SCREEN_REGION && surfaceHasSubPost && eglPostSubBufferNV) { QRect damageRect = damage.boundingRect(); diff --git a/scene_opengl_glx.cpp b/scene_opengl_glx.cpp index 84e7f610fe..35f04494de 100644 --- a/scene_opengl_glx.cpp +++ b/scene_opengl_glx.cpp @@ -465,7 +465,9 @@ void SceneOpenGL::paint(QRegion damage, ToplevelList toplevels) if (m_overlayWindow->window()) // show the window only after the first pass, since m_overlayWindow->show(); // that pass may take long lastRenderTime = renderTimer.elapsed(); - flushBuffer(mask, damage); + if (!damage.isEmpty()) { + flushBuffer(mask, damage); + } // do cleanup stacking_order.clear(); checkGLError("PostPaint");