summaryrefslogtreecommitdiffstats
path: root/src/opengl/qwindowsurface_gl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/opengl/qwindowsurface_gl.cpp')
-rw-r--r--src/opengl/qwindowsurface_gl.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp
index 7efa9bc..e9da452 100644
--- a/src/opengl/qwindowsurface_gl.cpp
+++ b/src/opengl/qwindowsurface_gl.cpp
@@ -354,8 +354,22 @@ void QGLWindowSurface::hijackWindow(QWidget *widget)
ctx->create(qt_gl_share_widget()->context());
#ifndef QT_NO_EGL
- if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED)
+ static bool checkedForNOKSwapRegion = false;
+ static bool haveNOKSwapRegion = false;
+
+ if (!checkedForNOKSwapRegion) {
+ haveNOKSwapRegion = QEgl::hasExtension("EGL_NOK_swap_region2");
+ checkedForNOKSwapRegion = true;
+
+ if (haveNOKSwapRegion)
+ qDebug() << "Found EGL_NOK_swap_region2 extension. Using partial updates.";
+ }
+
+ if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED &&
+ ! haveNOKSwapRegion)
setPartialUpdateSupport(false); // Force full-screen updates
+ else
+ setPartialUpdateSupport(true);
#endif
widgetPrivate->extraData()->glContext = ctx;
@@ -480,8 +494,14 @@ void QGLWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &
}
}
#endif
+ if (d_ptr->paintedRegion.boundingRect() != geometry()) {
+ // Emits warning if not supported. Should never happen unless
+ // setPartialUpdateSupport(true) has been called.
+ context()->d_func()->swapRegion(&d_ptr->paintedRegion);
+ } else
+ context()->swapBuffers();
+
d_ptr->paintedRegion = QRegion();
- context()->swapBuffers();
} else {
glFlush();
}