eglfs on raspberry2 -- * failed to add service - already in use?

7

that's is my first post here.

I'd like to keep it short...

Following problem:

i want to run a qt5/qtquickcontrols2 application utilising the eglfs backend on a raspberry-pi 2b, accelerated by vc4, of course. Ideally, it should run in kiosk mode and it definitely needs accelerated gl functionality. To minimise problems, I tested with the command:

LD_PRELOAD="/opt/vc/lib/libGLESv2.so /opt/vc/lib/libEGL.so" qmlscene ./gallery.qml

where gallery.qml is simply the widget preview example project from qt-creator (followed these instructions...). I'm getting following error output:

[manjaro@Loki gallery]$ LD_PRELOAD="/opt/vc/lib/libGLESv2.so /opt/vc/lib/libEGL.so" qmlscene ./gallery.qml
qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_brcm", "eglfs_kms", "eglfs_x11")
qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_brcm", "eglfs_kms", "eglfs_x11")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_brcm"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_brcm"
* failed to add service - already in use?

I also tested the same running a crosscompiled binary - same error. All but the last line come from verbose debugging output of qt5, which i set via environment variable, details will follow.

System / Environment:

  • raspberry-pi 2b
  • qt-5.7.0
  • Manjaro-ARM (based on Arch Linux ARM)
  • all firmware stuff, tools, boot stuff, kernel are installed and up to date

Other settings...

[manjaro@Loki gallery]$ uname -a
Linux Loki 4.4.28-1-MANJARO-ARM #1 SMP Sat Oct 29 21:01:09 CDT 2016 armv7l GNU/Linux

My config.txt

dtparam=audio=on
#hdmi_drive=2
avoid_warnings=2
disable_overscan=1
disable_splash=1
boot_delay=0

# activate raspi cam
start_x=1

# tuning gpu accel and memory usage
gpu_mem=320
dtoverlay=vc4-kms-v3d

My cmdline.txt

root=/dev/mmcblk0p2 rw  rootwait console=tty1 selinux=0 quiet plymouth.ignore-serial-consoles dwc_otg.lpm_enable=0 elevator=deadline fsck.repair=yes

printenv gives following:

XDG_SESSION_ID=c1
TERM=xterm
SHELL=/bin/bash
SSH_CLIENT=192.168.0.100 43274 22
QT_QPA_EGLFS_INTEGRATION=eglfs_brcm
OLDPWD=/home/manjaro
SSH_TTY=/dev/pts/0
USER=manjaro
MOZ_PLUGIN_PATH=/usr/lib/mozilla/plugins
MAIL=/var/spool/mail/manjaro
PATH=/usr/local/sbin:/usr/local/bin:/usr/bin:/opt/vc/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
PWD=/home/manjaro/opt
LANG=de_DE.UTF-8
QT_QPA_PLATFORM=eglfs
SHLVL=1
HOME=/home/manjaro
LOGNAME=manjaro
QT_LOGGING_RULES=qt.qpa.*=true
DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/1000/bus
SSH_CONNECTION=192.168.0.100 43274 192.168.0.107 22
XDG_RUNTIME_DIR=/run/user/1000
_=/usr/bin/printenv

You can see several Qt specific settings: debugging , using eglfs as default backend and the most interesting: QT_QPA_EGLFS_INTEGRATION=eglfs_brcm which means that broadcom eglfs plugin should be used. Along eglfs_brcm i tried eglfs_kms too (just out of curiosity):

[manjaro@Loki gallery]$ export QT_QPA_EGLFS_INTEGRATION=eglfs_kms
[manjaro@Loki gallery]$ LD_PRELOAD="/opt/vc/lib/libGLESv2.so /opt/vc/lib/libEGL.so" qmlscene ./gallery.qml 
qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_brcm", "eglfs_kms", "eglfs_x11")
qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_kms", "eglfs_brcm", "eglfs_x11")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_kms"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_kms"
qt.qpa.input: udev device discovery for type QFlags(0x10)
qt.qpa.input: Found matching devices ("/dev/dri/card0")
qt.qpa.eglfs.kms: Found the following video devices: ("/dev/dri/card0")
qt.qpa.eglfs.kms: Using "/dev/dri/card0"
qt.qpa.eglfs.kms: Opening device "/dev/dri/card0"
qt.qpa.eglfs.kms: Creating GBM device for file descriptor 5 obtained from "/dev/dri/card0"
* failed to add service - already in use?

It seems to be neither a problem with the video core, nor a problem of the "stock" Qt of manjaro-arm. It simply says something could being blocked, but what? Any hints?

Overlays and drivers seem to work, glxgears achieved ~60FPS running on xfce4. Following is interesting too:

[root@Loki gallery]# vcdbg log msg|& grep -v gpioman|grep -iv hdmi
001042.905: *** Restart logging
001043.889: Read command line from file 'cmdline.txt'
root=/dev/mmcblk0p2 rw  rootwait console=tty1 selinux=0 nofb dwc_otg.lpm_enable=0 elevator=deadline fsck.repair=yes
001409.425: Loading 'kernel7.img' to 0x8000 size 0x5ea25c
001413.076: Kernel trailer DTOK property says yes
001413.091: Kernel trailer DDTK property says yes
001415.514: Loading 'bcm2709-rpi-2-b.dtb' to 0x5f225c size 0x3bfc
001514.479: dtparam: audio=on
001567.591: Loaded overlay 'vc4-kms-v3d'
001836.841: Device tree loaded to 0x2effbc00 (size 0x430d)
005904.220: vchiq_core: vchiq_init_state: slot_zero = 0xd0400000, is_master = 1
005911.919: TV service:host side not connected, dropping notification 0x00000002, 0x00000001, 0x00000010
007999.619: camsubs: Looking for camera 0: i2c_port = 0, led gpio = 32, power enable gpio = 41
008000.339: camsubs: Camera not found
008000.377: camsubs: Looking for camera 0: i2c_port = 0, led gpio = 32, power enable gpio = 41
008001.091: camsubs: Camera not found
008001.128: camsubs: Looking for camera 0: i2c_port = 0, led gpio = 32, power enable gpio = 41
008001.844: camsubs: Camera not found

Looks pretty much like it should to me.

I tried following things:

I played around with gpu_mem split, tried values between 128 and 448. Checking gpu mem looks as expected, but no effect on executing mentioned app.

[manjaro@Loki gallery]$ vcgencmd get_mem gpu
gpu=320M

I also created following udev rule in order to fix an error I initially faced

[manjaro@Loki gallery]$ cat /etc/udev/rules.d/10-vchiq-permissions.rules 
SUBSYSTEM=="vchiq",GROUP="video",MODE="0660"

[manjaro@Loki gallery]$ groups
wheel video storage power users

Without the mentioned udev rule, I'd get following error:

[manjaro@Loki gallery]$ LD_PRELOAD="/opt/vc/lib/libGLESv2.so /opt/vc/lib/libEGL.so" qmlscene ./gallery.qml 
qt.qpa.egldeviceintegration: EGL device integration plugin keys: ("eglfs_brcm", "eglfs_kms", "eglfs_x11")
qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_brcm", "eglfs_kms", "eglfs_x11")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_brcm"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_brcm"
* failed to open vchiq instance

Damn... I'm out of ideas now... I'd appreciate every little hint which could help...

Please do not:

  • anser to read several docs (i allready spent tons of time)
  • suggest to try another distro (that's NOT a solution)
  • suggest to reflash my sdcard (NOT a solution too)

Who got Qt-5.7/qtquickcontrols2/QML working on raspberrypi 2 through EGLFS utilizing the vc4??? Thank you very very much for every single breadcrumb...

qt5
raspberry-pi2
qtquickcontrols2
archlinux-arm
eglfs

2 Answers

1

I just ran into the same issue.

It happens that when you use the opensource 'vc4-kms-v3d' driver (as set in your config.txt), you cannot use the closed source drivers (/opt/vc/lib/libGLESv2.so and /opt/vc/lib/libEGL.so, on your LD_PRELOAD string).

The error

failed to add service - already in use?

Indicates that, as I've just found out.

So, you may either comment the line on config.txt OR don't use the LD_PRELOAD strategy nor QT_QPA_EGLFS_INTEGRATION=eglfs_brcm

answered on Stack Overflow Aug 7, 2019 by zertyz
0

dont use fakg in your config.txt comment

# dtoverlay=vc4-kms-v3d
answered on Stack Overflow May 6, 2021 by ali alilou • edited May 7, 2021 by eyllanesc

User contributions licensed under CC BY-SA 3.0