diff --git a/src/backends/x11/standalone/eglbackend.cpp b/src/backends/x11/standalone/eglbackend.cpp index d508a24cb7..161f64d7f0 100644 --- a/src/backends/x11/standalone/eglbackend.cpp +++ b/src/backends/x11/standalone/eglbackend.cpp @@ -6,6 +6,7 @@ */ #include "eglbackend.h" +#include "kwinglplatform.h" #include "logging.h" #include "options.h" #include "overlaywindow.h" @@ -114,7 +115,18 @@ void EglBackend::endFrame(AbstractOutput *output, const QRegion &renderedRegion, // eglSwapBuffers() or eglSwapBuffersWithDamageEXT() completes. m_vsyncMonitor->arm(); - presentSurface(surface(), renderedRegion, screens()->geometry()); + QRegion effectiveRenderedRegion = renderedRegion; + if (!GLPlatform::instance()->isGLES()) { + const QRegion displayRegion(screens()->geometry()); + if (!supportsBufferAge() && options->glPreferBufferSwap() == Options::CopyFrontBuffer && renderedRegion != displayRegion) { + glReadBuffer(GL_FRONT); + copyPixels(displayRegion - renderedRegion); + glReadBuffer(GL_BACK); + effectiveRenderedRegion = displayRegion; + } + } + + presentSurface(surface(), effectiveRenderedRegion, screens()->geometry()); if (overlayWindow() && overlayWindow()->window()) { // show the window only after the first pass, overlayWindow()->show(); // since that pass may take long diff --git a/src/backends/x11/standalone/glxbackend.cpp b/src/backends/x11/standalone/glxbackend.cpp index 68fd1bd580..71e92229c3 100644 --- a/src/backends/x11/standalone/glxbackend.cpp +++ b/src/backends/x11/standalone/glxbackend.cpp @@ -767,7 +767,17 @@ void GlxBackend::endFrame(AbstractOutput *output, const QRegion &renderedRegion, m_vsyncMonitor->arm(); } - present(renderedRegion); + const QRegion displayRegion(screens()->geometry()); + + QRegion effectiveRenderedRegion = renderedRegion; + if (!supportsBufferAge() && options->glPreferBufferSwap() == Options::CopyFrontBuffer && renderedRegion != displayRegion) { + glReadBuffer(GL_FRONT); + copyPixels(displayRegion - renderedRegion); + glReadBuffer(GL_BACK); + effectiveRenderedRegion = displayRegion; + } + + present(effectiveRenderedRegion); if (overlayWindow()->window()) // show the window only after the first pass, overlayWindow()->show(); // since that pass may take long diff --git a/src/scenes/opengl/scene_opengl.cpp b/src/scenes/opengl/scene_opengl.cpp index 6c57d93a64..764778b352 100644 --- a/src/scenes/opengl/scene_opengl.cpp +++ b/src/scenes/opengl/scene_opengl.cpp @@ -318,20 +318,6 @@ void SceneOpenGL::paint(AbstractOutput *output, const QRegion &damage, const QLi renderLoop, projectionMatrix()); // call generic implementation paintCursor(output, valid); - if (!GLPlatform::instance()->isGLES() && !output) { - const QRegion displayRegion(geometry()); - - // copy dirty parts from front to backbuffer - if (!m_backend->supportsBufferAge() && - options->glPreferBufferSwap() == Options::CopyFrontBuffer && - valid != displayRegion) { - glReadBuffer(GL_FRONT); - m_backend->copyPixels(displayRegion - valid); - glReadBuffer(GL_BACK); - valid = displayRegion; - } - } - renderLoop->endFrame(); GLVertexBuffer::streamingBuffer()->endOfFrame();