From 12b93337d1cc12f4523009d0a687eaf907089de1 Mon Sep 17 00:00:00 2001 From: Cameron Gutman Date: Sat, 1 Jun 2024 22:43:52 -0500 Subject: [PATCH] Fix SDL_VIDEODRIVER override when the Qt platform plugin was manually set --- app/main.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/main.cpp b/app/main.cpp index 50c0e813..e9edb16e 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -388,7 +388,6 @@ int main(int argc, char *argv[]) if (!qEnvironmentVariableIsSet("QT_QPA_PLATFORM")) { qInfo() << "Unable to detect Wayland or X11, so EGLFS will be used by default. Set QT_QPA_PLATFORM to override this."; qputenv("QT_QPA_PLATFORM", "eglfs"); - qputenv("SDL_VIDEODRIVER", "kmsdrm"); if (!qEnvironmentVariableIsSet("QT_QPA_EGLFS_ALWAYS_SET_MODE")) { qInfo() << "Setting display mode by default. Set QT_QPA_EGLFS_ALWAYS_SET_MODE=0 to override this."; @@ -546,6 +545,14 @@ int main(int argc, char *argv[]) QGuiApplication app(argc, argv); +#ifndef STEAM_LINK + // Force use of the KMSDRM backend for SDL when using Qt platform plugins + // that directly draw to the display without a windowing system. + if (QGuiApplication::platformName() == "eglfs" || QGuiApplication::platformName() == "linuxfb") { + qputenv("SDL_VIDEODRIVER", "kmsdrm"); + } +#endif + GlobalCommandLineParser parser; GlobalCommandLineParser::ParseResult commandLineParserResult = parser.parse(app.arguments()); switch (commandLineParserResult) {