]> code.ossystems Code Review - meta-freescale.git/commitdiff
weston-init: Fix inoperable Weston desktop
authorTom Hochstein <tom.hochstein@nxp.com>
Tue, 26 Jun 2018 02:11:45 +0000 (21:11 -0500)
committerOtavio Salvador <otavio@ossystems.com.br>
Thu, 5 Jul 2018 18:32:27 +0000 (15:32 -0300)
For an image configured with pam and systemd, Weston apps
would fail to run. For example:

$ weston-terminal
failed to connect to Wayland display: No such file or directory
failed to create display: No such file or directory

This fix is based on a proposal by Daniel Diaz to OE-core. The
main part of the fix is the use of a new, manually created tty.

The original proposal called weston directly, but that didn't
seem to work where weston-launch did.

Signed-off-by: Tom Hochstein <tom.hochstein@nxp.com>
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
recipes-graphics/wayland/weston-init.bbappend
recipes-graphics/wayland/weston-init/imxdrm/weston.config [new file with mode: 0644]
recipes-graphics/wayland/weston-init/mx8mm/weston.config [new file with mode: 0644]
recipes-graphics/wayland/weston-init/weston.config [new file with mode: 0644]
recipes-graphics/wayland/weston-init/weston.service [new file with mode: 0644]

index ce1482d947595af2b5eb63d5fcb698c3d0a32e0a..76aadf948702127b43539dbbf636b8c95e7ab1f5 100644 (file)
@@ -1,5 +1,25 @@
+FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
+
 # OpenGL is not required for parts with GPU support for 2D but not 3D
 IMX_REQUIRED_DISTRO_FEATURES_REMOVE          = ""
 IMX_REQUIRED_DISTRO_FEATURES_REMOVE_imxgpu2d = "opengl"
 IMX_REQUIRED_DISTRO_FEATURES_REMOVE_imxgpu3d = ""
 REQUIRED_DISTRO_FEATURES_remove = "${IMX_REQUIRED_DISTRO_FEATURES_REMOVE}"
+
+SRC_URI += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd wayland x11', 'file://weston.config', '', d)}"
+
+HAS_SYSTEMD = "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}"
+HAS_XWAYLAND = "${@bb.utils.contains('DISTRO_FEATURES', 'wayland x11', 'true', 'false', d)}"
+
+do_install_append() {
+    if ${HAS_SYSTEMD}; then
+        sed -i \
+            -e 's,/usr/bin,${bindir},g' \
+            -e 's,/etc,${sysconfdir},g' \
+            -e 's,/var,${localstatedir},g' \
+            ${D}${systemd_system_unitdir}/weston.service
+        if ${HAS_XWAYLAND}; then
+            install -Dm0755 ${WORKDIR}/weston.config ${D}${sysconfdir}/default/weston
+        fi
+    fi
+}
diff --git a/recipes-graphics/wayland/weston-init/imxdrm/weston.config b/recipes-graphics/wayland/weston-init/imxdrm/weston.config
new file mode 100644 (file)
index 0000000..5693d6c
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+OPTARGS="--xwayland"
+DESKTOP_SHELL_WINDOW=1920x1080
diff --git a/recipes-graphics/wayland/weston-init/mx8mm/weston.config b/recipes-graphics/wayland/weston-init/mx8mm/weston.config
new file mode 100644 (file)
index 0000000..eb990e4
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+OPTARGS="--xwayland --use-g2d=1"
+DESKTOP_SHELL_WINDOW=1920x1080
diff --git a/recipes-graphics/wayland/weston-init/weston.config b/recipes-graphics/wayland/weston-init/weston.config
new file mode 100644 (file)
index 0000000..7c92cf1
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+OPTARGS="--xwayland"
diff --git a/recipes-graphics/wayland/weston-init/weston.service b/recipes-graphics/wayland/weston-init/weston.service
new file mode 100644 (file)
index 0000000..44c5a82
--- /dev/null
@@ -0,0 +1,38 @@
+[Unit]
+Description=Weston Wayland Compositor (on tty7)
+RequiresMountsFor=/run
+Conflicts=getty@tty7.service plymouth-quit.service
+After=systemd-user-sessions.service getty@tty7.service plymouth-quit-wait.service
+
+[Service]
+User=root
+PermissionsStartOnly=true
+
+# Log us in via PAM so we get our XDG & co. environment and
+# are treated as logged in so we can use the tty:
+PAMName=login
+
+# Grab tty7
+UtmpIdentifier=tty7
+TTYPath=/dev/tty7
+TTYReset=yes
+TTYVHangup=yes
+TTYVTDisallocate=yes
+
+# stderr to journal so our logging doesn't get thrown into /dev/null
+StandardOutput=tty
+StandardInput=tty
+StandardError=journal
+
+EnvironmentFile=-/etc/default/weston
+
+# Weston does not successfully change VT, nor does systemd place us on
+# the VT it just activated for us. Switch manually:
+ExecStartPre=/usr/bin/chvt 7
+ExecStart=/usr/bin/weston-launch -- --log=/var/log/weston.log $OPTARGS
+
+IgnoreSIGPIPE=no
+
+[Install]
+WantedBy=multi-user.target
+