1

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.

6
  • the error message tells you what to check
    – jsotola
    Apr 2, 2023 at 19:30
  • As far as I can tell nothing is actually using the x11 manager - a scan of ps -ef doesn't reveal anything obvious. Is there a way to be 100% sure? I only see this error when using kms; fkms works completerly fine.
    – Gaffen
    Apr 2, 2023 at 19:39
  • You have failed to say what OS, Pi memory, why you are using startx rather than booting to GUI, why (and how) you were using fkms in the first place.
    – Milliways
    Apr 2, 2023 at 21:52
  • I have attempted to address these failures with additional context. If I have failed to provide sufficient granularity still please let me know.
    – Gaffen
    Apr 2, 2023 at 22:11
  • You still haven't answered any of the 3 questions I asked. Did your initial OS use kms?
    – Milliways
    Apr 2, 2023 at 23:52

2 Answers 2

0

See Window manager & KMS video driver sections in https://raspberrypi.stackexchange.com/a/135703/8697

This is old but most of the comments still apply.

5
  • I mostly use linux as a server so the display is new to me, but if I understand correctly both mutter and openbox are window manages built on top of x11? I see that mutter can be launched without x11 and I'm seeing search results for xwayland as an x emulation layer but it looks quite experimental for the pi. Is there a simple way to start a dedicated session for wayland like with startx? The thing that's still puzzling me is what's causing the gpu memory issue... I have updated my GPU memory allocation from 512 to 1024mb and get the same result.
    – Gaffen
    Apr 3, 2023 at 8:51
  • I suggest you stick to the official Raspberry Pi Ltd. documentation and ignore all the red herrings you allude to. You could start with the first link to the original version release notice.
    – Milliways
    Apr 3, 2023 at 9:39
  • I'm happy to - where do you suggest I identify the root cause? I'm not certain what I'm doing wrong to start with.
    – Gaffen
    Apr 3, 2023 at 9:43
  • Just use a standard installation. Don't fiddle with it and set unsupported options. Mutter does not use X. If you want to use X use Buster (although if you set VNC resolution Bullseye reverts to openbox & X).
    – Milliways
    Apr 3, 2023 at 9:51
  • As it's a fairly mature system running a couple of docker containers at this point I'll try with a fresh SD and see if it works out of the box - if it does I will still need to work out what option is and fix that however. Any guidance for identifying this is welcomed but I will try your suggestion when I can and see what happens. Is there a mutter compatible equivalent for starting a window session in the vein of startx?
    – Gaffen
    Apr 3, 2023 at 10:02
0

This is an unacceptable solution but it's what I've settled on for now.

Something about my samsung flatscreen TV doesn't get along with the KMS driver, but kodi won't start without it.

Video playback is choppy on chromium, I suspect this is to do with KMS being disabled.

To get around neither working with the same setting, I have written a script that modifies /boot/config.txt and restarts the machine. This takes a while to boot, feels very gross, and leads to bad performance in chromium.

If anyone has better ideas I'd rather not accept this as my answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.