1
0
libqt5-qtwebengine/disable-gpu-when-using-nouveau-boo-1005323.diff
Dominique Leuenberger c1868c9a48 Accepting request 712126 from KDE:Qt:5.13
- Update to 5.13.0:
  * New bugfix release
  * No changelog available
  * For more details about Qt 5.13 please see:
  * http://code.qt.io/cgit/qt/qtwebengine.git/plain/dist/changes-5.13.0/?h=5.13

- Replace open coded macro for parallel build limit by the one from the
  memory-constraints package

- Update to 5.13.0-rc:
  * New bugfix release
  * No changelog available

- Fix system_vpx bcond

- Update to 5.13.0-beta2:
  * New bugfix release
  * No changelog available
- Refresh patches:
  * harmony-fix.diff
  * chromium-non-void-return.patch (sigh, again)
- Fix system_vpx bcond
- Disable using the system ICU on Leap < 16, too old

- Update to 5.13.0-beta1:
  * New feature release
  * For more details about Qt 5.13 please see:
  * http://code.qt.io/cgit/qt/qtwebengine.git/plain/dist/changes-5.13.0/?h=5.13
- Refresh patches:
  * disable-gpu-when-using-nouveau-boo-1005323.diff

OBS-URL: https://build.opensuse.org/request/show/712126
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtwebengine?expand=0&rev=46
2019-06-28 14:32:13 +00:00

95 lines
3.8 KiB
Diff

From: Antonio Larrosa <alarrosa@suse.com>
Subject: Disable GPU when using nouveau or running on wayland
References: boo#1005323, boo#1060990
Qt WebEngine uses multi-threaded OpenGL, which nouveau does not support.
It also crashes when running on wayland, the cause is not yet known.
Work around these issues by not doing GPU-accelerated rendering in such
cases.
Index: qtwebengine-everywhere-src-5.13.0-beta1/src/core/web_engine_context.cpp
===================================================================
--- qtwebengine-everywhere-src-5.13.0-beta1.orig/src/core/web_engine_context.cpp
+++ qtwebengine-everywhere-src-5.13.0-beta1/src/core/web_engine_context.cpp
@@ -108,6 +108,7 @@
#include <QOffscreenSurface>
#ifndef QT_NO_OPENGL
# include <QOpenGLContext>
+# include <QOpenGLFunctions>
#endif
#include <QQuickWindow>
#include <QStringList>
@@ -167,6 +168,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<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;
+}
+#endif
+
} // namespace
namespace QtWebEngineCore {
@@ -501,10 +535,31 @@ WebEngineContext::WebEngineContext()
const char *glType = 0;
#ifndef QT_NO_OPENGL
+ bool disableGpu = qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_GPU");
+
+ if (!qEnvironmentVariableIsSet("QT_WEBENGINE_DISABLE_WAYLAND_WORKAROUND") && qApp->platformName().startsWith("wayland", Qt::CaseInsensitive))
+ {
+ qWarning() << "Running on wayland. Qt WebEngine will disable usage of the GPU.\n"
+ "Note: you can set the QT_WEBENGINE_DISABLE_WAYLAND_WORKAROUND\n"
+ "environment variable before running this application, but this is \n"
+ "not recommended since this usually causes applications to crash.";
+ disableGpu = true;
+ }
+
+ 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;
+ }
+
const bool tryGL = (usingDefaultSGBackend() && !usingSoftwareDynamicGL() &&
QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|| enableGLSoftwareRendering;
- if (tryGL) {
+ if (tryGL && !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.