Skip to content

Black/Frozen Screen When Launching Game (Ubuntu) [Fix] #4

@ViddleShtix

Description

@ViddleShtix

Spent probably 30+ figuring this out.... This is what works for me and I have no idea if it will work for others but hopefully this will help someone out.

I'm on PopOS 22.04 but this should apply to Ubuntu as well. Note: This is for Xorg and probably will not work if you are using Wayland.

Download/install the official Ubuntu EVDI/DisplayLink drivers from the DisplayLink website at https://www.synaptics.com/products/displaylink-graphics/downloads/ubuntu by clicking Download under "Latest Official Driver". Extract. Make the .run file executable with chmod +x *.run (replace *.run with the actual path). Reboot.

Set EVDI to have 1 initial monitor:
sudo modprobe evdi initial_device_count=1

Now you should have a new EVDI device. The one on my machine that is being used is DVI-I-2-1 but yours might be DVI-I-1-1. Check with:
ls /sys/class/drm/ | grep card

It will probably look something like:
card3-DVI-I-2 (I don't know why it doesn't have the extra -1 here).

Modify your sunshine.conf file for headless mode which will automatically create new virtual monitors:
nano ~/.config/sunshine/sunshine.conf

Add these lines:
headless_mode = true
capture = x11

Ctrl + o, enter, ctrl + x to save and exit nano (reason for capture = x11 will be explained after).

Now, the reason why the screen goes black/hangs when Moonlight launches a game is because DisplayLink does not support mirrored mode when using virtual displays. Here's how to get around it with a udev rule that will set any new display to be an extension rather than mirroring.

sudo nano /etc/udev/rules.d/95-monitor-hotplug.rules

Add this line to the new file:
ACTION=="change", SUBSYSTEM=="drm", RUN+="/home/brad/extend_display.sh"

Save and exit nano.

nano ~/extend_display.sh

Add this (make sure DVI-I-2-1 is the right card from the previous command):
#!/bin/bash
export DISPLAY=:0
export XAUTHORITY=~/.Xauthority
sleep 1
xrandr --output DVI-I-2-1 --auto --right-of HDMI-0

Again save and exit nano.

Now run the following commands to make it executable and reload the rules:
chmod +x ~/extend_display.sh
sudo udevadm control --reload-rules

One last thing, we also need to disable fractional scaling which also seems to cause the screen to hang. Run this to make it default to disabled (persists after reboot):
gsettings set org.gnome.mutter experimental-features "[]"

Finally, why did we set capture = x11? For some reason when using the default capture mode, NvFBC, I had an almost imperceptible micro stutter in my games, but it was still noticeable and annoying me. Changing capture mode to x11 solved this issue, and I don't care to figure out why.

If all goes to plan your games should now run correctly at the proper screen size/fps/refresh rate and your main screen should not be frozen. If not, check your Apollo logs and make sure you're using the right virtual display.

If you are having stuttering in your games when streaming 4k, refer to my other bug report.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions