summaryrefslogtreecommitdiffstats
path: root/src/gui/egl/qegl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/egl/qegl.cpp')
-rw-r--r--src/gui/egl/qegl.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp
index 659757e..a84a6fb 100644
--- a/src/gui/egl/qegl.cpp
+++ b/src/gui/egl/qegl.cpp
@@ -48,6 +48,9 @@
#include "qegl_p.h"
#include "qeglcontext_p.h"
+#ifdef Q_OS_SYMBIAN
+#include "private/qt_s60_p.h"
+#endif
QT_BEGIN_NAMESPACE
@@ -398,6 +401,9 @@ bool QEglContext::createContext(QEglContext *shareContext, const QEglProperties
ctx = eglCreateContext(display(), cfg, EGL_NO_CONTEXT, contextProps.properties());
if (ctx == EGL_NO_CONTEXT) {
qWarning() << "QEglContext::createContext(): Unable to create EGL context:" << QEgl::errorString();
+#ifdef Q_OS_SYMBIAN
+ S60->eglSurfaceCreationError = true;
+#endif
return false;
}
}
@@ -683,7 +689,7 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr
props = properties->properties();
else
props = 0;
- EGLSurface surf;
+ EGLSurface surf = EGL_NO_SURFACE;
#ifdef Q_OS_SYMBIAN
// On Symbian there might be situations (especially on 32MB GPU devices)
// where Qt is trying to create EGL surface while some other application
@@ -695,8 +701,11 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr
// alloc, let's try recreating it four times within ~1 second if needed.
// This strategy gives some time for video recorder to tear down its stack
// and a chance to Qt for creating a valid surface.
- int tries = 4;
- while(tries--) {
+ // If the surface is still failing however, we don't keep the app blocked.
+ static int tries = 4;
+ if (tries <= 0)
+ tries = 1;
+ while (tries-- > 0) {
if (devType == QInternal::Widget)
surf = eglCreateWindowSurface(QEgl::display(), cfg, windowDrawable, props);
else
@@ -704,13 +713,15 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr
if (surf == EGL_NO_SURFACE) {
EGLint error = eglGetError();
if (error == EGL_BAD_ALLOC) {
- if (tries) {
+ if (tries > 0) {
User::After(1000 * 250); // 250ms
continue;
}
}
qWarning("QEglContext::createSurface(): Unable to create EGL surface, error = 0x%x", error);
+ S60->eglSurfaceCreationError = true;
} else {
+ tries = 4;
break;
}
}