From 74f28819d985984170964d12d8f527034db93017 Mon Sep 17 00:00:00 2001 From: Tom Cooksey Date: Fri, 16 Apr 2010 11:50:55 +0200 Subject: Set EGL_SWAP_BEHAVIOR to EGL_BUFFER_PRESERVED for regular QWidgets QGLWidgets are assumed to be buffer destroyed, however regular QWidgets assume they can to partial updates and thus need the preserved swap behaviour. Reviewed-By: Trond Task-number: QTBUG-9554 --- src/gui/egl/qeglproperties.cpp | 3 +++ src/opengl/qgl_x11egl.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/src/gui/egl/qeglproperties.cpp b/src/gui/egl/qeglproperties.cpp index 5543547..3638de5 100644 --- a/src/gui/egl/qeglproperties.cpp +++ b/src/gui/egl/qeglproperties.cpp @@ -241,6 +241,9 @@ void QEglProperties::setRenderableType(QEgl::API api) // reductions in complexity are possible. bool QEglProperties::reduceConfiguration() { + if (value(EGL_SWAP_BEHAVIOR) != EGL_DONT_CARE) + removeValue(EGL_SWAP_BEHAVIOR); + #ifdef EGL_VG_ALPHA_FORMAT_PRE_BIT // For OpenVG, we sometimes try to create a surface using a pre-multiplied format. If we can't // find a config which supports pre-multiplied formats, remove the flag on the surface type: diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp index 6f210ce..d67a3ea 100644 --- a/src/opengl/qgl_x11egl.cpp +++ b/src/opengl/qgl_x11egl.cpp @@ -199,6 +199,10 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) configProps.setRenderableType(QEgl::OpenGL); qt_eglproperties_set_glformat(configProps, d->glFormat); + // Set buffer preserved for regular QWidgets, QGLWidgets are ok with either preserved or destroyed: + if ((devType == QInternal::Widget) && qobject_cast(static_cast(device())) == 0) + configProps.setValue(EGL_SWAP_BEHAVIOR, EGL_BUFFER_PRESERVED); + if (!d->eglContext->chooseConfig(configProps, QEgl::BestPixelFormat)) { delete d->eglContext; d->eglContext = 0; -- cgit v0.12