2016-10-31 11:08:30 +01:00
|
|
|
Index: qtwebengine-opensource-src-5.7.1/src/core/web_engine_context.cpp
|
|
|
|
===================================================================
|
|
|
|
--- qtwebengine-opensource-src-5.7.1.orig/src/core/web_engine_context.cpp
|
|
|
|
+++ qtwebengine-opensource-src-5.7.1/src/core/web_engine_context.cpp
|
2016-12-22 16:08:05 +01:00
|
|
|
@@ -88,6 +88,7 @@
|
2016-10-31 11:08:30 +01:00
|
|
|
#include <QGuiApplication>
|
2016-12-22 16:08:05 +01:00
|
|
|
#include <QOffscreenSurface>
|
2016-10-31 11:08:30 +01:00
|
|
|
#include <QOpenGLContext>
|
|
|
|
+#include <QOpenGLFunctions>
|
|
|
|
#include <QStringList>
|
2016-12-22 16:08:05 +01:00
|
|
|
#include <QSurfaceFormat>
|
2016-10-31 11:08:30 +01:00
|
|
|
#include <QVector>
|
2016-12-22 16:08:05 +01:00
|
|
|
@@ -162,6 +163,37 @@ void dummyGetPluginCallback(const std::v
|
2016-10-31 11:08:30 +01:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+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;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
} // namespace
|
|
|
|
|
|
|
|
namespace QtWebEngineCore {
|
2016-12-22 16:08:05 +01:00
|
|
|
@@ -309,8 +341,20 @@ WebEngineContext::WebEngineContext()
|
|
|
|
|
2016-10-31 11:08:30 +01:00
|
|
|
GLContextHelper::initialize();
|
2016-12-22 16:08:05 +01:00
|
|
|
|
2016-10-31 11:08:30 +01:00
|
|
|
+ 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"
|
2016-12-22 16:08:05 +01:00
|
|
|
+ "Note: you can set the QT_WEBENGINE_DISABLE_NOUVEAU_WORKAROUND\n"
|
2016-10-31 11:08:30 +01:00
|
|
|
+ "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;
|
|
|
|
+ }
|
|
|
|
+
|
2016-12-22 16:08:05 +01:00
|
|
|
const char *glType = 0;
|
|
|
|
- if (!usingANGLE() && !usingSoftwareDynamicGL() && !usingQtQuick2DRenderer()) {
|
|
|
|
+ if (!usingANGLE() && !usingSoftwareDynamicGL() && !usingQtQuick2DRenderer() && !disableGpu) {
|
|
|
|
if (qt_gl_global_share_context() && qt_gl_global_share_context()->isValid()) {
|
|
|
|
// If the native handle is QEGLNativeContext try to use GL ES/2, if there is no native handle
|
|
|
|
// assume we are using wayland and try GL ES/2, and finally Ozone demands GL ES/2 too.
|