make hide wayland sessions directly dependent on /dev/dri

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
epel9
Jeremy Linton 3 years ago committed by Adam Williamson
parent 6721293c8b
commit 52dc921f03

@ -1,3 +0,0 @@
# disable Wayland if modesetting is disabled
ACTION=="add", SUBSYSTEM=="mem", KERNEL=="zero", RUN+="/usr/bin/touch /etc/sddm/hide-wayland-sessions"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card[0-9]", RUN+="/usr/bin/rm -f /etc/sddm/hide-wayland-sessions"

@ -1,18 +1,19 @@
From 2e2ba14e8a74ea7834f797e30b130b35fa5f2e0f Mon Sep 17 00:00:00 2001 From 0b5040a887459a974bb4a3a4512a8392daa0eb66 Mon Sep 17 00:00:00 2001
From: Neal Gompa <ngompa13@gmail.com> From: Jeremy Linton <jeremy.linton@arm.com>
Date: Thu, 22 Apr 2021 22:45:41 -0400 Date: Mon, 25 Oct 2021 14:56:14 -0500
Subject: [PATCH] greeter: Do not populate Wayland sessions if they are to be Subject: [PATCH] greeter: Do not populate Wayland sessions if they are to be
hidden hidden
Check for a file on disk that indicates that the Wayland sessions Check for /dev/dri which should indicate that the Wayland will work
are to be hidden. This is useful for cases where it has been on this hardware.
determined automatically that the system cannot run Wayland sessions.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
--- ---
src/greeter/SessionModel.cpp | 14 ++++++++++---- src/greeter/SessionModel.cpp | 12 ++++++++++--
1 file changed, 10 insertions(+), 4 deletions(-) 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp diff --git a/src/greeter/SessionModel.cpp b/src/greeter/SessionModel.cpp
index 1953c76..36ccc22 100644 index 1953c76..b1f3296 100644
--- a/src/greeter/SessionModel.cpp --- a/src/greeter/SessionModel.cpp
+++ b/src/greeter/SessionModel.cpp +++ b/src/greeter/SessionModel.cpp
@@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
@ -23,38 +24,34 @@ index 1953c76..36ccc22 100644
#include <QVector> #include <QVector>
#include <QProcessEnvironment> #include <QProcessEnvironment>
#include <QFileSystemWatcher> #include <QFileSystemWatcher>
@@ -39,22 +40,27 @@ namespace SDDM { @@ -39,18 +40,25 @@ namespace SDDM {
}; };
SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) { SessionModel::SessionModel(QObject *parent) : QAbstractListModel(parent), d(new SessionModelPrivate()) {
+ // Check for flag to hide Wayland sessions + // Check for flag to hide Wayland sessions
+ bool waylandHiddenFlag = QFileInfo::exists(QStringLiteral("/etc/sddm/hide-wayland-sessions")); + bool dri_active = QFileInfo::exists(QStringLiteral("/dev/dri"));
+
// initial population // initial population
beginResetModel(); beginResetModel();
- populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); - populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
+ if (!waylandHiddenFlag) + if (dri_active)
+ populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); + populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
populate(Session::X11Session, mainConfig.X11.SessionDir.get()); populate(Session::X11Session, mainConfig.X11.SessionDir.get());
endResetModel(); endResetModel();
// refresh everytime a file is changed, added or removed // refresh everytime a file is changed, added or removed
QFileSystemWatcher *watcher = new QFileSystemWatcher(this); QFileSystemWatcher *watcher = new QFileSystemWatcher(this);
- connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path) { connect(watcher, &QFileSystemWatcher::directoryChanged, [this](const QString &path) {
+ connect(watcher, &QFileSystemWatcher::directoryChanged, [waylandHiddenFlag, this](const QString &path) { + // Recheck for flag to hide Wayland sessions
+ bool dri_active = QFileInfo::exists(QStringLiteral("/dev/dri"));
beginResetModel(); beginResetModel();
d->sessions.clear(); d->sessions.clear();
- populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); - populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
+ if (!waylandHiddenFlag) + if (dri_active)
+ populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get()); + populate(Session::WaylandSession, mainConfig.Wayland.SessionDir.get());
populate(Session::X11Session, mainConfig.X11.SessionDir.get()); populate(Session::X11Session, mainConfig.X11.SessionDir.get());
endResetModel(); endResetModel();
}); });
- watcher->addPath(mainConfig.Wayland.SessionDir.get());
+ if (!waylandHiddenFlag)
+ watcher->addPath(mainConfig.Wayland.SessionDir.get());
watcher->addPath(mainConfig.X11.SessionDir.get());
}
-- --
2.31.1 2.32.0

@ -67,8 +67,6 @@ Source14: sddm.conf
Source15: README.scripts Source15: README.scripts
# sysconfig snippet # sysconfig snippet
Source16: sddm.sysconfig Source16: sddm.sysconfig
# udev rules for disabling plasma-wayland in broken scenarios
Source17: 61-sddm-plasmawayland.rules
# systemd sysusers config # systemd sysusers config
Source18: sddm-systemd-sysusers.conf Source18: sddm-systemd-sysusers.conf
@ -170,12 +168,6 @@ cp -a %{buildroot}%{_datadir}/sddm/scripts/* \
# we're using /etc/X11/xinit/Xsession (by default) instead # we're using /etc/X11/xinit/Xsession (by default) instead
rm -fv %{buildroot}%{_sysconfdir}/sddm/Xsession rm -fv %{buildroot}%{_sysconfdir}/sddm/Xsession
# Add auto-fallback hack for when modesetting isn't available (#1952431)
install -Dpm 644 %{SOURCE17} %{buildroot}%{_udevrulesdir}/61-sddm-plasmawayland.rules
# ghost file for runtime wayland session hide flag
touch %{buildroot}%{_sysconfdir}/sddm/hide-wayland-sessions
%pre %pre
%sysusers_create_compat %{SOURCE18} %sysusers_create_compat %{SOURCE18}
@ -239,8 +231,6 @@ fi
%{_bindir}/sddm-greeter %{_bindir}/sddm-greeter
%{_libexecdir}/sddm-helper %{_libexecdir}/sddm-helper
%{_tmpfilesdir}/sddm.conf %{_tmpfilesdir}/sddm.conf
%{_udevrulesdir}/61-sddm-plasmawayland.rules
%ghost %{_sysconfdir}/sddm/hide-wayland-sessions
%{_sysusersdir}/sddm.conf %{_sysusersdir}/sddm.conf
%attr(0711, root, sddm) %dir /run/sddm %attr(0711, root, sddm) %dir /run/sddm
%attr(1770, sddm, sddm) %dir %{_localstatedir}/lib/sddm %attr(1770, sddm, sddm) %dir %{_localstatedir}/lib/sddm

Loading…
Cancel
Save