[vlc-commits] [Git][videolan/vlc][master] qt: x11: fix not considering software mode at initialization

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Mar 16 19:11:36 UTC 2026



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
5e140d9b by Fatih Uzunoglu at 2026-03-16T18:40:39+00:00
qt: x11: fix not considering software mode at initialization

We currently support Qt's own software renderer
in X11 video integration since e51fdd5c.

Currently this bug is asymptomatic because setting
setting `QT_QUICK_BACKEND=software` does not make
`QQuickWindow::graphicsApi()` return
`QSGRendererInterface::Software` since the window
is not initialized when the compositor initializes.
So, even though software mode is active, the check
here reports the default (OpenGL) and passes.

- - - - -


1 changed file:

- modules/gui/qt/maininterface/compositor_x11.cpp


Changes:

=====================================
modules/gui/qt/maininterface/compositor_x11.cpp
=====================================
@@ -96,11 +96,27 @@ bool CompositorX11::init()
         return false;
     }
 
-    if (QQuickWindow::graphicsApi() != QSGRendererInterface::OpenGL)
+    const QString& sceneGraphBackend = qEnvironmentVariable("QT_QUICK_BACKEND");
+    if (!sceneGraphBackend.isEmpty() /* if empty, RHI is used */ &&
+        sceneGraphBackend != QLatin1String("rhi") &&
+        sceneGraphBackend != QLatin1String("software"))
     {
-        msg_Warn(m_intf, "Running on X11, but graphics api is not OpenGL." \
-                         "CompositorX11 only supports OpenGL for now.\n" \
-                         "FIXME: Support vulkan as well.");
+        // No RHI means no OpenGL, the graphics API check below is
+        // only relevant when RHI is in use. If QT_QUICK_BACKEND is
+        // set to software or openvg, then `QQuickWindow::graphicsApi()`
+        // might still report OpenGL until the scene graph is initialized.
+        // Unlike `QQuickWindow::graphicsApi()`, `sceneGraphBackend()`
+        // is only valid after the window is constructed, so instead
+        // of using `QQuickWindow::sceneGraphBackend()`, simply probe
+        // the environment variable.
+        return false;
+    }
+
+    const auto graphicsApi = QQuickWindow::graphicsApi();
+    if (graphicsApi != QSGRendererInterface::OpenGL &&
+        graphicsApi != QSGRendererInterface::Software)
+    {
+        msg_Warn(m_intf, "CompositorX11: Only software mode and rhi opengl are supported!");
         return false;
     }
 



View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5e140d9b8dcbee3934c6bd75cb14a62f39cc1884

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/5e140d9b8dcbee3934c6bd75cb14a62f39cc1884
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list