aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnaud Ferraris <arnaud.ferraris@collabora.com>2021-12-06 19:15:55 +0100
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2021-12-08 13:04:08 +0000
commitccaedc3d351273f39ee4af773a627de5bbe9e642 (patch)
treeb24c2b2c2b24d2babbc061237778f269e3678fae
parent6a76ace5052a86b382c05649da802094f491e031 (diff)
weston: allow weston to be started from a systemd user session
As part of the App FW rework, we want weston to be started from a systemd user session, which is allowed by this patch (backported from upstream). Bug-AGL: SPEC-4161 Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com> Change-Id: I23961eaebb65bdbdcfd8c3d01ff1941f978385ec Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/26968 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Scott Murray <scott.murray@konsulko.com> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
-rw-r--r--meta-agl-core/recipes-graphics/wayland/weston/0002-Allow-weston-to-start-from-a-systemd-user-session.patch75
-rw-r--r--meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc1
2 files changed, 76 insertions, 0 deletions
diff --git a/meta-agl-core/recipes-graphics/wayland/weston/0002-Allow-weston-to-start-from-a-systemd-user-session.patch b/meta-agl-core/recipes-graphics/wayland/weston/0002-Allow-weston-to-start-from-a-systemd-user-session.patch
new file mode 100644
index 000000000..d45f93a9b
--- /dev/null
+++ b/meta-agl-core/recipes-graphics/wayland/weston/0002-Allow-weston-to-start-from-a-systemd-user-session.patch
@@ -0,0 +1,75 @@
+From b6c891774e23762d6289447ab588bf739a55f628 Mon Sep 17 00:00:00 2001
+From: Derek Foreman <derek.foreman@collabora.com>
+Date: Thu, 15 Jul 2021 12:22:49 -0500
+Subject: [PATCH] launcher-logind: Try the user's primary session if not in a
+ session
+
+If we're not in a session we can fall back to sd_uid_get_display() to
+find the user's primary session.
+
+This allows launching weston from an ssh session or as a systemd
+user service if a viable session is available.
+
+It also more closely follows how libseat finds the session. The libseat
+launcher can already do these things, so this change makes these
+features common to both launchers.
+
+Based on a patch by Sjoerd Simons <sjoerd.simons@collabora.com>
+
+Upstream-Status: Accepted (to be released with weston 10.0.0)
+
+Signed-off-by: Derek Foreman <derek.foreman@collabora.com>
+---
+ libweston/launcher-logind.c | 29 +++++++++++++++++++++++++----
+ 1 file changed, 25 insertions(+), 4 deletions(-)
+
+diff --git a/libweston/launcher-logind.c b/libweston/launcher-logind.c
+index 993d8e1a2..3fca1dff6 100644
+--- a/libweston/launcher-logind.c
++++ b/libweston/launcher-logind.c
+@@ -734,6 +734,29 @@ launcher_logind_activate(struct launcher_logind *wl)
+ return 0;
+ }
+
++static int
++launcher_logind_get_session(char **session)
++{
++ int r;
++
++ r = sd_pid_get_session(getpid(), session);
++ if (r < 0) {
++ if (r != -ENODATA) {
++ weston_log("logind: not running in a systemd session: %d\n", r);
++ return r;
++ }
++ } else {
++ return r;
++ }
++
++ /* When not inside a systemd session look if there is a suitable one */
++ r = sd_uid_get_display(getuid(), session);
++ if (r < 0)
++ weston_log("logind: cannot find systemd session for uid: %d %d\n", getuid(), r);
++
++ return r;
++}
++
+ static int
+ launcher_logind_connect(struct weston_launcher **out, struct weston_compositor *compositor,
+ int tty, const char *seat_id, bool sync_drm)
+@@ -759,11 +782,9 @@ launcher_logind_connect(struct weston_launcher **out, struct weston_compositor *
+ goto err_wl;
+ }
+
+- r = sd_pid_get_session(getpid(), &wl->sid);
+- if (r < 0) {
+- weston_log("logind: not running in a systemd session\n");
++ r = launcher_logind_get_session(&wl->sid);
++ if (r < 0)
+ goto err_seat;
+- }
+
+ t = NULL;
+ r = sd_session_get_seat(wl->sid, &t);
+--
+GitLab
diff --git a/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc b/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc
index 598215e7e..06a1c830f 100644
--- a/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc
+++ b/meta-agl-core/recipes-graphics/wayland/weston_8.0_aglcore.inc
@@ -1,6 +1,7 @@
FILESEXTRAPATHS:append := ":${THISDIR}/weston"
SRC_URI:append = "\
+ file://0002-Allow-weston-to-start-from-a-systemd-user-session.patch \
file://0005-correctly-tear-down-drm-backend.patch \
"