4K Sunshine Streaming from a non-4k host
Contents
Preamble
I mostly play games from my couch now, and I've also mostly been playing Playstation 5. But there are some games that I really want to play on my PC - but on my couch. My SteamDeck docked has been good, but it's not as beefy as I'd like - especially at 4k. I tried SteamLink for a while but the stream quality was serviceable at best.
I recently purchased Forza Horizon 4 on Steam and I really, really wanted to play it on the best settings at 4K but my SteamDeck could not handle that and SteamLink looked really average at 1080p. So I thought I'd try Sunshine and see if I could get it to work - I'd heard it looked much better than SteamLink and was a bit more flexible with settings.
After some tinkering I can confirm that Sunshine looks much nicer
streaming from my PC to my SteamDeck plugged into my 4K TV. But now
I'm wondering: "Can I stream 4k 120hz + HDR to my TV?".
I only have a 1080p display plugged into my PC, so I had no idea how
to get a 4K output captureable by Sunshine. A lot of posts online lead
to dead ends and I tried messing with xrandr to make new
modes for my existing monitors, but I couldn't get it to work.
I then finally found this Reddit post with only 14 upvotes - after some tinkering It actually worked!
Getting started
To get this working you must have an un-used port on your GPU.
The following command should output the name of unused ports on your GPU:
for p in /sys/class/drm/*/status; do
con=${p%/status};
echo -n "${con#*/card?-}: ";
cat $p;
done
You should see something like this:
DP-1: connected
DP-2: disconnected
HDMI-A-1: disconnected
HDMI-A-2: connected
Take note of one of the ports that is disconnected. In
my case it was HDMI-A-1.
Getting an EDID file
You'll then need an EDID file for the monitor you're
streaming to (or one similar). I used the
samsung-q800t-hdmi2.1 (the same as OP) which I got from
here
since it supports the features I need and that are supported by my
output TV.
Once this EDID file is downloaded you'll need to move it into
/usr/lib/firmware/edid.
sudo mkdir -p /usr/lib/firmware/edid # Create the directory if it doesn't exist
sudo mv samsung-q800t-hdmi2.1 /usr/lib/firmware/edid
Modifying Kernel parameters
Next we'll need to include this EDID file in our
/etc/mkinitcpio.conf file FILES array so
that it's loaded at boot.
FILES=("/usr/lib/firmware/edid/samsung-q800t-hdmi2.1")
and finally we'll modify /boot/grub/grub.cfg to load
this EDID file and apply to the unused output with the following
kernel parameters:
drm.edid_firmware=HDMI-A-1:edid/samsung-q800t-hdmi2.1 video=HDMI-A-1:e
Your grub.cfg should now look something like this
(I've removed entries and other parameters for brevity):
menuentry 'Distro, on linux' --class distro --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-advanced' {
[...] # Truncated for brevity
linux /boot/vmlinuz-linux drm.edid_firmware=HDMI-A-1:edid/samsung-q800t-hdmi2.1 video=HDMI-A-1:e # Append them here
echo 'Loading initial ramdisk ...'
initrd /boot/amd-ucode.img /boot/initramfs-linux.img
}
If you're not using grub you'll need to add the kernel parameters some other way.
Once you reboot your system you should now have an additional output
appearing in xrandr/sunshine reporting that
it's a 4K display.
Troubleshooting
Moving the virtual screen
You may need to run the following commands if it doesn't appear at first or is not where you expect it to be:
xrandr --output HDMI-A-1 --mode 3840x2160_120.00 --right-of DisplayPort-0 # or wherever you want it to live
The monitor may also appear in your DEs display layout settings.
Showing the virtual screen in Sunshine
For the monitor to appear in Sunshine's startup logs you'll need to navigate to Configuration > Advanced and then set "Force a specific Capture Method" to "KMS". If the capture method is not set to KMS, Sunshine will not show or be able to access the virtual screen.
You should then see the fake Samsung display in the command output when restarting Sunshine:
[2024:07:02:21:40:12]: Info: -------- Start of KMS monitor list --------
[2024:07:02:21:40:12]: Info: Monitor 2 is DP-1: AOC 24G1WG4/0x00075229
[2024:07:02:21:40:12]: Info: Monitor 1 is HDMI-A-1: Samsung Electric Company SAMSUNG/0x01000E00
[2024:07:02:21:40:12]: Info: Monitor 0 is HDMI-A-2: AOC 2460G5/GKAH4HA014907
Set the correct monitor in sunshine at Configuration > Audio/Video and restart Sunshine.
Moving windows to the virtual screen
A commenter in the thread shared the following scripts to assist in actually using the virtual screen but for now I'm using the Super + Arrow Keys shortcut, or Super + Drag action in KDE to move windows to the virtual screen. I'll create a new post if I ever do get around to setting this up properly.