diff --git a/eglonxbackend.cpp b/eglonxbackend.cpp index 781f09b40e..f2c6467cc4 100644 --- a/eglonxbackend.cpp +++ b/eglonxbackend.cpp @@ -279,15 +279,8 @@ void EglOnXBackend::present() if (lastDamage().isEmpty()) return; - if (supportsBufferAge()) { - eglSwapBuffers(dpy, surface); - eglQuerySurface(dpy, surface, EGL_BUFFER_AGE_EXT, &m_bufferAge); - setLastDamage(QRegion()); - return; - } - const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); - const bool fullRepaint = (lastDamage() == displayRegion); + const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion); if (fullRepaint || !surfaceHasSubPost) { if (gs_tripleBufferNeedsDetection) { @@ -315,6 +308,9 @@ void EglOnXBackend::present() setBlocksForRetrace(result == 'd'); } } + if (supportsBufferAge()) { + eglQuerySurface(dpy, surface, EGL_BUFFER_AGE_EXT, &m_bufferAge); + } } else { // a part of the screen changed, and we can use eglPostSubBufferNV to copy the updated area foreach (const QRect & r, lastDamage().rects()) { @@ -323,8 +319,10 @@ void EglOnXBackend::present() } setLastDamage(QRegion()); - eglWaitGL(); - xcb_flush(connection()); + if (!supportsBufferAge()) { + eglWaitGL(); + xcb_flush(connection()); + } } void EglOnXBackend::screenGeometryChanged(const QSize &size) diff --git a/glxbackend.cpp b/glxbackend.cpp index 269da58c0e..ef2a989d87 100644 --- a/glxbackend.cpp +++ b/glxbackend.cpp @@ -438,15 +438,8 @@ void GlxBackend::present() if (lastDamage().isEmpty()) return; - if (supportsBufferAge()) { - glXSwapBuffers(display(), glxWindow); - glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge); - setLastDamage(QRegion()); - return; - } - const QRegion displayRegion(0, 0, displayWidth(), displayHeight()); - const bool fullRepaint = (lastDamage() == displayRegion); + const bool fullRepaint = supportsBufferAge() || (lastDamage() == displayRegion); if (fullRepaint) { if (haveSwapInterval) { @@ -478,6 +471,9 @@ void GlxBackend::present() waitSync(); glXSwapBuffers(display(), glxWindow); } + if (supportsBufferAge()) { + glXQueryDrawable(display(), glxWindow, GLX_BACK_BUFFER_AGE_EXT, (GLuint *) &m_bufferAge); + } } else if (glXCopySubBuffer) { foreach (const QRect & r, lastDamage().rects()) { // convert to OpenGL coordinates @@ -490,9 +486,11 @@ void GlxBackend::present() glDrawBuffer(GL_BACK); } - glXWaitGL(); setLastDamage(QRegion()); - XFlush(display()); + if (!supportsBufferAge()) { + glXWaitGL(); + XFlush(display()); + } } void GlxBackend::screenGeometryChanged(const QSize &size)