GITHUB PAGES IS ONLY FOR SEARCH ENGINES! CLICK HERE TO FIND OUT WHY! IF YOU ARE ON CATWITHCODE.MOE ALREADY, YOU MAY BLOCK JS AND THATS WHY YOU SEE THIS. GOOD FOR YOU :).

Linux with HDR, Ultrawide and Sunshine? KDE 6.3!

I used Hyprland for a longer time now. I also was using tilling window managers for a few years now. But Hyprland had its issues again (most likly something I setup wrong). I reinstalled and switched to OpenSuse and tried KDE just a little and was blown away how good it now is!

I used Hyprland because of tilling and ultrawide Gaming. I use a PLP setup (2 Rotated 1080p screens and a 1440p bigger one in the middle). I open my games over gamescope in the resolution 4720x1440. And Hyprland worked with that most often the best. But not only has it a nasty left screen click bug where mouse inputs are misaligned, it also had many issues for me the last few weeks with coding, crashes and clipboard stuff.

I explain how I worked with it to show you all from were I came from. As soon as I tried out the newest KDE release 6.3.4 I noticed a big difference. THE PERFORMANCE. In the past KDE was always slow in edge cases but this time everything I threw at it worked. Giant gamescope window = no problem, weird setups of screens = easy, GPU intensive tasks and using the desktop at the same time, smooth without stutter! It sadly has no tilling (without scripts that work not all that well). But the Meta+LEFT,RIGHT,... works well enough and can be used to tile at least a little.

I only needed to set a few window rules to force windows of the class gamescope into position 0.0x50.0 and size it to 4720x1440 (and not forgetting to above all other windows) and that was it. I could game no issue with my gamescope config. I wanted my hotkey to reposition the window to work like Hyprland. My script I made in the past is incompatible with the newest Plasma 6 release. So... a lot of searching and a few changes later and it worked again too (the scripting, testing and documentation got a little better but is still really messy). I must say I really love KDE now. It works SO WELL.

HDR:

I remember I read a few weeks back that HDR now """works""" on Linux with KDE. So I checked and YES it works! Hyprland could never manage my displays correctly with HDR but KDE JUST WORKED. Then I thought, can I use it to watch stuff and checked MPV (jellyfin-mpv-shim to be precise) and YES IT ALSO WORKS! Just like that. Then I needed to test one last thing, gaming. And well. It is MEGA JANKY (https://www.reddit.com/r/kde/comments/1ampxta/comment/mhw99h3/) but it works. Then I had a really REALLY cursed idea... .

Sunshine on Linux with HDR to Linux Client with HDR HEADLESS on the HOST and using the real color mapping:

As soon as I discovered for my self Linux can do HDR, like actually do it, I switched my living room PC to Bazzite (if you are wondering, Bazzite is nice but annoying because many things a broken when you need to fix stuff. It deviates from Fedora so far that it breaks layering of packages and similar stuff. I also needed to install jellyfin-mpv-shim over pip and copy my config from my PC because Bazzite dose not come with python3-tkinter (or it is incompatible)). It works. It even fixed some of the Color bending sh*t windows had. I thought to myself, Cyberpunk on this beast of a TV with such great support would be really nice... wait as sec...

The PC in the living room is far FAR too weak for 120FPS 4k (only 60hz works because HDMI and GTX1080). And my PC is a pain to move every time. So I came up with the idea of streaming Cyberpunk 2077 from my PC with AV1 or H265 to the living room with Sunshine WITH HDR. Sunshine supports it (but only tested it on windows).

This coursed setup works. I need to do the following things:

  1. Install and configure Sunshine on my main PC. I use OpenSuse so I had to work around the missing packages. It currently is broken in the semi official repository "games:tools". It needs "libdisplaydevice0_0_0". That is semi officaly available at the "devel:libraries:c_c++" repository. It is not accepted to factory yet: (https://build.opensuse.org/package/show/games:tools/sunshine).
  2. After I got that up and running (See my old entry about "Headless_Sunshine_Hyprland_Remote" for that: Sunshine_Remote_Headless_Hyprland.html)I had to get the EDID's of my TV. That was far harder then it should have been. I tried "get-edid", getting the binary directly from the /dev/ bus, using "xrandr --verbose", using Linux, Windows and a RaspberryPi with Linux and Android but I always got the same Invalid file that would cause the fake display to be 480p... . I found these hand made EDID's from "xi784" online on GitHub (https://github.com/xi784/EDID-Emulator-Profiles) that work. I used HDR4K_120.bin and copied all details and added a few details that were different for my TV (Phillips 65oled708/12).
  3. The way to fake a display is a little different on OpenSuse. First I had to create the file import file (sudo nano /etc/dracut.conf.d/99-headless.conf). The import is this: install_items+=" /usr/lib/firmware/edid/uhdTV.bin ". Then I added it to the GRUB parameters: "drm.edid_firmware=DP-2:edid/uhdTV.bin video=DP-2:e". The e at the end is important!. And then I added the file: "sudo mv uhdTV.bin /usr/lib/firmware/edid/". AND finally I rebuild the initframes: "sudo dracut --regenerate-all --force".
  4. After one reboot the display was there. I configured it in KDE (Position, 4k, 60hz, HDR), wrote down the details how everything is setup and then disabled it.
  5. I needed to change my script a good bit because display management is very different in KDE. The long delays ARE NEEDED! Else KDE dose whatever it wantsa LOL.
  6. I added the script to the “AutoStart Login-Scripts” in KDE and added the argument "e" so it, so it would make sure under any condition it resets the Displays even after a crash.
  7. Then I added a hotkey so I have one more way to reset it. This time mid season. I also added a "e" parameter here.
  8. And then I added it to the Application in sunshine as a Undo Script with the "e" parameter.
  9. On the client I tested multiple setups and only the appimage of moonlight would work to make it use HDR. HDR needs to be enabled in the Settings of Moonlight.
  10. On the OpenSuse Host I needed to add codes (even though I hate the Packman repositories). Else the encoder would not work: sudo zypper in opi && opi codecs. For HDR your GPU on the HOST (AMD and INTEL ONLY. Nvidia is unable to work with Fake Displays because obviously the needed to break it) MUST support HEVC H265 or AV1 encoding in Hardware. H264 dose not support HDR in sunshine.
  11. Now with my “RemoteGaming_KDE_HDR.sh” script I can start sunshine on the Host and play remote. And as soon as I exit, it resets the Displays cleanly. You MUST input your exact setup into the script twice! The current values are only for my setup!
  12. I also needed to set the "Color accuracy" on client AND host to "Prefer efficiency" else it would break the HDR pipeline.

  13. To run the games I use this command. It rarely works outside of Steam (only ran once). In Steam it works nearly every time.


    gamescope --hdr-enabled --nested-refresh 165 --fullscreen --steam -w 3840 -W 3840 -h 2160 -H 2160 --force-grab-cursor -- %command%


    Or for UltraWide locally:

    LD_PRELOAD="" gamescope --hdr-enabled --nested-refresh 165 -b --steam -w 4720 -W 4720 -h 1440 -H 1440 --force-grab-cursor -- %command%

I tested some games by now and the following work beautiful with HDR (Locally and Remote, with or without UltraWide):


I noticed many issues with frame drops. It was WLAN. The only way to fix it was a LAN cable. The issue is that in my place I can not directly connect my router (believe me I f*cked it up trying once). BUT sunshine is peer 2 peer (P2P). This means after connecting the router can be ignored. Thankfully my office and living room are next to each other and with a little restructuring of my network-topology I now only need to connect on cable so the living room client has a wired connection. The switch gets its internet from a mesh node connected over WIFI. The connection start uses the router, the stream not. I even disconnected the mesh node once and everything keept streaming! Just a small tip for all not owning there home and don't have Ethernet in there walls... .

This is as much a cluster f*ck as it sounds like. And now the best part. It just works butterfly. The only issue I am unable to fix is that the priority of the KDE displays gets messed up on reset every time. That's it. Every time I do something like this I think to myself that this must be the most jank I ever did... and then I do something even worst xD. I am already exited to see what tops this level of jank.


Sources: