mighty_bombero

joined 10 months ago
[–] mighty_bombero@feddit.org 1 points 3 days ago* (last edited 3 days ago)

Do they now have Linux support? I thought this was limited to Windows as host at this time?

[–] mighty_bombero@feddit.org 2 points 3 days ago

This was also my motivation for investigating this. With a script like the "enable-screens.sh" you can do runtime reconfiguration of the virtual displays. Apparently this only works if the kernel is not in a "lockdown" state. So this would depend on the distribution. And you have the "Switching the screens" section. It describes how to set up an application in Sunshine so that when you connect one screen turns of and back on again when you disconnect. I hope these two points fit your requirements.

[–] mighty_bombero@feddit.org 3 points 4 days ago

Yeah, unfortunately a lot of useful information is hidden in these discord groups these days. I'd much rather see stuff like this posted and discussed on the fediverse. I used the discord to gather the necessary information and then shared the write-up back there initially.

[–] mighty_bombero@feddit.org 2 points 4 days ago* (last edited 4 days ago) (1 children)

Yes, once you disable the host's display you can target the refresh rate of the client's display. But you still might to have to change resolution in-game depending on the game, I think.

[–] mighty_bombero@feddit.org 3 points 4 days ago* (last edited 4 days ago) (3 children)

Yes. This allows the host's display to be shut down and match exactly the resolution of the target display. It also makes for a very performant dual screen setup for work. I can use my tablet with a kick-stand as second screen for a terminal session or a video with very good latency.

[–] mighty_bombero@feddit.org 3 points 4 days ago

Sure you can but you would mirror the resolution of your main display. I'm using a FHD 16:9 but stream to a 16:10 tablet and a 4k TV. So having the true resolution of the target display improves the image quality.

[–] mighty_bombero@feddit.org 3 points 4 days ago* (last edited 4 days ago)

I first had it running with the kernel parameters. For this see the second link in the introduction. The problem there was it added to boot time, as the kernel generates an error message. Passing an EDID as kernel parameter was complicated, due initramfs modification being tricky on Bazzite (at least acccording to my limited understanding). So I moved to this method where I initialize the virtual display via the KMS debug API later in the boot process. This can also be used to arbitrarily modify the virtual display. I have not looked into doing it via parameter. Can you share the example commands?

 

Virtual displays for Sunshine/Moonlight without dongle on amdgpu in Bazzite-Gnome

Introduction

Users of GPUs leveraging the amdgpu driver can create virtual displays without using any dongle for use with Sunshine. This can be done via a kernel parameter as described here and here. However we opt for bringing up the screen during multiuser-target. This has the advantage of a faster boottime and it keeps the splash screen intact.

Preparation

Install Sunshine

To install Sunshine open a terminal and enter:

ujust setup-sunshine

Identify ports

You need to identify actual ports on your GPU to map the virtual display to. The following command will list potential ports (DP-1 - DP-X, HDMI-1 - HDMI-X).

for p in /sys/class/drm/*/status; do con=${p%/status}; echo -n "${con#*/card?-}: "; cat $p; done

Any disconnected port will do.

Prepare EDID firmware to accomodate your target screen

To make the kernel aware of the proper resolution and refresh rate of your virtual display we need an EDID firmware file. This can either be retrieved for example here [1]. Alternatively you can also create a tailored EDID file with this handy tool [2]. The tool takes a modeline from xorg and generates the EDID bin from it. To get a modeline for your target resolution you can use this website [3]. To prepare and use edid-generator on Bazzite-Gnome proceed as follows in a terminal:

ujust distrobox-assemble //Choose Ubuntu
distrobox enter ubuntu
sudo apt install zsh edid-decode automake dos2unix
mkdir -p ~/build/
cd ~/build/
git clone https://github.com/akatrevorjay/edid-generator
cd edid-generator
./modeline2edid - <<< 'Modeline "2560x1600" 348.16 2560 2752 3032 3504 1600 1601 1604 1656 -HSync +Vsync' //Replace with your modeline in the single brackets
make

You should now have a .bin file named according to the content of the first brackets in the modline. Copy this into your local firmware folder. Carry on in the terminal:

mkdir -p /usr/local/lib/firmware
sudo cp 2560x1600.bin /usr/local/lib/firmware/

Test your target display

We will now create a helper script to enable your virtual display.

Open the editor of your choice and paste the following, then replace DP-2 with a non connected interface and 2560x1600.bin with your EDID file:

#!/bin/bash
cat /usr/local/lib/firmware/2560x1600.bin > /sys/kernel/debug/dri/0/DP-2/edid_override
echo on > /sys/kernel/debug/dri/0/DP-2/force
echo 1 > /sys/kernel/debug/dri/0/DP-2/trigger_hotplug

Save the file as "enable-screens.sh". Then make it available to the root user:

sudo cp enable-screens.sh /usr/local/sbin/
sudo chmod +x /usr/local/sbin/enable-screens.sh

You can now test if everything works:

sudo /usr/local/sbin/enable-screens.sh
gnome-control-center display

The control center should now start up with the display section and show the newly created display.

Automation

Automatically bring up screen via systemd

You can trigger the script on startup via a systemd unit file. For this open the editor of your choice and paste the following:

[Unit]
Description=Enable Virtual Displays

[Service]
ExecStart=/usr/bin/bash /usr/local/sbin/enable-screens.sh

[Install]
WantedBy=multi-user.target

Save under "/etc/systemd/system/enable-screens.service". Then enable the service and reboot:

sudo systemctl daemon-reload
sudo systemctl enable enable-screens.service
systemctl reboot

After the system has restarted check your display is available in control center:

gnome-control-center display

Autostarting Sunshine

Sunshine autostart is currently not working in bazzite-gnome [4]. To work around this use xdg autostart.

sudo cp /usr/share/applications/sunshine.desktop /etc/xdg/autostart/

Switching screens in Sunshine

Gnome has recently added gdctl as a tool to manipulate screen layout across X and Wayland. This can be used in a Sunlight application in "Do Command" and "Undo Command" to setup the appropriate screen configuration. I use this to enable a multiscreen setup in desktop mode, but I also have an exclusive desktop mode just on my tablet and exclusive Big Picture to my tablet.

For the multiscreen "Do Command" add (I use scale on the small tablet screen to get a readable UI):

gdctl set --logical-monitor --primary --monitor DP-1 --logical-monitor --monitor DP-2 --scale 2 --right-of DP-1

In "Undo Command":

gdctl set --logical-monitor --primary --monitor DP-1

You can now connect to the application from your device with Moonlight.

Conclusion

I hope this little guide was helpful. Please put pointers to problems and I will try to correct them in the original post. Feel free to also share your successes. Enjoy your virtual display and Sunshine/Moonlight.

[–] mighty_bombero@feddit.org 3 points 4 days ago (2 children)

I got new-lg4ff working some time ago and posted this on the Bazzite discord. I have not tried for some time though:

I managed to get new-lg4ff going at least on a per use basis. Not ideal this way but at least something. First you need to pull the driver from Github:

git clone https://github.com/berarma/new-lg4ff

Then you need a toolbox matching your base image in my case:

toolbox create --image ghcr.io/ublue-os/bazzite-gnome:testing --container bazzite-devel
toolbox enter bazzite-devel

Next you need to pull in the kernel-devel files. They are on a separate github page "kernel-bazzite". Find your running kernel version.

uname -r

Then download the appropriate kernel-devel and kernel-devel-matched from https://github.com/hhd-dev/kernel-bazzite/releases, in my case:

wget https://github.com/hhd-dev/kernel-bazzite/releases/download/6.11.5-310/kernel-devel-matched-6.11.5-310.bazzite.fc41.x86_64.rpm
wget https://github.com/hhd-dev/kernel-bazzite/releases/download/6.11.5-310/kernel-devel-6.11.5-310.bazzite.fc41.x86_64.rpm

Install them into the toolbox:

sudo rpm -if kernel-devel-matched-6.11.5-310.bazzite.fc41.x86_64.rpm kernel-devel-6.11.5-310.bazzite.fc41.x86_64.rpm

Then the build of the module should succeed. From the folder you cloned the new-lg4ff repo run:

make

To insert the module you need to relax SELINUX (against idea of SELINUX, but it is a hacky solution).

sudo setenforce Permissive

Then you should be able to insert the kernel module:

sudo insmod hid-logitech-new.ko

This is it.