Index: qtwebengine-opensource-src-5.9.2/src/core/web_engine_context.cpp =================================================================== --- qtwebengine-opensource-src-5.9.2.orig/src/core/web_engine_context.cpp +++ qtwebengine-opensource-src-5.9.2/src/core/web_engine_context.cpp @@ -91,6 +91,7 @@ #include #ifndef QT_NO_OPENGL # include +# include #endif #include #include @@ -165,6 +166,39 @@ void dummyGetPluginCallback(const std::v } #endif +#ifndef QT_NO_OPENGL +QString openGLVendor() +{ + QString vendor; + + QOpenGLContext *oldContext = QOpenGLContext::currentContext(); + QSurface *oldSurface = 0; + if (oldContext) + oldSurface = oldContext->surface(); + + QScopedPointer surface( new QOffscreenSurface ); + surface->create(); + QOpenGLContext context; + if (!context.create()) { + qDebug() << "Error creating openGL context"; + } + else if (!context.makeCurrent(surface.data())) { + qDebug() << "Error making openGL context current context"; + } else { + const GLubyte *p; + QOpenGLFunctions *f = context.functions(); + if ((p = f->glGetString(GL_VENDOR))) + vendor = QString::fromLatin1(reinterpret_cast(p)); + } + + context.doneCurrent(); + if (oldContext && oldSurface) + oldContext->makeCurrent(oldSurface); + + return vendor; +} +#endif + } // namespace namespace QtWebEngineCore { @@ -366,6 +400,17 @@ WebEngineContext::WebEngineContext() const char *glType = 0; #ifndef QT_NO_OPENGL + bool disableGpu = qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_GPU"); + + if (!qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND") && openGLVendor() == QStringLiteral("nouveau")) + { + qWarning() << "Nouveau openGL driver detected. Qt WebEngine will disable usage of the GPU.\n" + "Note: you can set the QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND\n" + "environment variable before running this application, but this is \n" + "not recommended since this usually causes applications to crash as\n" + "Nouveau openGL drivers don't support multithreaded rendering"; + disableGpu = true; + } bool tryGL = !usingANGLE() @@ -377,7 +422,7 @@ WebEngineContext::WebEngineContext() || enableWebGLSoftwareRendering #endif ) - && !usingQtQuick2DRenderer(); + && !usingQtQuick2DRenderer() && !disableGpu; if (tryGL) { if (qt_gl_global_share_context() && qt_gl_global_share_context()->isValid()) {