gamescope
Preface
I'm using endeavourOS, KDE Plasma 6.1, a RTX 3080, nvidia-open-dkms 555.58-2, Wayland.
My main monitor is a Samsung Odyssey Neo G7 (3840x2160 165hz "HDR10") and my second is a Acer Predator XB271HU (1440x2560 165hz)
Ideally, these are my launch options for each game:
gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 --force-grab-cursor -o 60 -f -e --mangoapp -- gamemoderun %command%
There are some issues with it:
- Steam overlay and input won't work (
-e
flag is broken) --mangoapp
won't show some info- Performance is incredibly low after a while
and the workarounds...
Steam overlay and input
Creating a gamescope window on the terminal and attaching the game to it will work, but HDR will be broken.
First I run this on a terminal:
gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp
I take note of the window's number on wlserver: [xwayland/server.c:107] Starting Xwayland on :2
,
then set the game's launch options:
DISPLAY=:x gamemoderun %command%
Where x
is the display number. The game might take a while to open up and also to completely exit,
but it works just fine, except for HDR.
There are some tweaks that could get HDR running, but I couldn't get it to work for me. To try it, I would run gamescope with the following variables:
DXVK_HDR=1 gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp
and the launch parameters:
ENABLE_GAMESCOPE_WSI=1 DXVK_HDR=1 DISPLAY=:1 gamemoderun %command%
but that's a no go for me. Check the GitHub issues for more info
mangohud and --mangoapp
It is recommended to run --mangoapp
if using gamescope, however it won't display any GPU info.
Running it as mangohud
before %command%
will show GPU info, but might have some other issues down the line.
On both ways, information like HDR, FSR, gamemoderun status won't be displayed at all.
Performance
When you run gamescope, you might notice on the terminal something like
No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected.
Performance WILL be affected. After a while, your game will look like a slideshow, but your frame counter will still display the FPS as normal.
That means you have to set the niceness of gamescope. Run, as sudo:
setcap 'CAP_SYS_NICE=eip' $(which gamescope)`
It seems that after a while it loses its niceness, so I made a systemd service that runs on login,
checking if the niceness is set, and setting it if it's not. Check the 01.gamescope-niceness.service
VRR
VRR (adaptive sync, GSYNC) will not work on NVIDIA cards if you have more than one monitor enabled on that card. A workaround is to have your extra monitors plugged in another GPU or on your motherboard if your CPU has an iGPU. I don't think NVIDIA has even recognised this issue.
While this is not a problem related to gamescope, mangohud or gamemoderun, I've added this section because it might come in handy.
Since I don have a second (i)GPU. I need to disable my extra monitors. I've made the 02.start-gamescope.sh
script to be run as a launch parameter on the game,
it'll start a gamescope window, turn off my extra display and start the game with gamemoderun and connecting it to the window.
When quitting the game, the script turns the extra monitor back on and properly disposes of the gamescope window.
1 | [Unit] |
2 | Description=Check gamescope niceness and set it if needed |
3 | After=network.target |
4 | |
5 | [Service] |
6 | Type=oneshot |
7 | User=root |
8 | ExecStart=/bin/bash -c 'if getcap $(which gamescope) | grep -q "cap_sys_nice=eip"; then exit 0; else setcap "CAP_SYS_NICE=eip" $(which gamescope); fi' |
9 | RemainAfterExit=yes |
10 | |
11 | ProtectSystem=full |
12 | ProtectHome=read-only |
13 | PrivateTmp=true |
14 | NoNewPrivileges=true |
15 | |
16 | [Install] |
17 | WantedBy=default.target |
1 | #!/bin/sh |
2 | |
3 | echo "########## Starting a gamescope window" |
4 | gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp & |
5 | |
6 | # trying to trap the gamescope window so it can properly quit after exiting the game |
7 | export gamescope_pid=$! |
8 | trap "echo \"########## Killing gamescope window\" && kill -- $gamescope_pid" SIGINT SIGTERM EXIT |
9 | |
10 | |
11 | sleep 1s |
12 | |
13 | if [ -n "$WAYLAND_DISPLAY" ] || [ "$XDG_SESSION_TYPE" == "wayland" ]; then |
14 | echo "########## We're Running on wayland" |
15 | export WLND=1 |
16 | fi |
17 | |
18 | sleep 1s |
19 | |
20 | echo "########## Disabling secondary monitor." |
21 | if [ $WLND ]; then |
22 | kscreen-doctor output.DP-1.disable &>/dev/null |
23 | fi |
24 | |
25 | sleep 1s |
26 | |
27 | DISPLAY=:1 gamemoderun "$@" |
28 | |
29 | sleep 1s |
30 | |
31 | echo "########## Enabling secondary monitor." |
32 | if [ $WLND ]; then |
33 | kscreen-doctor output.DP-1.enable &>/dev/null |
34 | kscreen-doctor output.DP-1.position.0,0 output.DP-3.position.1440,200 &>/dev/null |
35 | fi |
36 |