Christophe Giboudeaux 2022-09-15 11:41:45 +00:00 committed by Git OBS Bridge
parent a878f44f00
commit 4213784a76
5 changed files with 14 additions and 108 deletions

View File

@ -1,96 +0,0 @@
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.
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index c9f82c31..0f92e3de 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -133,6 +133,7 @@
#include <QOffscreenSurface>
#if QT_CONFIG(opengl)
# include <QOpenGLContext>
+# include <QOpenGLFunctions>
# include <qopenglcontext_platform.h>
#endif
#include <QQuickWindow>
@@ -206,11 +207,33 @@ bool usingSoftwareDynamicGL()
static const char *getGLType(bool enableGLSoftwareRendering)
{
const char *glType = nullptr;
+
+ 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()) {
qWarning("WebEngineContext used before QtWebEngineCore::initialize() or OpenGL context "
"creation failed.");
@@ -914,6 +937,39 @@ base::CommandLine* WebEngineContext::commandLine() {
}
}
+#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
QT_BEGIN_NAMESPACE

View File

@ -1,3 +1,11 @@
-------------------------------------------------------------------
Fri Sep 9 12:41:52 UTC 2022 - Christophe Giboudeaux <christophe@krop.fr>
- Update to 6.3.2:
* https://www.qt.io/blog/qt-6.3.2-released
- Drop disable-gpu-when-using-nouveau-boo-1005323.diff
Patch was not updated for Qt6
-------------------------------------------------------------------
Mon Aug 8 12:03:18 UTC 2022 - Stephan Kulow <coolo@suse.com>

View File

@ -1,5 +1,5 @@
#
# spec file for qt6-webengine
# spec file for package qt6-webengine
#
# Copyright (c) 2022 SUSE LLC
#
@ -16,7 +16,7 @@
#
%define real_version 6.3.1
%define real_version 6.3.2
%define short_version 6.3
%define tar_name qtwebengine-everywhere-src
%define tar_suffix %{nil}
@ -42,7 +42,7 @@
%bcond_without system_minizip
#
Name: qt6-webengine%{?pkg_suffix}
Version: 6.3.1
Version: 6.3.2
Release: 0
Summary: Web browser engine for Qt applications
License: GPL-2.0-only OR LGPL-3.0-only OR GPL-3.0-only
@ -52,12 +52,6 @@ Source99: qt6-webengine-rpmlintrc
# Patches 0-100 are upstream patches #
# Patches 100-200 are openSUSE and/or non-upstream(able) patches #
Patch100: rtc-dont-use-h264.patch
# PATCH-FIX-OPENSUSE -- disable-gpu-when-using-nouveau-boo-1005323.diff
# PATCH-NEEDS-REBASE
%if 0
Patch101: disable-gpu-when-using-nouveau-boo-1005323.diff
%endif
#
# Chromium/blink don't support PowerPC and zSystems and build fails on
# 32 bits archs (https://bugreports.qt.io/browse/QTBUG-102143)
ExclusiveArch: aarch64 x86_64 riscv64

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ad7a33b21a956deda37c587d50f821ca3816403ae31ba9b5d59d01561ad66e47
size 398269544

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:65b4397f451650226142f35c8d6c6ebc45cee461b1c2d17d688208d455e24426
size 398294888