Don't support threaded GL on chromium (virtual box GL)

Change-Id: I84f89450e3fce1cbbafd19dbf4509b1911e06b19
Reviewed-by: Jørgen Lind <jorgen.lind@digia.com>
This commit is contained in:
Gunnar Sletta 2013-10-28 10:29:02 +01:00 committed by The Qt Project
parent cf239f69e1
commit 9087d4ed7b
3 changed files with 39 additions and 1 deletions

View File

@ -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)

View File

@ -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;
};

View File

@ -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;