aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDamian Hobson-Garcia <dhobsong@igel.co.jp>2021-03-09 17:22:26 +0900
committerDamian Hobson-Garcia <dhobsong@igel.co.jp>2021-03-17 18:39:37 +0900
commit83c248ad5c477cbe9ac5e46923b42dadfa68c6b0 (patch)
treee670d3cbe8fae903f3c78e92f3f6796e978aa69d
parent3d7b404d4e6a02f05a5c1d39a16a096b37cc506a (diff)
drm-lease: Disable weston TTY switch
When running multiple instances of weston using the drm-backend, TTY switching should be disabled, so that both instances can be displayed at the same time. Backport patches from weston upstream that will disable TTY switching when either: * Any seat other than seat0 is used (multi-seat) * There are no real TTY devices available (often true when running in a container) Also, modify the layer priority and SRC_URI append style to make these patches apply after the AGL appfw layer to avoid patch fuzz warnings during build. Bug-AGL: SPEC-3730 Change-Id: Ie9bed50b1c3f60129b1efae95aa77bfcea45f568 Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
-rw-r--r--meta-agl-drm-lease/conf/layer.conf2
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch61
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch43
-rw-r--r--meta-agl-drm-lease/recipes-graphics/weston/weston_8.0.0.bbappend5
4 files changed, 109 insertions, 2 deletions
diff --git a/meta-agl-drm-lease/conf/layer.conf b/meta-agl-drm-lease/conf/layer.conf
index 9c6d3726..a319a99f 100644
--- a/meta-agl-drm-lease/conf/layer.conf
+++ b/meta-agl-drm-lease/conf/layer.conf
@@ -6,7 +6,7 @@ BBFILES += "${LAYERDIR}/recipes-*/*/*.bb ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS += "agl-drm-lease"
BBFILE_PATTERN_agl-drm-lease = "^${LAYERDIR}/"
-BBFILE_PRIORITY_agl-drm-lease = "10"
+BBFILE_PRIORITY_agl-drm-lease = "80"
# This should only be incremented on significant changes that will
# cause compatibility issues with other layers
diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch
new file mode 100644
index 00000000..ef60bdd5
--- /dev/null
+++ b/meta-agl-drm-lease/recipes-graphics/weston/weston/0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch
@@ -0,0 +1,61 @@
+From d086d6e3bc75331048f9f235c03408c68df40457 Mon Sep 17 00:00:00 2001
+From: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+Date: Wed, 3 Jun 2020 10:01:06 -0300
+Subject: [PATCH 3/4] launcher: do not touch VT/tty while using non-default
+ seat
+
+Launcher-direct does not allow us to run using a different
+seat from the default seat0. This happens because VTs are
+only exposed to the default seat, and users that are on
+non-default seat should not touch VTs.
+
+Add check in launcher-direct to skip VT/tty management if user
+is running on a non-default seat.
+
+Signed-off-by: Leandro Ribeiro <leandro.ribeiro@collabora.com>
+(cherry picked from commit 887a7e5717275c0dec007e6128298d5956c70891)
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+---
+ libweston/launcher-direct.c | 18 +++++++++++-------
+ 1 file changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c
+index 8e21880..71c332a 100644
+--- a/libweston/launcher-direct.c
++++ b/libweston/launcher-direct.c
+@@ -303,9 +303,13 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
+ launcher->base.iface = &launcher_direct_iface;
+ launcher->compositor = compositor;
+
+- if (setup_tty(launcher, tty) == -1) {
+- free(launcher);
+- return -1;
++ if (strcmp("seat0", seat_id) == 0) {
++ if (setup_tty(launcher, tty) == -1) {
++ free(launcher);
++ return -1;
++ }
++ } else {
++ launcher->tty = -1;
+ }
+
+ * (struct launcher_direct **) out = launcher;
+@@ -317,11 +321,11 @@ launcher_direct_destroy(struct weston_launcher *launcher_base)
+ {
+ struct launcher_direct *launcher = wl_container_of(launcher_base, launcher, base);
+
+- launcher_direct_restore(&launcher->base);
+- wl_event_source_remove(launcher->vt_source);
+-
+- if (launcher->tty >= 0)
++ if (launcher->tty >= 0) {
++ launcher_direct_restore(&launcher->base);
++ wl_event_source_remove(launcher->vt_source);
+ close(launcher->tty);
++ }
+
+ free(launcher);
+ }
+--
+2.17.1
+
diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch b/meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch
new file mode 100644
index 00000000..f405e9ca
--- /dev/null
+++ b/meta-agl-drm-lease/recipes-graphics/weston/weston/0004-launcher-direct-handle-seat0-without-VTs.patch
@@ -0,0 +1,43 @@
+From 3b72ab4b5399641bb69e29464bcbd14f5f6cb6c0 Mon Sep 17 00:00:00 2001
+From: nerdopolis <bluescreen_avenger@verizon.net>
+Date: Wed, 20 Jan 2021 22:00:18 -0500
+Subject: [PATCH 4/4] launcher-direct: handle seat0 without VTs
+
+This allows launcher-direct to run when seat0 has no TTYs
+This checks for a proper /dev/tty0 device as /dev/tty0
+does not get created by kernels compiled with CONFIG_VT=n
+
+(cherry picked from commit 72db3ac694c0f84f3c193df42e81be8329e52b61)
+Signed-off-by: Damian Hobson-Garcia <dhobsong@igel.co.jp>
+---
+ libweston/launcher-direct.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/libweston/launcher-direct.c b/libweston/launcher-direct.c
+index 71c332a..840a3c5 100644
+--- a/libweston/launcher-direct.c
++++ b/libweston/launcher-direct.c
+@@ -290,6 +290,7 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
+ int tty, const char *seat_id, bool sync_drm)
+ {
+ struct launcher_direct *launcher;
++ struct stat buf;
+
+ #ifndef ENABLE_USER_START
+ if (geteuid() != 0)
+@@ -303,7 +304,11 @@ launcher_direct_connect(struct weston_launcher **out, struct weston_compositor *
+ launcher->base.iface = &launcher_direct_iface;
+ launcher->compositor = compositor;
+
+- if (strcmp("seat0", seat_id) == 0) {
++ /* Checking the existance of /dev/tty0 and verifying it's a TTY
++ * device, as kernels compiled with CONFIG_VT=0 do not create these
++ * devices. */
++ if (stat("/dev/tty0", &buf) == 0 &&
++ strcmp("seat0", seat_id) == 0 && major(buf.st_rdev) == TTY_MAJOR) {
+ if (setup_tty(launcher, tty) == -1) {
+ free(launcher);
+ return -1;
+--
+2.17.1
+
diff --git a/meta-agl-drm-lease/recipes-graphics/weston/weston_8.0.0.bbappend b/meta-agl-drm-lease/recipes-graphics/weston/weston_8.0.0.bbappend
index 97de8c62..74ee94c1 100644
--- a/meta-agl-drm-lease/recipes-graphics/weston/weston_8.0.0.bbappend
+++ b/meta-agl-drm-lease/recipes-graphics/weston/weston_8.0.0.bbappend
@@ -1,7 +1,10 @@
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
-SRC_URI += "file://0001-backend-drm-Add-method-to-import-DRM-fd.patch \
+SRC_URI_append = " \
+ file://0001-backend-drm-Add-method-to-import-DRM-fd.patch \
file://0002-Add-DRM-lease-support.patch \
+ file://0003-launcher-do-not-touch-VT-tty-while-using-non-default.patch \
+ file://0004-launcher-direct-handle-seat0-without-VTs.patch \
"
PACKAGECONFIG[drm-lease] = "-Ddrm-lease=true,-Ddrm-lease=false,drm-lease-manager"