summaryrefslogtreecommitdiffstats
path: root/src/gui/egl
diff options
context:
space:
mode:
authorJani Hautakangas <jani.hautakangas@nokia.com>2011-08-05 12:34:01 (GMT)
committerJani Hautakangas <jani.hautakangas@nokia.com>2011-08-05 12:52:07 (GMT)
commit38df9798da4d9645d0620b9053f2a3f6ec35f80b (patch)
tree80f46524aeb7e729e774e7a8eece11f2441ae549 /src/gui/egl
parentd5caf208ae0e87ed1f2706aba8db7e6395fd156c (diff)
downloadQt-38df9798da4d9645d0620b9053f2a3f6ec35f80b.zip
Qt-38df9798da4d9645d0620b9053f2a3f6ec35f80b.tar.gz
Qt-38df9798da4d9645d0620b9053f2a3f6ec35f80b.tar.bz2
Fix to QGLWidget rendering with VG graphics system
QEGLContext don't expect EGL based API to change on runtime (e.g. VG->GL). QEGLContext caches current API context pointer and uses this cached value to determine whether to make eglMakeCurrent call or not. VG graphics system and QGLWidget creates own separate QEGLContext objects, but both of those objects consider themself to be current context, so no eglMakeCurrent call occurs even though the API has changed. This patch adds ifdef'd current context check for Symbian which enables eglMakeCurrent call if EGL API has changed. (Symbian is the only supported platform currently where this scenario happens). Task-number: QT-5012 Reviewed-by: Samuel Rødal
Diffstat (limited to 'src/gui/egl')
-rw-r--r--src/gui/egl/qegl.cpp21
-rw-r--r--src/gui/egl/qeglcontext_p.h1
2 files changed, 21 insertions, 1 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index d9c5ea2..4db4a6a 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -94,6 +94,7 @@ QEglContext::QEglContext()
, current(false)
, ownsContext(true)
, sharing(false)
+ , apiChanged(false)
{
QEglContextTracker::ref();
}
@@ -435,9 +436,20 @@ bool QEglContext::makeCurrent(EGLSurface surface)
return false;
}
+#ifdef Q_OS_SYMBIAN
+ apiChanged = false;
+ if (currentContext(apiType)
+ && currentContext(apiType)->ctx != eglGetCurrentContext()) {
+ // some other EGL based API active. Complete its rendering
+ eglWaitClient();
+ apiChanged = true;
+ }
+#endif
+
// If lazyDoneCurrent() was called on the surface, then we may be able
// to assume that it is still current within the thread.
- if (surface == currentSurface && currentContext(apiType) == this) {
+ if (surface == currentSurface && currentContext(apiType) == this
+ && !apiChanged) {
current = true;
return true;
}
@@ -512,6 +524,13 @@ bool QEglContext::swapBuffers(EGLSurface surface)
bool ok = eglSwapBuffers(QEgl::display(), surface);
if (!ok)
qWarning() << "QEglContext::swapBuffers():" << QEgl::errorString();
+
+#ifdef Q_OS_SYMBIAN
+ if (apiChanged) {
+ eglWaitClient();
+ apiChanged = false;
+ }
+#endif
return ok;
}
diff --git a/src/gui/egl/qeglcontext_p.h b/src/gui/egl/qeglcontext_p.h
index 6cd76b3..0cdaae7 100644
--- a/src/gui/egl/qeglcontext_p.h
+++ b/src/gui/egl/qeglcontext_p.h
@@ -104,6 +104,7 @@ private:
bool current;
bool ownsContext;
bool sharing;
+ bool apiChanged;
static QEglContext *currentContext(QEgl::API api);
static void setCurrentContext(QEgl::API api, QEglContext *context);