diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2013-09-11 19:01:59 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-13 09:22:18 +0200 |
commit | e013eba2037c49385918a0ab1324bf58a18ee173 (patch) | |
tree | 6332e606116efd3b1f49b6e21a3defdbbd486686 /src/plugins/platforms/eglfs/qeglfscontext.cpp | |
parent | 5fd344389e163f1833f3d58c3cc994ac74063440 (diff) |
eglfs: Set swap interval only when there is a context available
Mesa does not like eglSwapInterval calls without a current context.
Change-Id: I7ec2d4311586cf74da0461bc951a0e5d9399c35b
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/plugins/platforms/eglfs/qeglfscontext.cpp')
-rw-r--r-- | src/plugins/platforms/eglfs/qeglfscontext.cpp | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/plugins/platforms/eglfs/qeglfscontext.cpp b/src/plugins/platforms/eglfs/qeglfscontext.cpp index 51439646c6..2c6846132d 100644 --- a/src/plugins/platforms/eglfs/qeglfscontext.cpp +++ b/src/plugins/platforms/eglfs/qeglfscontext.cpp @@ -53,13 +53,30 @@ QT_BEGIN_NAMESPACE QEglFSContext::QEglFSContext(const QSurfaceFormat &format, QPlatformOpenGLContext *share, EGLDisplay display, EGLenum eglApi) - : QEGLPlatformContext(QEglFSHooks::hooks()->surfaceFormatFor(format), share, display, QEglFSIntegration::chooseConfig(display, QEglFSHooks::hooks()->surfaceFormatFor(format)), eglApi) + : QEGLPlatformContext(QEglFSHooks::hooks()->surfaceFormatFor(format), share, display, + QEglFSIntegration::chooseConfig(display, QEglFSHooks::hooks()->surfaceFormatFor(format)), eglApi), + m_swapIntervalSet(false) { } bool QEglFSContext::makeCurrent(QPlatformSurface *surface) { - return QEGLPlatformContext::makeCurrent(surface); + bool success = QEGLPlatformContext::makeCurrent(surface); + + if (success && !m_swapIntervalSet) { + m_swapIntervalSet = true; + int swapInterval = 1; + QByteArray swapIntervalString = qgetenv("QT_QPA_EGLFS_SWAPINTERVAL"); + if (!swapIntervalString.isEmpty()) { + bool ok; + swapInterval = swapIntervalString.toInt(&ok); + if (!ok) + swapInterval = 1; + } + eglSwapInterval(eglDisplay(), swapInterval); + } + + return success; } EGLSurface QEglFSContext::eglSurfaceForPlatformSurface(QPlatformSurface *surface) |