Kodi Community Forum

Full Version: What is the current "state of the art": Window manager yes/no, GBM, Wayland or X11?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I run Kodi appliance-like on standard intel hardware (system boots directly into Kodi). Mainly according to some instructions here on the forum, I use a systemd unit which starts a X11 session with OpenBox as window manager and Kodi in OpenBox's autostart.
As Ubuntu at last also phases out X11, I was wondering, what is the best way to run a Kodi appliance nowadays? Do I need a window manager (Arch's instructions e.g. do not use one)? X11 or Wayland? I somewhere found that Wayland does not allow resolution switching? Or is GBM the way to go?
Any hints for me?
(2021-05-16, 18:28)Nosepull Wrote: [ -> ]I run Kodi appliance-like on standard intel hardware (system boots directly into Kodi). Mainly according to some instructions here on the forum, I use a systemd unit which starts a X11 session with OpenBox as window manager and Kodi in OpenBox's autostart.
As Ubuntu at last also phases out X11, I was wondering, what is the best way to run a Kodi appliance nowadays? Do I need a window manager (Arch's instructions e.g. do not use one)? X11 or Wayland? I somewhere found that Wayland does not allow resolution switching? Or is GBM the way to go?
Any hints for me?

To reply to myself: I tried out gbm and it seems to work a bit snappier than X11. However, the color range seems to be limited instead of fullrange. With X11 I can use xrandr to enable full range, where can I find instructions fpr gbm?
I thought I read somewhere that GBM is the goal long-term.  Here is a roadmap: https://github.com/xbmc/xbmc/issues/14876
You mentioned that Ubuntu is phasing out X11?  I didn't search to confirm via an official statement but that seems odd.
I took a stab at section detailing differences between X11, Wayland, and GBM: https://wiki.archlinux.org/title/Kodi#Installation
(2021-05-17, 05:52)Nosepull Wrote: [ -> ]the color range seems to be limited instead of fullrange.
You can use libdrm proptest tool to enable full range on GBM.
 Also, why use Ubuntu if you boot directly to Kodi? LibreELEC would be a perfect choice for this.
(2021-05-17, 12:20)graysky Wrote: [ -> ]You mentioned that Ubuntu is phasing out X11?  I didn't search to confirm via an official statement but that seems odd.
As of Ubuntu 21.04, the default desktop install uses only Wayland.
(2021-05-17, 16:13)smp1 Wrote: [ -> ]
(2021-05-17, 05:52)Nosepull Wrote: [ -> ]the color range seems to be limited instead of fullrange.
You can use libdrm proptest tool to enable full range on GBM.
 Also, why use Ubuntu if you boot directly to Kodi? LibreELEC would be a perfect choice for this.

Thanks for the hint with proptest, I'll try that.
As the Kodi box also serves as multi-purpose homeserver, a standard Ubuntu install seemed more apropriate in my case.
OK, after some more looking into it:
As "proptest" has no manpage, I found some instructions here: https://www.brad-x.com/2017/08/07/quick-...n-wayland/. Maybe of interest for others.
Concerning Ubuntu and Wayland, it is not a secret: https://www.omgubuntu.co.uk/2021/01/ubun...by-default.
So I guess also Kodi will have to leave X11 behind at some time - X11 is considered legacy as long as I know about it ;-). LibreELEC seems to go with GBM (https://libreelec.tv/2021/02/upcoming-changes/), so I thought that will be the way ahead also for my custom installation.
Apart from the hints given by @graysky , however, I seem to find only outdated information on the pros and cons of the different configuration options.
I’m seeing GBM/Wayland as the way forward in the not too distant future.
I took @graysky 's Arch systemd-units and @fritsch 's original instructions as templates for my Kodi situation (running appliance-like on a Ubuntu 21.04 server) and came up with the following systemd unit which seems to work at the moment:

[Unit]
Description=Kodi standalone
After=remote-fs.target systemd-user-sessions.service network-online.target nss-lookup.target 
After=sound.target polkit.service upower.service
Wants=network-online.target polkit.service upower.service
Wants=emby.service tvheadend.service
[email protected]

[Service]
User=kodi
Group=users
PAMName=login
TTYPath=/dev/tty1
StandardInput=tty
StandardOutput=journal
TimeoutStopSec=30sec
Restart=on-abort

#GBM
Environment=WINDOWING=gbm
ExecStartPre=/usr/bin/proptest -M i915 -D /dev/dri/card0 109 connector 97 1
ExecStart=/usr/bin/kodi-standalone --windowing=gbm
SupplementaryGroups=input

#X11
#Environment=WINDOWING=x11
#ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1
#ExecStartPost=/usr/bin/xrandr -display :0 --output DP-1 --set "Broadcast RGB" "Full"
#ExecStartPost=/usr/bin/xsetroot #000000
#ExecStartPost=/usr/bin/xset s off -dpms
#ExecStart=/usr/bin/xinit /usr/bin/kodi-standalone -- :0 -quiet -nolisten tcp vt1

ExecStop=/usr/bin/killall --user kodi --exact --wait kodi.bin

[Install]
Alias=display-manager.service
WantedBy=multi-user.target

Obviously, the way I switch to fullrange color is not very elegant, but the ouput of propset is not usable for parsing with my limited bash knowledge, so I hardcoded the command I need. (I still do not really understand the implications of full and limited range, but for me full-full-full looks good and sound better than limited-full-limited, which also seems to be a viable option ;-) .)
I also introduced a shorter stop timeout in order to kill a hung-up Kodi faster. I guess if the shutdown of Kodi takes longer than 30secs, something is wrong.
Moreover I use "monit" to keep the kodi service reliably running. 

Maybe this is helpful for others...
(2021-05-18, 05:53)Nosepull Wrote: [ -> ]Maybe this is helpful for others...

This has been super helpful for me to get Kodi standalone running with GBM. Thanks for posting the update.
Still trying to figure out the proptest and colour range(not sure if i even need to!) stuff but delighted to have it up and running.
(2021-05-17, 16:36)Nosepull Wrote: [ -> ]As of Ubuntu 21.04, the default desktop install uses only Wayland.

This isn't dropping X11 as much as following Gnome's direction. It doesn't work well in some cases though obviously. Multi monitor fails when trying to move Kodi to another screen with it's built in configuration. I currently run Gnome with X11 to bypass this. I believe the other DE's still default to X11.