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 |
gamescope
Preface
I'm using endeavourOS, KDE PLasma 6.1, a RTX 3080, Wayland, and my main monitor is a Samsung Odyssey Neo G7 (3840x2560 165hz "HDR10")
Ideally, these are my launch options for each game:
gamemoderun gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 -f -e --mangoapp -- %command%
There are some issues with it:
- Steam overlay and input won't work (
-e
flag is broken) --mangoapp
won't show GPU and gamemode info- Game might freeze randomly
- Performance is incredibly low after a while
-W -H -w -h -f -b
don't do anything
and the workarounds...
Steam overlay and input
Creating a gamescope window on the terminal and attaching the game to it will work.
First I run this on a terminal:
gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 -f --mangoapp
Then set the game's launch options:
DISPLAY=:x gamemoderun %command%
Where x
is the display number, shown on the gamescope terminal output.
The game might take a while to open up and also to completely exit, but it works just fine.
mangohud and --mangoapp
Running it as mangohud
before %command%
will show GPU info but not gamemode, and apparently there are issues running it this way.
I have to investigate if I have these supposed issues, and if they are related to any config about vsync and/or framerate locks on mangohud.
Game freezing
Possibly due to HDR flags but I'm not certain. Needs a reboot for the game to open again.
I haven't had this issue in a while, might've been fixed in an update, might've been something I did.
Performance
Have to set the niceness of gamescope. Run:
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 gamescope-niceness.service
gist
Placebo flags
-W -H -w -h -f -b
don't have any effect. I can freely change my resolution and fullscreen settings ingame and it'll work just fine.
Reading gamescope's readme, it mentions:
You can spoof a virtual screen with a desired resolution and refresh rate as the only thing the game sees, and control/resize the output as needed.
This can be useful in exotic display configurations like ultrawide or multi-monitor setups that involve rotation.
Probably I can run the game on a lower resolution without impacting my desktop's resolution and use the FSR flags to upscale it. Maybe I can even downscale the game?
-r
seems funky though. Sometimes not setting it will lock the game to 60FPS, sometimes it has no effect at all.
There's also a flag to limit the max FPS but it doesn't do anything, or a setting on mangohud might be conflicting with both flags.