diff options
author | Gunnar Sletta <gunnar.sletta@digia.com> | 2013-10-28 10:29:02 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-29 19:59:17 +0100 |
commit | 9087d4ed7bd81b97de90e0aa1844e9944c9d9be6 (patch) | |
tree | 0f0acc5bd6dd70cf88e21821d93438e0828efa51 /src/plugins | |
parent | cf239f69e1873573da1d17d1eeed326686f7cbef (diff) |
Don't support threaded GL on chromium (virtual box GL)
Change-Id: I84f89450e3fce1cbbafd19dbf4509b1911e06b19
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.cpp | 32 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.h | 6 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 2 |
3 files changed, 39 insertions, 1 deletions
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index cbfbdf495f..2c418cbebe 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -408,6 +408,38 @@ bool QGLXContext::isValid() const return m_context != 0; } +bool QGLXContext::m_queriedDummyContext = false; +bool QGLXContext::m_supportsThreading = true; + +void QGLXContext::queryDummyContext() +{ + if (m_queriedDummyContext) + return; + m_queriedDummyContext = true; + + static bool skip = qEnvironmentVariableIsSet("QT_OPENGL_NO_SANITY_CHECK"); + if (skip) + return; + + QOffscreenSurface surface; + surface.create(); + QOpenGLContext context; + context.create(); + context.makeCurrent(&surface); + + const char *renderer = (const char *) glGetString(GL_RENDERER); + if (QByteArray(renderer).contains("Chromium")) + m_supportsThreading = false; + else + m_supportsThreading = true; +} + +bool QGLXContext::supportsThreading() +{ + if (!m_queriedDummyContext) + queryDummyContext(); + return m_supportsThreading; +} QGLXPbuffer::QGLXPbuffer(QOffscreenSurface *offscreenSurface) : QPlatformOffscreenSurface(offscreenSurface) diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 7116b2389d..dcc7fe8855 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -72,12 +72,18 @@ public: GLXContext glxContext() const { return m_context; } + static bool supportsThreading(); + static void queryDummyContext(); + private: QXcbScreen *m_screen; GLXContext m_context; GLXContext m_shareContext; QSurfaceFormat m_format; bool m_isPBufferCurrent; + + static bool m_queriedDummyContext; + static bool m_supportsThreading; }; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 5168bd818b..6b5ea93638 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -278,7 +278,7 @@ bool QXcbIntegration::hasCapability(QPlatformIntegration::Capability cap) const #else case OpenGL: return false; #endif - case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering(); + case ThreadedOpenGL: return m_connections.at(0)->supportsThreadedRendering() && QGLXContext::supportsThreading(); case WindowMasks: return true; case MultipleWindows: return true; case ForeignWindows: return true; |