libqt5-qtwebengine/disable-gpu-when-using-nouveau-boo-1005323.diff
Dominique Leuenberger d1b9b593e1 Accepting request 500324 from KDE:Qt5
- Remove patch that is apparently not enough for aarch64:
  * gn-add-aarch64.patch

- Update descriptions.
- Use find -exec's "+" strategy.

- Update to 5.9.0 final

- Disable usage of system ICU on TW as ICU 59 is not supported
  and patches do not apply

- Update to 5.9.0 RC:
  * For more details please see: 
    http://lists.qt-project.org/pipermail/announce/2017-May/000115.html
    and https://wiki.qt.io/New_Features_in_Qt_5.9
- Remove patches, now upstream:
  * fix-chromium-gcc7.patch
  * use-fno-delete-null-pointer-checks-with-gcc-6.diff
  * webrtc-build-with-neon.patch
- Refresh patches:
  * armv6-ffmpeg-no-thumb.patch
  * disable-gpu-when-using-nouveau-boo-1005323.diff
- Support new build system, which does not support manual unbundling
  anymore
- Add patch to allow building on aarch64:
  * gn-add-aarch64.patch
- Reorder rpm sections

OBS-URL: https://build.opensuse.org/request/show/500324
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/libqt5-qtwebengine?expand=0&rev=19
2017-06-13 14:05:23 +00:00

78 lines
2.9 KiB
Diff

Index: qtwebengine-opensource-src-5.9.0-beta4/src/core/web_engine_context.cpp
===================================================================
--- qtwebengine-opensource-src-5.9.0-beta4.orig/src/core/web_engine_context.cpp
+++ qtwebengine-opensource-src-5.9.0-beta4/src/core/web_engine_context.cpp
@@ -90,6 +90,7 @@
#include <QOffscreenSurface>
#ifndef QT_NO_OPENGL
# include <QOpenGLContext>
+# include <QOpenGLFunctions>
#endif
#include <QQuickWindow>
#include <QStringList>
@@ -177,6 +178,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 {
@@ -339,9 +373,23 @@ WebEngineContext::WebEngineContext()
GLContextHelper::initialize();
+#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;
+ }
+#endif
+
const char *glType = 0;
#ifndef QT_NO_OPENGL
- 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.