aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2021-01-02 20:28:14 +0100
committerLaszlo Agocs <laszlo.agocs@qt.io>2021-01-05 17:41:48 +0100
commitb23b12dcad8b204e490ea68be31c693d7d809a5b (patch)
tree8e0d66ef7a1b20251ccd950ba6153db85fb60166
parent7af08ac85a34b4ab03bf984ffb19dac0b67d46a1 (diff)
Make software backend fallback automatic with vnc and similar
Change-Id: I3ce4494e9dddc9bf933793b354dc43494b3c84ef Fixes: QTBUG-89561 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
-rw-r--r--src/quick/scenegraph/qsgcontextplugin.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/quick/scenegraph/qsgcontextplugin.cpp b/src/quick/scenegraph/qsgcontextplugin.cpp
index 2956c8c438..288d16f743 100644
--- a/src/quick/scenegraph/qsgcontextplugin.cpp
+++ b/src/quick/scenegraph/qsgcontextplugin.cpp
@@ -144,6 +144,18 @@ QSGAdaptationBackendData *contextFactory()
requestedBackend = QLatin1String("software");
#endif
+ // As an exception to the above, play nice with platform plugins like
+ // vnc or linuxfb: Trying to initialize a QRhi is futile on these, and
+ // Qt 5 had an explicit fallback to the software backend, based on the
+ // OpenGL capability. Replicate that behavior using the new
+ // RhiBasedRendering capability flag, which, on certain platforms,
+ // indicates that we should not even bother trying to initialize a QRhi
+ // as no 3D API can be expected work.
+ if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RhiBasedRendering)) {
+ if (requestedBackend.isEmpty())
+ requestedBackend = QLatin1String("software");
+ }
+
// This is handy if some of the logic above goes wrong and we select
// e.g. the software backend when it is not desired.
if (requestedBackend == QLatin1String("rhi"))