2017-12-23 12:14:44 +01:00
|
|
|
Index: qtwebengine-everywhere-src-5.10.0/src/core/web_engine_context.cpp
|
2016-10-31 11:08:30 +01:00
|
|
|
===================================================================
|
2017-12-23 12:14:44 +01:00
|
|
|
--- qtwebengine-everywhere-src-5.10.0.orig/src/core/web_engine_context.cpp
|
|
|
|
+++ qtwebengine-everywhere-src-5.10.0/src/core/web_engine_context.cpp
|
|
|
|
@@ -93,6 +93,7 @@
|
2016-12-22 16:08:05 +01:00
|
|
|
#include <QOffscreenSurface>
|
2017-06-13 16:05:23 +02:00
|
|
|
#ifndef QT_NO_OPENGL
|
|
|
|
# include <QOpenGLContext>
|
|
|
|
+# include <QOpenGLFunctions>
|
|
|
|
#endif
|
|
|
|
#include <QQuickWindow>
|
2016-10-31 11:08:30 +01:00
|
|
|
#include <QStringList>
|
2017-12-23 12:14:44 +01:00
|
|
|
@@ -167,6 +168,39 @@ void dummyGetPluginCallback(const std::v
|
2016-10-31 11:08:30 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2017-06-13 16:05:23 +02:00
|
|
|
+#ifndef QT_NO_OPENGL
|
2016-10-31 11:08:30 +01:00
|
|
|
+QString openGLVendor()
|
|
|
|
+{
|
|
|
|
+ QString vendor;
|
|
|
|
+
|
|
|
|
+ QOpenGLContext *oldContext = QOpenGLContext::currentContext();
|
|
|
|
+ QSurface *oldSurface = 0;
|
|
|
|
+ if (oldContext)
|
|
|
|
+ oldSurface = oldContext->surface();
|
|
|
|
+
|
|
|
|
+ QScopedPointer<QOffscreenSurface> 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<const char *>(p));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ context.doneCurrent();
|
|
|
|
+ if (oldContext && oldSurface)
|
|
|
|
+ oldContext->makeCurrent(oldSurface);
|
|
|
|
+
|
|
|
|
+ return vendor;
|
|
|
|
+}
|
2017-06-13 16:05:23 +02:00
|
|
|
+#endif
|
2016-10-31 11:08:30 +01:00
|
|
|
+
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
namespace QtWebEngineCore {
|
2017-12-23 12:14:44 +01:00
|
|
|
@@ -378,6 +412,17 @@ WebEngineContext::WebEngineContext()
|
2017-11-04 10:22:36 +01:00
|
|
|
|
|
|
|
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()
|
2017-12-23 12:14:44 +01:00
|
|
|
@@ -389,7 +434,7 @@ WebEngineContext::WebEngineContext()
|
2017-11-04 10:22:36 +01:00
|
|
|
|| enableWebGLSoftwareRendering
|
|
|
|
#endif
|
|
|
|
)
|
|
|
|
- && !usingQtQuick2DRenderer();
|
|
|
|
+ && !usingQtQuick2DRenderer() && !disableGpu;
|
|
|
|
|
|
|
|
if (tryGL) {
|
|
|
|
if (qt_gl_global_share_context() && qt_gl_global_share_context()->isValid()) {
|