Skip to contentSkip to conversation

Rootless Weston and Weston patch cleanup

PATCH New [email protected] 1 participant 8 messages May 24, 2023

lore
Share & tools
lore
#0 lore raw

cover Rootless Weston and Weston patch cleanup

From: Randolph Sapp <[email protected]>

Running Weston as root is generally a bad idea and currently breaks interactions with the dbus interface and a handful of applications with this newer version of Weston. Let's roll everything back to using the standard weston-init package with some appends for those users running touchscreens.

This also cleans up a lot of lingering patches from dunfell for Weston which are no longer applicable.

Randolph Sapp (7):
weston-init: drop all the old append logic
weston: drop Fix-touch-screen-crash patch
weston: drop allow-visual_id-to-be-0 patch
weston: add notice about select-plane patch
weston: add weston user to the render group
weston: drop the fix-virtual-keyboard-display-issue patch
weston-init: add a simple touchscreen calibration check

 .../wayland/weston-init.bbappend              |  15 +-
 .../recipes-graphics/wayland/weston-init/init | 129 ------------------
 .../wayland/weston-init/runWeston             |  39 ------
 .../wayland/weston-init/ti43x/weston.ini      |  16 ---
 .../wayland/weston-init/wayland_env.sh        |  12 --
 .../weston-init/weston-launch-calibrator.sh   |  13 ++
 .../wayland/weston-init/weston.ini            |   8 ++
 .../0002-weston-Allow-visual_id-to-be-0.patch |  34 -----
 ...al-keyboard-display-issue-for-QT5-ap.patch |  41 ------
 ...-weston-Fix-touch-screen-crash-issue.patch |  39 ------
 .../wayland/weston_10.0.2.bbappend            |  13 +-
 11 files changed, 34 insertions(+), 325 deletions(-)
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/init
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/runWeston
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/ti43x/weston.ini
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/wayland_env.sh
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0002-weston-Allow-visual_id-to-be-0.patch
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0004-weston-Fix-touch-screen-crash-issue.patch
Signature · 1 line
2.40.1
#1 lore raw

PATCH 1/7 weston-init: drop all the old append logic

From: Randolph Sapp <[email protected]>

First step in non-root weston.

Drop the following files:
- weston-init/init
- weston-init/runWeston
- weston-init/ti43x/weston.ini
- weston-init/wayland_env.sh

We previously had some append logic to remove the systemd-service because people were only updating the sysVinit script, and the sysVinit script was updated to include touch screen calibration logic. Now we can drop this as weston now has it's own calibration routine per user.

In addition to this, this append file also introduced a runWeston wrapper and a wayland_env script to setup environment variables for the root user weston instance, all of which is now unnecessary as root weston is generally not a good idea.

This append now only serves to offer a new weston.ini file to the existing weston-init package with the hooks for libinput to create and apply touchscreen calibrations for individual users.

---
 .../wayland/weston-init.bbappend              |  22 +--
 .../recipes-graphics/wayland/weston-init/init | 129 ------------------
 .../wayland/weston-init/runWeston             |  39 ------
 .../wayland/weston-init/ti43x/weston.ini      |  16 ---
 .../wayland/weston-init/wayland_env.sh        |  12 --
 .../wayland/weston-init/weston.ini            |   4 +
 6 files changed, 7 insertions(+), 215 deletions(-)
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/init
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/runWeston
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/ti43x/weston.ini
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/wayland_env.sh
meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend +3 -19
index 28e7ae39..a73b669d 100644
@@ -2,22 +2,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
 PR:append = ".arago12"
 
-SRC_URI:append = " \
-    file://runWeston \
-    file://wayland_env.sh \
-    file://weston.ini \
-"
-
-do_install:append() {
-    install -d ${D}${bindir}
-    install -m 755 ${WORKDIR}/runWeston ${D}${bindir}
-    rm -rf ${D}${systemd_system_unitdir}
-
-    install -d ${D}${sysconfdir}/profile.d
-    install -m 0644 ${WORKDIR}/weston.ini ${D}${sysconfdir}
-    install -m 0644 ${WORKDIR}/wayland_env.sh ${D}${sysconfdir}/profile.d/
-}
-
-FILES:${PN}:remove = "${systemd_system_unitdir}/weston.service ${systemd_system_unitdir}/weston.socket"
-FILES:${PN} += "${sysconfdir}/profile.d/* ${sysconfdir}/weston.ini"
-SYSTEMD_SERVICE:${PN}:remove = "weston.service weston.socket"
+#SRC_URI:append = " \
+#    file://weston.ini \
+#"
meta-arago-distro/recipes-graphics/wayland/weston-init/init deleted +0 -129

129 lines not on this page · raw message

meta-arago-distro/recipes-graphics/wayland/weston-init/runWeston deleted +0 -39
deleted file mode 100644
index aed5d5f9..00000000
@@ -1,39 +0,0 @@
-#!/bin/sh
-
-clear
-cat << EOF
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-                                        Please wait...
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-EOF
-
-weston --idle-time=0 >> /var/log/weston.log 2>&1
meta-arago-distro/recipes-graphics/wayland/weston-init/ti43x/weston.ini deleted +0 -16
deleted file mode 100644
index 8a9dd998..00000000
@@ -1,16 +0,0 @@
-[core]
-require-input=false
-
-[shell]
-locking=false
-animation=zoom
-panel-position=top
-startup-animation=fade
-
-[screensaver]
-# Uncomment path to disable screensaver
-#path=@libexecdir@/weston-screensaver
-
-[output]
-name=HDMI-A-1
-mode=1024x768
meta-arago-distro/recipes-graphics/wayland/weston-init/wayland_env.sh deleted +0 -12
deleted file mode 100644
index 50979b30..00000000
@@ -1,12 +0,0 @@
-#!/bin/sh
-
-### Wayland Environment Variables ###
-
-export XDG_CONFIG_HOME=/etc/
-export XDG_RUNTIME_DIR=/tmp/${UID}-runtime-dir
-export WS_CALUDEV_FILE=/etc/udev/rules.d/ws-calibrate.rules
-
-if ! test -d "${XDG_RUNTIME_DIR}"; then
-       mkdir -p "${XDG_RUNTIME_DIR}"
-       chmod 0700 "${XDG_RUNTIME_DIR}"
-fi
meta-arago-distro/recipes-graphics/wayland/weston-init/weston.ini +4 -0
index c0ae9f92..4cc2683a 100644
@@ -1,4 +1,5 @@
 [core]
+idle-time=0
 require-input=false
 
 [shell]
@@ -7,6 +8,9 @@ animation=zoom
 panel-position=top
 startup-animation=fade
 
+[libinput]
+touchscreen_calibrator=true
+
 [screensaver]
 # Uncomment path to disable screensaver
 #path=@libexecdir@/weston-screensaver
Signature · 1 line
2.40.1
#2 lore raw

PATCH 2/7 weston: drop Fix-touch-screen-crash patch

In reply to [email protected]

From: Randolph Sapp <[email protected]>

Drop the fix touchscreen crash patch as this is for an older version of weston and it seems like they completely reworked the way the handle touch events, adding checks for out of bounds events and extra handling for NULL window focus events.

---
 ...-weston-Fix-touch-screen-crash-issue.patch | 39 -------------------
 .../wayland/weston_10.0.2.bbappend            |  1 -
 2 files changed, 40 deletions(-)
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0004-weston-Fix-touch-screen-crash-issue.patch
meta-arago-distro/recipes-graphics/wayland/weston/0004-weston-Fix-touch-screen-crash-issue.patch deleted +0 -39
deleted file mode 100644
index 4849d5b6..00000000
@@ -1,39 +0,0 @@
-From 60250e9dc57fe56148c8a24bba107bce8a873fb4 Mon Sep 17 00:00:00 2001
-From: Karthik Ramanan <[email protected]>
-Date: Mon, 12 Mar 2018 10:56:28 +0530
-Subject: [PATCH 4/4] weston: Fix touch screen crash issue
-
-Touch screen operation causes the weston to crash with segment fault sometimes.
-The crash occurs when the coordinate (x,y) passed to the weston input module
-is outside the view window, hence the weston compositor is not able to pick
-up a display view and there is no code to detect this condition at function
-notify_touch().
-
-Upstream status: pending
-
-Signed-off-by: Eric Ruei <[email protected]>
-Signed-off-by: Karthik Ramanan <[email protected]>
----
- libweston/input.c | 6 ++++++
- 1 file changed, 6 insertions(+)
-
-diff --git a/libweston/input.c b/libweston/input.c
-index 4fedc55..bcb2f28 100644
---- a/libweston/input.c
-+++ b/libweston/input.c
-@@ -2185,6 +2185,12 @@ notify_touch(struct weston_seat *seat, uint32_t time, int touch_id,
- 		 * until all touch points are up again. */
- 		if (touch->num_tp == 1) {
- 			ev = weston_compositor_pick_view(ec, x, y, &sx, &sy);
-+			if (!ev)
-+			{
-+				weston_log("notify_touch: weston_compositor_pick_view(%d, %d) failed to find a view!\n",
-+							wl_fixed_to_int(x), wl_fixed_to_int(y));
-+				return;
-+			}
- 			weston_touch_set_focus(touch, ev);
- 		} else if (!touch->focus) {
- 			/* Unexpected condition: We have non-initial touch but
--- 
-1.9.1
-
meta-arago-distro/recipes-graphics/wayland/weston_10.0.2.bbappend +0 -1
index b1b7d26a..16ed6e67 100644
@@ -5,7 +5,6 @@ PR:append = ".arago1"
 #        file://0002-weston-Allow-visual_id-to-be-0.patch
 SRC_URI += " \
         file://0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch \
-        file://0004-weston-Fix-touch-screen-crash-issue.patch \
         file://0001-backend-drm-Select-plane-based-on-current-attached-C.patch \
         file://0001-Revert-require-GL_EXT_unpack_subimage-commit.patch \
 "
Signature · 1 line
2.40.1
#3 lore raw

PATCH 3/7 weston: drop allow-visual_id-to-be-0 patch

In reply to [email protected]

From: Randolph Sapp <[email protected]>

Weston 10 now checks to see if eglGetConfigAttrib returns anything before handling the actual EGL_NATIVE_VISUAL_ID value.

---
 .../0002-weston-Allow-visual_id-to-be-0.patch | 34 -------------------
 .../wayland/weston_10.0.2.bbappend            |  1 -
 2 files changed, 35 deletions(-)
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0002-weston-Allow-visual_id-to-be-0.patch
meta-arago-distro/recipes-graphics/wayland/weston/0002-weston-Allow-visual_id-to-be-0.patch deleted +0 -34
deleted file mode 100644
index a354d947..00000000
@@ -1,34 +0,0 @@
-From 5695eab02bb88318bf99d568b6d0e4592d5f9981 Mon Sep 17 00:00:00 2001
-From: Karthik Ramanan <[email protected]>
-Date: Mon, 12 Mar 2018 10:47:02 +0530
-Subject: [PATCH 2/4] weston: Allow visual_id to be 0
-
-The inquiry of visual id from egl API eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID)
-is an optional feature. The visual id will be set to 0 if this feature is
-not supported. Therefore, the return condition @function match_config_to_visual()
-should be (id == visual_id || id == 0) instead of (id == visual_id)
-
-Upstream status: Pending
-
-Signed-off-by: Eric Ruei <[email protected]>
-Signed-off-by: Karthik Ramanan <[email protected]>
----
- libweston/gl-renderer.c | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/libweston/gl-renderer.c b/libweston/gl-renderer.c
-index c6091af..9299dc6 100644
---- a/libweston/gl-renderer.c
-+++ b/libweston/gl-renderer.c
-@@ -2575,7 +2575,7 @@ match_config_to_visual(EGLDisplay egl_display,
- 				&id))
- 			continue;
- 
--		if (id == visual_id)
-+		if (id == visual_id || id == 0)
- 			return i;
- 	}
- 
--- 
-1.9.1
-
meta-arago-distro/recipes-graphics/wayland/weston_10.0.2.bbappend +0 -1
index 16ed6e67..dd67eec1 100644
@@ -2,7 +2,6 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
 PR:append = ".arago1"
 
-#        file://0002-weston-Allow-visual_id-to-be-0.patch
 SRC_URI += " \
         file://0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch \
         file://0001-backend-drm-Select-plane-based-on-current-attached-C.patch \
Signature · 1 line
2.40.1
#4 lore raw

PATCH 4/7 weston: add notice about select-plane patch

In reply to [email protected]

From: Randolph Sapp <[email protected]>

The select-plane patch has been accepted upstream as commit 94afcbcdc3f1b1cfc050da242c9c70009b007fc6. Add a notice to remind users to remove that patch when we get there.

---
 .../recipes-graphics/wayland/weston_10.0.2.bbappend          | 5 +++++
 1 file changed, 5 insertions(+)
meta-arago-distro/recipes-graphics/wayland/weston_10.0.2.bbappend +5 -0
index dd67eec1..989bc28c 100644
@@ -2,8 +2,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
 PR:append = ".arago1"
 
+# Drop 0001-backend-drm-Select-plane-based-on-current-attached-C.patch once we
+# get past version 11.0.1 or commit 94afcbcdc3f1b1cfc050da242c9c70009b007fc6
+# upstream
+
 SRC_URI += " \
         file://0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch \
         file://0001-backend-drm-Select-plane-based-on-current-attached-C.patch \
         file://0001-Revert-require-GL_EXT_unpack_subimage-commit.patch \
 "
+
Signature · 1 line
2.40.1
#5 lore raw

PATCH 5/7 weston: add weston user to the render group

In reply to [email protected]

From: Randolph Sapp <[email protected]>

The weston user must be added to the render group to use dri render devices.

---
 .../recipes-graphics/wayland/weston_10.0.2.bbappend          | 5 +++++
 1 file changed, 5 insertions(+)
meta-arago-distro/recipes-graphics/wayland/weston_10.0.2.bbappend +5 -0
index 989bc28c..edc1bebd 100644
@@ -12,3 +12,8 @@ SRC_URI += " \
         file://0001-Revert-require-GL_EXT_unpack_subimage-commit.patch \
 "
 
+# required for weston user to interact with the render devices
+inherit extrausers
+EXTRA_USERS_PARAMS = " \
+	usermod -aG render weston; \
+"
Signature · 1 line
2.40.1
#6 lore raw

PATCH 6/7 weston: drop the fix-virtual-keyboard-display-issue patch

In reply to [email protected]

From: Randolph Sapp <[email protected]>

Weston 10 changed the way it handles focus grabbing. This shouldn't be relevant anymore.

---
 ...al-keyboard-display-issue-for-QT5-ap.patch | 41 -------------------
 .../wayland/weston_10.0.2.bbappend            |  1 -
 2 files changed, 42 deletions(-)
 delete mode 100644 meta-arago-distro/recipes-graphics/wayland/weston/0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch
meta-arago-distro/recipes-graphics/wayland/weston/0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch deleted +0 -41
deleted file mode 100644
index 32901db9..00000000
@@ -1,41 +0,0 @@
-From 8034bc1862bbebb332e91917c6458ef8efb5b54e Mon Sep 17 00:00:00 2001
-From: Eric Ruei <[email protected]>
-Date: Fri, 8 Mar 2019 18:49:07 -0500
-Subject: [PATCH] weston: Fix virtual keyboard display issue for QT5 
- application
-
-The virtual keyboard does pop up as expected, however, it will never hide
-even when the application is terminated. This problem is due to the order
-of the text APIs( text_input_activate and test_input_show_input_panel) are
-invoked in QT5 and a potential bug of the API implementation. The virtual
-keyboard works as expected if the test_input_show_input_panel() is invoked
-prior to the test_input_activate() as most of the weston sample applications
-do. However, the problem will show up if that order is reversed and the reason
-why is that the current_panel is not set in this case and hence this panel
-cannot be hidden.
-
-It is required to set the current_panel to the text_input when the input_panel
-becomes visible at the first time.
-
-Upstream status: Pending
-
-Signed-off-by: Eric Ruei <[email protected]>
----
- compositor/text-backend.c | 1 +
- 1 file changed, 1 insertion(+)
-
-diff --git a/compositor/text-backend.c b/compositor/text-backend.c
-index 664c36f..b610dfb 100644
---- a/compositor/text-backend.c
-+++ b/compositor/text-backend.c
-@@ -349,6 +349,7 @@ text_input_show_input_panel(struct wl_client *client,
- 			       text_input->surface);
- 		wl_signal_emit(&ec->update_input_panel_signal,
- 			       &text_input->cursor_rectangle);
-+		text_input->manager->current_text_input = text_input;
- 	}
- }
- 
--- 
-1.9.1
-
meta-arago-distro/recipes-graphics/wayland/weston_10.0.2.bbappend +0 -1
index edc1bebd..698ff03e 100644
@@ -7,7 +7,6 @@ PR:append = ".arago1"
 # upstream
 
 SRC_URI += " \
-        file://0003-weston-Fix-virtual-keyboard-display-issue-for-QT5-ap.patch \
         file://0001-backend-drm-Select-plane-based-on-current-attached-C.patch \
         file://0001-Revert-require-GL_EXT_unpack_subimage-commit.patch \
 "
Signature · 1 line
2.40.1
#7 lore raw

PATCH 7/7 weston-init: add a simple touchscreen calibration check

In reply to [email protected]

From: Randolph Sapp <[email protected]>

The old touchscreen calibration script created a generic UDEV rule for all touch devices that applied the LIBINPUT_CALIBRATION_MATRIX of the last calibrated display. This attempts to replace that to an extent.

This script executes at the start of Weston and if it detects a touch input device, uses Weston's built in touchscreen calibrator and touchscreen calibrator interface to apply the current calibration without restarting Weston. This script does not attempt to make these calibration values persistent.

If a user wants calibration values to persist for all Weston users they should add the calibration to /etc/default/weston using the LIBINPUT_CALIBRATION_MATRIX variable themselves. The script will bypass calibration if it detects this variable is already set.

---
 .../recipes-graphics/wayland/weston-init.bbappend   | 13 ++++++++++---
 .../wayland/weston-init/weston-launch-calibrator.sh | 13 +++++++++++++
 .../recipes-graphics/wayland/weston-init/weston.ini |  4 ++++
 3 files changed, 27 insertions(+), 3 deletions(-)
 create mode 100644 meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh
meta-arago-distro/recipes-graphics/wayland/weston-init.bbappend +10 -3
index a73b669d..4d5db58c 100644
@@ -2,6 +2,13 @@ FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
 
 PR:append = ".arago12"
 
-#SRC_URI:append = " \
-#    file://weston.ini \
-#"
+SRC_URI:append = " \
+    file://weston.ini \
+    file://weston-launch-calibrator.sh \
+"
+
+do_install:append() {
+    install -Dm755 weston-launch-calibrator.sh ${D}/${bindir}/weston-launch-calibrator
+}
+
+FILES:${PN}:append = "${bindir}/weston-launch-calibrator"
meta-arago-distro/recipes-graphics/wayland/weston-init/weston-launch-calibrator.sh new file +13 -0
new file mode 100644
index 00000000..45863ecd
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+if [ -e /dev/input/touchscreen0 ]; then
+	echo "Touch screen detected..."
+	if [ -n "$LIBINPUT_CALIBRATION_MATRIX" ]; then
+		echo "Calibration matrix already present, skipping calibration..."
+	else
+		echo "Calibrating touchscreen..."
+		exec weston-calibrator
+	fi
+else
+	echo "Touch screen not detected, skipping calibration..."
+fi
meta-arago-distro/recipes-graphics/wayland/weston-init/weston.ini +4 -0
index 4cc2683a..b9610fa8 100644
@@ -11,6 +11,10 @@ startup-animation=fade
 [libinput]
 touchscreen_calibrator=true
 
+[autolaunch]
+# launch the calibrator on startup if a touchscreen is detected
+path=/usr/bin/weston-launch-calibrator
+
 [screensaver]
 # Uncomment path to disable screensaver
 #path=@libexecdir@/weston-screensaver
Signature · 1 line
2.40.1