# 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: ```sh gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -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 - xwayland might crash or game might freeze - Performance is incredibly low after a while ## and the workarounds... ### Steam overlay and input [GitHub issue](https://github.com/ValveSoftware/gamescope/issues/835) 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: ```sh 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: ```sh 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. Apparently this is needed for HDR to work this way: https://github.com/Zamundaaa/VK_hdr_layer, and adding `ENABLE_GAMESCOPE_WSI=1 DXVK_HDR=1` on the game's launch parameters, before `gamemoderun` ### 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. ### Crashes and freezes From time to time xwayland will crash in many ways. When there's a lot going on in my games and performance might be taking a hit, the game and Steam will simply close immediately. This is the softest of the crashes because I can simply reopen Steam and the game without issues. Sometimes the game will freeze or my entire desktop will freeze (this one also happens randomly when I'm dragging a window or starting a game). I have to restart my PC in this case. There are some bug reports about these issues on bugs.kde.org, gamescope GitHub, NVIDIA drivers GitHub and forums, but no one knows why or how it happens, and many times it's hard to get logs. If you happen to have these issues and can provide logs or useful information, please do so on the proper channels. ### 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*: ```sh 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. There are no solutions, no workarounds, and 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. By disabling any extra monitor, VRR will work again. 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. Run it by marking the script as executable `chmod +x start-gamescope.sh` and setting your game's launch parameter as ```sh /path/to/your/start-gamescope.sh %command% ```