qtraspberry-pi4waylandwestonyocto-kirkstone

Weston not running from terminal: "no drm device found"


I've built an image using core-image-full-cmdline using Yocto/Poky (kirkstone). I boot the image on a RasPi 4B via SSH. I implemented wayland/weston to my build by adding the following lines to /conf/local.conf:

DISTRO_FEATURES:append = "wayland"
IMAGE_INSTALL:append = " qtbase qtwayland"
CORE_IMAGE_EXTRA_INSTALL += "wayland weston"

I enabled fake KMS driver on my SD card in config.txt file:

#Enable VC4 Graphics
dtoverlay=vc4-fkms-v3d

When I run weston as root, I get the error:

root@raspberrypi4:/etc/init.d# weston
Date: 2018-03-09 UTC
[14:06:18.044] weston 10.0.2
               https://wayland.freedesktop.org
               Bug reports to: https://gitlab.freedesktop.org/wayland/weston/issues/
               Build: 10.0.2
[14:06:18.045] Command line: weston
[14:06:18.045] OS: Linux, 5.15.34-v7l, #1 SMP Tue Apr 19 19:21:26 UTC 2022, armv7l
[14:06:18.045] Flight recorder: enabled
[14:06:18.046] Using config file '/etc/xdg/weston/weston.ini'
[14:06:18.046] Output repaint window is 7 ms maximum.
[14:06:18.047] Loading module '/usr/lib/libweston-10/drm-backend.so'
[14:06:18.061] initializing drm backend
[14:06:18.061] Trying libseat launcher...
[14:06:18.062] libseat: session control granted
[14:06:18.063] no drm device found
[14:06:18.065] fatal: failed to create compositor backend
Internal warning: debug scope 'drm-backend' has not been destroyed.

My /etc/xdg/weston/weston.ini file looks like this:

# configuration file for Weston

[core]
#modules=xwayland.so,cms-colord.so
#shell=desktop-shell.so
#gbm-format=xrgb2101010
require-input=false

#[shell]
#background-image=/usr/share/backgrounds/gnome/Aqua.jpg
#background-color=0xff002244
#background-type=tile
#clock-format=minutes
#panel-color=0x90ff0000
#locking=true
#animation=zoom
#startup-animation=fade
#binding-modifier=ctrl
#num-workspaces=6
#cursor-theme=whiteglass
#cursor-size=24

#lockscreen-icon=/usr/share/icons/gnome/256x256/actions/lock.png
#lockscreen=/usr/share/backgrounds/gnome/Garden.jpg
#homescreen=/usr/share/backgrounds/gnome/Blinds.jpg
#animation=fade

#[launcher]
#icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
#path=/usr/bin/gnome-terminal

#[launcher]
#icon=/usr/share/icons/gnome/24x24/apps/utilities-terminal.png
#path=/usr/bin/weston-terminal

#[launcher]
#icon=/usr/share/icons/hicolor/24x24/apps/google-chrome.png
#path=/usr/bin/google-chrome

#[launcher]
#icon=/usr/share/icons/gnome/24x24/apps/arts.png
#path=/build/weston-0lEgCh/weston-1.11.0/weston-flower

#[input-method]
#path=/usr/libexec/weston-keyboard

#[output]
#name=LVDS1
#mode=1680x1050
#transform=90
#icc_profile=/usr/share/color/icc/colord/Bluish.icc

#[output]
#name=VGA1
#mode=173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync
#transform=flipped

#[output]
#name=X1
#mode=1024x768
#transform=flipped-90

#[libinput]
#enable_tap=true

#[touchpad]
#constant_accel_factor = 50
#min_accel_factor = 0.16
#max_accel_factor = 1.0

[screen-share]
command=/usr/bin/weston --backend=rdp-backend.so --shell=fullscreen-shell.so --no-clients-resize

#[xwayland]
#path=/usr/bin/Xwayland

However, when I build a core-image-weston image, the weston compositor works and I can run a desktop and my Qt apps on the Pi. When I emulate the core-image-full-cmdline image in QEMU, it works, too.

Do I need to change something, to make it run on the Pi? My goal is, to script an auto-boot to a Qt app, since I want to use the Pi as a UI prototype, without wanting to connect a keyxboard and run the Qt app manually after each boot.

Thanks for any help!


Solution

  • I have solved the issue by using core-image-base, and setting the XDG_RUNTIME_DIR variable to /run/user/1000. Additionally, I set the WAYLAND_DISPLAY variable to wayland-1. I have used these links as source:

    https://wayland.pages.freedesktop.org/weston/toc/running-weston.html#running-weston-on-a-stand-alone-back-end

    https://www.ics.com/blog/building-qt-and-qtwayland-raspberry-pi

    https://docs.yoctoproject.org/dev-manual/wayland.html#using-wayland-and-weston

    I created this script in the embedded Linux OS on the RasPi inside /etc/init.d and ran update-rc.d weston defaults 90 10:

    #!/bin/sh
    #
    ### BEGIN ININT INFO
    # Provides: splashscreen
    # Required-Start: weston
    # Required-Stop: weston
    # Default-Start:     2 3 4 5
    # Default-Stop:      0 1 6
    ### END INIT INFO
    
    if test -e /etc/default/splashscreen ; then
        . /etc/default/splashscreen
    fi
    
    killproc() {
        pid=`/bin/pidof $1`
        [ "$pid" != "" ] && kill $pid
    }
    
    read CMDLINE > /proc/cmdline
    for x in $CMDLINE; do
        case $x in
        splashscreen=false)
                echo "App disabled"
                exit 0;
                ;;
        esac
    done
    
    case "$1" in 
        start)
            . /etc/profile
                    
            export HOME=/home/root
            export XDG_RUNTIME_DIR=/run/user/1000
            export WAYLAND_DISPLAY=wayland-1
                    
            # Start App
            splashscreen
        ;;
    
        stop)
            echo "Stopping App"
            
            killproc splashscreen
        ;;
    
        restart)
            $0 stop
            sleep 1
            $0 start
        ;;
        
        *)
            echo "usage: $0 { start | stop | restart }"
        ;;
    esac
    
    exit 0
    

    Now, the app can be started as a service using service splashscreen start, and by replacing start with stop or restart, it can be halted or restarted. Additionally, it now runs automatically after booting up the RasPi.

    I will now have to figure out, how it boots faster, since it takes approx. 30 seconds to boot into the Qt app. My first thoughts are to replace the SysVinit manager by systemd.

    Any recommendations?