This allows Weston to launch even if there if /dev/dri/card0 does not exist. This requires a shell script for string processing. It could be written in Rust, but that's not worth it for a temporary workaround. It also prevents waiting for the card to be ready. Instead, let s6 restart Weston over and over until Weston finally runs. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> --- This makes Spectrum work on my AMD system. --- host/rootfs/file-list.mk | 1 + host/rootfs/image/etc/s6-rc/weston/run | 6 +++--- host/rootfs/image/usr/bin/run-weston | 32 ++++++++++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/host/rootfs/file-list.mk b/host/rootfs/file-list.mk index 3899d620717fc97f42e669e5313c4100dcf5b1cd..0ece8e08a0e2d367fe124e90896355aa98a58cb8 100644 --- a/host/rootfs/file-list.mk +++ b/host/rootfs/file-list.mk @@ -62,6 +62,7 @@ FILES = \ image/usr/bin/run-appimage \ image/usr/bin/run-flatpak \ image/usr/bin/run-vmm \ + image/usr/bin/run-weston \ image/usr/bin/spectrum-update \ image/usr/bin/vm-console \ image/usr/bin/vm-import \ diff --git a/host/rootfs/image/etc/s6-rc/weston/run b/host/rootfs/image/etc/s6-rc/weston/run index fd59586c719391deb546c29578341e16a61ed4ce..6c0aac4a2326b5d56b9c09f82589dfbcc78eaabd 100644 --- a/host/rootfs/image/etc/s6-rc/weston/run +++ b/host/rootfs/image/etc/s6-rc/weston/run @@ -2,7 +2,7 @@ # SPDX-License-Identifier: EUPL-1.2+ # SPDX-FileCopyrightText: 2021, 2025 Alyssa Ross <hi@alyssa.is> -importas -Siu WAYLAND_DISPLAY +importas -Si WAYLAND_DISPLAY piperw 4 3 background { @@ -40,7 +40,6 @@ redirfd -r 0 /dev/tty1 importas -i home HOME cd $home -if { udevadm wait /dev/dri/card0 } s6-setuidgid wayland bwrap # no --unshare-net, breaks udev hotplug @@ -88,4 +87,5 @@ bwrap --bind /run/user/0 /run/user/0 --bind /run/wayland /run/wayland -- -weston -S $WAYLAND_DISPLAY + elglob -w0 CARD "/dev/dri/card[0-9]*" + /usr/bin/run-weston $CARD diff --git a/host/rootfs/image/usr/bin/run-weston b/host/rootfs/image/usr/bin/run-weston new file mode 100755 index 0000000000000000000000000000000000000000..6a14f905d2e9e5533d00aac1ee7f920ebf55fac3 --- /dev/null +++ b/host/rootfs/image/usr/bin/run-weston @@ -0,0 +1,32 @@ +#!/usr/bin/sh -- +# SPDX-License-Identifier: EUPL-1.2+ +# SPDX-FileCopyrightText: 2026 Demi Marie Obenour <demiobenour@gmail.com> +set -euf +case ${1-} in +/dev/dri/card[0-9]*) + first_dev=${1#/dev/dri/} extra_cards= + shift + ;; +*) + echo 'No card nodes found, cannot run Weston' >&2 + exit 1 + ;; +esac +for i; do + case $i in + *,*) continue ;; + /dev/dri/card[0-9]*) : ;; + *) + echo 'Bad name from execline script' >&2 + exit 1 + ;; + esac + card_name=${i#/dev/dri/} + case $card_name in */*) continue ;; esac + if [ -z "$extra_cards" ]; then + extra_cards=--additional-devices=$card_name + else + extra_cards=$extra_cards,$card_name + fi +done +exec weston --backend=drm "--drm-device=$first_dev" $extra_cards -S "$WAYLAND_DISPLAY" --- base-commit: 4827f7591e945f331a945fb53a9fd4e8ebfdbc12 change-id: 20260523-weston-card-fix-725c98d5245f -- Sincerely, Demi Marie Obenour (she/her/hers)