Last active 1719781480

Virkkunen's Avatar Virkkunen revised this gist 1719781480. Go to revision

1 file changed, 8 insertions, 1 deletion

00.gamescope_tips.md

@@ -93,4 +93,11 @@ While this is not a problem related to gamescope, mangohud or gamemoderun, I've
93 93
94 94 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,
95 95 it'll start a gamescope window, turn off my extra display and start the game with gamemoderun and connecting it to the window.
96 - When quitting the game, the script turns the extra monitor back on and properly disposes of the gamescope window.
96 + When quitting the game, the script turns the extra monitor back on and properly disposes of the gamescope window.
97 +
98 + Run it by marking the script as executable `chmod +x start-gamescope.sh`
99 + and setting your game's launch parameter as
100 +
101 + ```sh
102 + /path/to/your/start-gamescope.sh %command%
103 + ```

Virkkunen's Avatar Virkkunen revised this gist 1719781357. Go to revision

2 files changed, 94 insertions, 44 deletions

00.gamescope_tips.md

@@ -2,23 +2,24 @@
2 2
3 3 ## Preface
4 4
5 - I'm using endeavourOS, KDE Plasma 6.1, a RTX 3080, Wayland, and my main monitor is a Samsung Odyssey Neo G7 (3840x2160 165hz "HDR10")
6 -
5 + I'm using endeavourOS, KDE Plasma 6.1, a RTX 3080, nvidia-open-dkms 555.58-2, Wayland.
6 +
7 + My main monitor is a Samsung Odyssey Neo G7 (3840x2160 165hz "HDR10") and my second is a Acer Predator XB271HU (1440x2560 165hz)
8 +
7 9 ---
8 -
10 +
9 11 Ideally, these are my launch options for each game:
10 12
11 13 ```sh
12 - gamemoderun gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 -f -e --mangoapp -- %command%
14 + 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%
13 15 ```
14 16
15 17 There are some issues with it:
16 18
17 19 - Steam overlay and input won't work (`-e` flag is broken)
18 - - `--mangoapp` won't show GPU and gamemode info
19 - - Game might freeze randomly
20 + - `--mangoapp` won't show some info
21 + - xwayland might crash or game might freeze
20 22 - Performance is incredibly low after a while
21 - - `-W -H -w -h -f -b` don't do anything
22 23
23 24 ## and the workarounds...
24 25
@@ -26,64 +27,70 @@ There are some issues with it:
26 27
27 28 [GitHub issue](https://github.com/ValveSoftware/gamescope/issues/835)
28 29
29 - Creating a gamescope window on the terminal and attaching the game to it will work.
30 + Creating a gamescope window on the terminal and attaching the game to it will work, but HDR will be broken.
30 31
31 32 First I run this on a terminal:
32 33
33 34 ```sh
34 - gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 -f --mangoapp
35 + gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f --mangoapp
35 36 ```
36 37
37 - Then set the game's launch options:
38 + I take note of the window's number on `wlserver: [xwayland/server.c:107] Starting Xwayland on :2`,
39 + then set the game's launch options:
38 40
39 41 ```sh
40 42 DISPLAY=:x gamemoderun %command%
41 43 ```
42 44
43 - Where `x` is the display number, shown on the gamescope terminal output, example:
44 -
45 - `wlserver: [xwayland/server.c:107] Starting Xwayland on :2`
46 -
47 - In this case, the launch option would be `DISPLAY=:2`
48 -
49 - The game might take a while to open up and also to completely exit, but it works just fine.
50 -
51 - ### mangohud and --mangoapp
52 -
53 - Running it as `mangohud` before `%command%` will show GPU info but not gamemode, and apparently there are issues running it this way.
54 -
55 - 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.
56 -
57 - ### Game freezing
45 + Where `x` is the display number. The game might take a while to open up and also to completely exit,
46 + but it works just fine, except for HDR.
58 47
59 - Possibly due to HDR flags but I'm not certain. Needs a reboot for the game to open again.
48 + Apparently this is needed for HDR to work this way: https://github.com/Zamundaaa/VK_hdr_layer,
49 + and adding `ENABLE_GAMESCOPE_WSI=1 DXVK_HDR=1` on the game's launch parameters, before `gamemoderun`
60 50
61 - I haven't had this issue in a while, might've been fixed in an update, might've been something I did.
51 + ### mangohud and --mangoapp
62 52
63 - ### Performance
53 + It is recommended to run `--mangoapp` if using gamescope, however it won't display any GPU info.
54 + Running it as `mangohud` before `%command%` will show GPU info, but might have some other issues down the line.
55 + On both ways, information like HDR, FSR, gamemoderun status won't be displayed at all.
64 56
65 - Have to set the niceness of gamescope. Run:
57 + ### Crashes and freezes
66 58
67 - ```sh
68 - sudo setcap 'CAP_SYS_NICE=eip' $(which gamescope)`
69 - ```
59 + From time to time xwayland will crash in many ways.
60 + 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.
61 + This is the softest of the crashes because I can simply reopen Steam and the game without issues.
70 62
71 - It seems that after a while it loses its niceness, so I made a systemd service that runs on login
63 + 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).
64 + I have to restart my PC in this case.
72 65
73 - checking if the niceness is set, and setting it if it's not. Check the [gamescope-niceness.service](gamescope-niceness.service) gist
66 + There are some bug reports about these issues on bugs.kde.org, gamescope GitHub, NVIDIA drivers GitHub and forums,
67 + 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,
68 + please do so on the proper channels.
74 69
75 - ### Placebo flags
76 -
77 - `-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.
70 + ### Performance
78 71
79 - Reading gamescope's readme, it mentions:
72 + When you run gamescope, you might notice on the terminal something like
73 +
74 + `No CAP_SYS_NICE, falling back to regular-priority compute and threads. Performance will be affected.`
80 75
81 - > 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.
82 - >
83 - > This can be useful in exotic display configurations like ultrawide or multi-monitor setups that involve rotation.
76 + 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.
77 +
78 + That means you have to set the niceness of gamescope. Run, as *sudo*:
84 79
85 - 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?
80 + ```sh
81 + setcap 'CAP_SYS_NICE=eip' $(which gamescope)`
82 + ```
86 83
87 - `-r` seems funky though. Sometimes not setting it will lock the game to 60FPS, sometimes it has no effect at all.
84 + It seems that after a while it loses its niceness, so I made a systemd service that runs on login,
85 + checking if the niceness is set, and setting it if it's not. Check the `01.gamescope-niceness.service`
88 86
89 - 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.
87 + ### VRR
88 +
89 + VRR (adaptive sync, GSYNC) will **not** work on NVIDIA cards if you have more than one monitor enabled. There are no solutions, no workarounds,
90 + and I don't think NVIDIA has even recognised this issue.
91 +
92 + While this is not a problem related to gamescope, mangohud or gamemoderun, I've added this section because it might come in handy.
93 +
94 + 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,
95 + it'll start a gamescope window, turn off my extra display and start the game with gamemoderun and connecting it to the window.
96 + When quitting the game, the script turns the extra monitor back on and properly disposes of the gamescope window.

02.start-gamescope.sh(file created)

@@ -0,0 +1,43 @@
1 + #!/bin/sh
2 +
3 + echo "########## Starting a gamescope window"
4 + # change where necessary, like the resolution an refresh rate
5 + gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 --hdr-sdr-content-nits 300 -f &
6 +
7 + # trying to trap the gamescope window so it can properly quit after exiting the game
8 + export gamescope_pid=$!
9 + trap "echo \"########## Killing gamescope window\" && kill -- -$gamescope_pid" SIGINT SIGTERM EXIT
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 + # run kscreeen-doctor and check your displays arrangement
23 + # and change where necessary
24 + kscreen-doctor output.DP-1.disable &>/dev/null
25 + fi
26 +
27 + sleep 1s
28 +
29 + # I know that gamescope will always create a display on 2 for me
30 + # run the gamescope window on a terminal and take note of which number it is
31 + DISPLAY=:2 mangohud gamemoderun "$@"
32 +
33 + # the script will "pause" here while the game is running
34 + # and will resume from the next `sleep` after you quit the game
35 +
36 + sleep 1s
37 +
38 + echo "########## Enabling secondary monitor."
39 + if [ $WLND ]; then
40 + # again, run kscreen-doctor and check the display arrangement
41 + kscreen-doctor output.DP-1.enable &>/dev/null
42 + kscreen-doctor output.DP-1.position.0,0 output.DP-3.position.1440,200 &>/dev/null
43 + fi

Virkkunen's Avatar Virkkunen revised this gist 1719679540. Go to revision

2 files changed, 5 insertions, 1 deletion

gamescope_tips.md renamed to 00.gamescope_tips.md

@@ -40,7 +40,11 @@ Then set the game's launch options:
40 40 DISPLAY=:x gamemoderun %command%
41 41 ```
42 42
43 - Where `x` is the display number, shown on the gamescope terminal output.
43 + Where `x` is the display number, shown on the gamescope terminal output, example:
44 +
45 + `wlserver: [xwayland/server.c:107] Starting Xwayland on :2`
46 +
47 + In this case, the launch option would be `DISPLAY=:2`
44 48
45 49 The game might take a while to open up and also to completely exit, but it works just fine.
46 50

gamescope-niceness.service renamed to 01.gamescope-niceness.service

File renamed without changes

Virkkunen's Avatar Virkkunen revised this gist 1719667222. Go to revision

1 file changed, 1 insertion, 1 deletion

gamescope_tips.md

@@ -66,7 +66,7 @@ sudo setcap 'CAP_SYS_NICE=eip' $(which gamescope)`
66 66
67 67 It seems that after a while it loses its niceness, so I made a systemd service that runs on login
68 68
69 - checking if the niceness is set, and setting it if it's not. Check the `gamescope-niceness.service` gist
69 + checking if the niceness is set, and setting it if it's not. Check the [gamescope-niceness.service](gamescope-niceness.service) gist
70 70
71 71 ### Placebo flags
72 72

Virkkunen's Avatar Virkkunen revised this gist 1719666779. Go to revision

1 file changed, 4 insertions, 2 deletions

gamescope_tips.md

@@ -2,8 +2,10 @@
2 2
3 3 ## Preface
4 4
5 - 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")
6 -
5 + I'm using endeavourOS, KDE Plasma 6.1, a RTX 3080, Wayland, and my main monitor is a Samsung Odyssey Neo G7 (3840x2160 165hz "HDR10")
6 +
7 + ---
8 +
7 9 Ideally, these are my launch options for each game:
8 10
9 11 ```sh

Virkkunen's Avatar Virkkunen revised this gist 1719666718. Go to revision

2 files changed, 100 insertions

gamescope-niceness.service(file created)

@@ -0,0 +1,17 @@
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_tips.md(file created)

@@ -0,0 +1,83 @@
1 + # gamescope
2 +
3 + ## Preface
4 +
5 + 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")
6 +
7 + Ideally, these are my launch options for each game:
8 +
9 + ```sh
10 + gamemoderun gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 -f -e --mangoapp -- %command%
11 + ```
12 +
13 + There are some issues with it:
14 +
15 + - Steam overlay and input won't work (`-e` flag is broken)
16 + - `--mangoapp` won't show GPU and gamemode info
17 + - Game might freeze randomly
18 + - Performance is incredibly low after a while
19 + - `-W -H -w -h -f -b` don't do anything
20 +
21 + ## and the workarounds...
22 +
23 + ### Steam overlay and input
24 +
25 + [GitHub issue](https://github.com/ValveSoftware/gamescope/issues/835)
26 +
27 + Creating a gamescope window on the terminal and attaching the game to it will work.
28 +
29 + First I run this on a terminal:
30 +
31 + ```sh
32 + gamescope -W 3840 -H 2160 -r 165 --hdr-enabled --hdr-itm-enable --hdr-itm-sdr-nits 300 -f --mangoapp
33 + ```
34 +
35 + Then set the game's launch options:
36 +
37 + ```sh
38 + DISPLAY=:x gamemoderun %command%
39 + ```
40 +
41 + Where `x` is the display number, shown on the gamescope terminal output.
42 +
43 + The game might take a while to open up and also to completely exit, but it works just fine.
44 +
45 + ### mangohud and --mangoapp
46 +
47 + Running it as `mangohud` before `%command%` will show GPU info but not gamemode, and apparently there are issues running it this way.
48 +
49 + 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.
50 +
51 + ### Game freezing
52 +
53 + Possibly due to HDR flags but I'm not certain. Needs a reboot for the game to open again.
54 +
55 + I haven't had this issue in a while, might've been fixed in an update, might've been something I did.
56 +
57 + ### Performance
58 +
59 + Have to set the niceness of gamescope. Run:
60 +
61 + ```sh
62 + sudo setcap 'CAP_SYS_NICE=eip' $(which gamescope)`
63 + ```
64 +
65 + It seems that after a while it loses its niceness, so I made a systemd service that runs on login
66 +
67 + checking if the niceness is set, and setting it if it's not. Check the `gamescope-niceness.service` gist
68 +
69 + ### Placebo flags
70 +
71 + `-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.
72 +
73 + Reading gamescope's readme, it mentions:
74 +
75 + > 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.
76 + >
77 + > This can be useful in exotic display configurations like ultrawide or multi-monitor setups that involve rotation.
78 +
79 + 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?
80 +
81 + `-r` seems funky though. Sometimes not setting it will lock the game to 60FPS, sometimes it has no effect at all.
82 +
83 + 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.
Newer Older