summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2022-05-11 13:32:49 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-05-18 03:57:53 +0000
commite2c04460bfc5dcc70886770e0c53faab89b4b43e (patch)
tree79afab8ba189ec819d40b6f726f0d58e823fa0b3
parenteebaf5c62da1ad3d0d7ca3143a898278e5c9de37 (diff)
Fix software backend detection
QSG hasn't parsed and set the backend yet, so we do need to duplicate the logic it will use later to make a proper detection. Fixes: QTBUG-103372 Change-Id: I542ef9f52dd2725d3ff6e17f9142786e43425ebd Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io> Reviewed-by: Michal Klocek <michal.klocek@qt.io> (cherry picked from commit 6fa8836d430d59f2350012b54f57bc246b2aa18a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/core/web_engine_context.cpp22
1 files changed, 21 insertions, 1 deletions
diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp
index cbb962707..9727efab1 100644
--- a/src/core/web_engine_context.cpp
+++ b/src/core/web_engine_context.cpp
@@ -160,7 +160,27 @@ namespace QtWebEngineCore {
static bool usingSupportedSGBackend()
{
- return QQuickWindow::graphicsApi() == QSGRendererInterface::OpenGL;
+ if (QQuickWindow::graphicsApi() != QSGRendererInterface::OpenGL)
+ return false;
+
+ const QStringList args = QGuiApplication::arguments();
+
+ // follow the logic from contextFactory in src/quick/scenegraph/qsgcontextplugin.cpp
+ QString device = QQuickWindow::sceneGraphBackend();
+
+ for (int index = 0; index < args.count(); ++index) {
+ if (args.at(index).startsWith(QLatin1String("--device="))) {
+ device = args.at(index).mid(9);
+ break;
+ }
+ }
+
+ if (device.isEmpty())
+ device = qEnvironmentVariable("QT_QUICK_BACKEND");
+ if (device.isEmpty())
+ device = qEnvironmentVariable("QMLSCENE_DEVICE");
+
+ return device.isEmpty() || device == QLatin1String("rhi");
}
bool usingSoftwareDynamicGL()