20 Star 0 Fork 21

openEuler-RISC-V / qt5-qtwebengine

forked from src-openEuler / qt5-qtwebengine 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
disable-gpu-when-using-nouveau-boo-1005323.patch 3.77 KB
一键复制 编辑 原始数据 按行查看 历史
Jingwiw 提交于 2022-05-28 09:00 . update to 5.15.9 and add riscv support
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.15.1/src/core/web_engine_context.cpp
===================================================================
--- qtwebengine-everywhere-src-5.15.1.orig/src/core/web_engine_context.cpp
+++ qtwebengine-everywhere-src-5.15.1/src/core/web_engine_context.cpp
@@ -127,6 +127,7 @@
#include <QOffscreenSurface>
#if QT_CONFIG(opengl)
# include <QOpenGLContext>
+# include <QOpenGLFunctions>
#endif
#include <QQuickWindow>
#include <QStringList>
@@ -186,6 +187,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 {
@@ -697,10 +731,31 @@ WebEngineContext::WebEngineContext()
const char *glType = 0;
#if QT_CONFIG(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.
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler-risc-v/qt5-qtwebengine.git
git@gitee.com:openeuler-risc-v/qt5-qtwebengine.git
openeuler-risc-v
qt5-qtwebengine
qt5-qtwebengine
master

搜索帮助

344bd9b3 5694891 D2dac590 5694891