I've been encountering some tearing issues in kodi and so chose to switch to the vc4-kms-v3d driver in my boot config. The performance in now significantly improved, however I also occasionally need to use a browser session (in something like kiosk mode) that I've been launching with the startx
command.
The issue is that now that I've switched drivers, the X server doesn't seem to be able to launch.
I'm launching from terminal in the following way:
startx ./chromiumlaunch.sh
With the shell script being as follows:
#!/bin/sh
#xrandr --output default --mode 1280x720 --display 0
xrandr --output HDMI-0 --mode 1280x720
#--set "Broadcast RGB" "Full" --scale 1.25x1.25
xset -dpms # disable DPMS (Energy Star) features.
xset s off # disable screen saver
xset s noblank # don't blank the video device
matchbox-window-manager -use_titlebar no &
unclutter & # hide X mouse cursor unless mouse activated
chromium-browser --display=:0 --full-screen --window-position=0,0 https://youtube.com
As X11 launches I get the following error:
X.Org X Server 1.20.11
X Protocol Version 11, Revision 0
Build Operating System: linux Raspbian
Current Operating System: Linux partypi 6.1.19-v8+ #1637 SMP PREEMPT Tue Mar 14 11:11:47 GMT 2023 aarch64
Kernel command line: coherent_pool=1M 8250.nr_uarts=1 snd_bcm2835.enable_headphones=0 snd_bcm2835.enable_headphones=1 snd_bcm2835.enable_hdmi=1 snd_bcm2835.enable_hdmi=0 smsc95xx.macaddr=E4:5F:01:6F:54:09 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000 cons
ole=tty1 root=PARTUUID=5b292258-02 rootfstype=ext4 fsck.repair=yes rootwait
Build Date: 30 March 2023 01:46:14PM
xorg-server 2:1.20.11-1+rpt3+deb11u6 (https://www.debian.org/support)
Current version of pixman: 0.40.0
Before reporting problems, check http://wiki.x.org
to make sure that you have the latest version.
Markers: (--) probed, (**) from config file, (==) default setting,
(++) from command line, (!!) notice, (II) informational,
(WW) warning, (EE) error, (NI) not implemented, (??) unknown.
(==) Log file: "/home/pi/.local/share/xorg/Xorg.0.log", Time: Sun Apr 2 15:58:15 2023
(==) Using system config directory "/usr/share/X11/xorg.conf.d"
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Failed to create scanout resource
(EE)
Fatal server error:
(EE) AddScreen/ScreenInit failed for driver 0
(EE)
(EE)
Please consult the The X.Org Foundation support
at http://wiki.x.org
for help.
(EE) Please also check the log file at "/home/pi/.local/share/xorg/Xorg.0.log" for additional information.
(EE)
(EE) Server terminated with error (1). Closing log file.
xinit: giving up
xinit: unable to connect to X server: Connection refused
xinit: server error
Does X11 have trouble working with the kms driver, or is it more likely that I've got something wrong with my setup?
UPDATE:
The issue only appears when using vc4-kms-v3d
, vc4-fkms-v3d
doesn't trigger the Cannot allocate memory
error.
The system is running 32bit Raspberry Pi OS 11. I am booting directly into Kodi standalone on boot for performance reasons. When using the browser I have added a button to the default theme that exits Kodi and starts an X11 session for Chromium only. fkms was initially chosen to get better performance out of video decoding and UI but is still leading to a considerable amount of screen tearing. I don't believe any kms was active by default.
The video driver is being set inside /boot/config.txt
UPDATE 2
Having set up on a new system I can confirm that the issue has been caused by some setting that's been introduced on the system, but I have no idea how to identify what has been introduced.
UPDATE 3
vc4-kms-v3d is now working fine with my system - id does appear that, embarrassingly, there may have been an errant setting in config.txt that was preventing me from switching back.
However I'm still finding that my startx script is not working most of the time due to the inability to allocate memory. It feels like something is still using the DRM but I cannot work out what that is. Occasionally the script works - which is even more puzzling.
UPDATE 4
I have now completed my ansible script, duplicated my setup, switched sd cards and found that the original device works on a computer monitor I've been using as a second monitor, and the fresh setup doesn't seem to work at all with the HDMI TV I've got it plugged into - once again running into the DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory error
I'm puzzled but this seems to be down to the display device I'm using?
Any input welcomed. I feel like I've just walked in a massive circle.
UPDATE 5
I have found that with vc4-kms-v3d
set, kodi will run but startx won't. I haven't found a way to start a desktop session without x to this point. So far I've not succeeded in finding a more wayland-focused way of launching a display session. If I remove vc4-kms-v3d
from config.txt
, startx runs fine, but kodi-standalone will no longer work.
I am currently trying to work out how to make both work without restarting the device.