gamemode icon indicating copy to clipboard operation
gamemode copied to clipboard

Steam Proton game launched with Gamemode starts with gamemode active but proccess not registered.

Open JCPersson opened this issue 2 years ago • 13 comments

Describe the bug Any steam proton game launched with gamemoderun %commdand% starts with gamemode active but gamemoded -s[pid] outputs gamemode is active but [pid] not registered. From my understanding this means that gamemode starts and does all it's optimizations, but it is not actually attached to the right process. The only effect that I have seems of this is that it makes mangohud not notice that gamemode is running on the process and display gamemode as "off", if that is all it's just an annoying cosmetic bug since I use that as an at glance reminder to turn on gamemode on newly installed games.

Sample image of issue: Screenshot_20231202_163919

To Reproduce Start any Steam Proton game with the command gamemoderun %command%

System Info (please complete the following information):

  • openSUSE Tumbleweed 20231130
  • Kernel version: 6.6.3-1-default (64-bit)
  • GameMode v1.7

Additional context This started happening on a very fresh install after a major PC upgrade; new mobo, new CPU, new GPU. So I expect that maybe there is something going on there. As you can see there has been a switch from Intel CPU with Nvidia GPU to AMD CPU with AMD GPU. Steam is not installed through Flatpak or any other sandboxing vendor.

JCPersson avatar Dec 02 '23 14:12 JCPersson

I get this as well. Running Path of Exile under ge-proton and gamemoded -s cofirms gamemode is active, but Mangohud lists it as off.

In my case I have been running the same hardware and same Arch installation for months, and while I can't say for sure when this started happening, It was sometime recently, as in in the last week or so.

radumitrescu avatar Dec 03 '23 13:12 radumitrescu

Get this with all my steam games in Linux Mint 21.2. Running gamemoded -s is telling me that gamemode is active but MangoHud is showing "gamemode off" in the overlay My startoptions in steam are gamemoderun mangohud %command%

Makoto009 avatar Dec 08 '23 09:12 Makoto009

Can I ask what GPU/CPU you two are running @Makoto009 @radumitrescu ?

JCPersson avatar Dec 10 '23 10:12 JCPersson

i7 11800H + RTX 3060

radumitrescu avatar Dec 10 '23 10:12 radumitrescu

CPU: AMD Ryzen 9 7950X3D GPU: AMD Radeon RX 6950 XT

Makoto009 avatar Dec 10 '23 12:12 Makoto009

Thanks, I guess Radumitrescu proves it's not an AMD thing.

JCPersson avatar Dec 10 '23 12:12 JCPersson

Recent Steam Linux Runtime 3.0 (sniper) update caused the Mangohud gamemode OFF change. Reverting Steam Linux Runtime 3.0 (sniper) to the previous_release under the Beta Participation dropdown menu makes Mangohud gamemode ON again.

Broken SRT 3.0 (sniper) version

#Name	Version		Runtime	Runtime_Version	Comment
depot	0.20231107.66301			# Overall version number
pressure-vessel	0.20231107.1	scout		# pressure-vessel-bin.tar.gz
scripts	0.20231107.1			# from steam-runtime-tools
sniper	0.20231107.66301	sniper	0.20231107.66301	# sniper_platform_0.20231107.66301/

Working SRT 3.0 (sniper) version

#Name	Version		Runtime	Runtime_Version	Comment
depot	0.20231016.63422			# Overall version number
pressure-vessel	0.20231013.0	scout		# pressure-vessel-bin.tar.gz
scripts	0.20231013.0			# from steam-runtime-tools
sniper	0.20231016.63422	sniper	0.20231016.63422	# sniper_platform_0.20231016.63422/

spiffeeroo avatar Dec 12 '23 20:12 spiffeeroo

Ahh yeah, that fixed it. Cool find Spiffeeroo. Then I guess I'll find their git to annoy them about the issue.

JCPersson avatar Dec 13 '23 16:12 JCPersson

I can confirm this is a steam/gamemode thing.

I have nvida gpu, amd cpu.

Starting game in lutris with gamemode and mangohud active starts gamemode and shows in mangohud. I can verify with gamemoded -s

Starting game in steam with proton (I only tried with GE) = mangohud shows not using gamemode, gamemoded -s says I do.

$ inxi -GC

CPU:
  Info: 12-core model: AMD Ryzen 9 7900X bits: 64 type: MT MCP cache:
    L2: 12 MiB
  Speed (MHz): avg: 885 min/max: 400/5733 cores: 1: 400 2: 3593 3: 400
    4: 400 5: 400 6: 400 7: 400 8: 3964 9: 400 10: 400 11: 400 12: 400 13: 400
    14: 400 15: 5300 16: 400 17: 400 18: 400 19: 400 20: 400 21: 400 22: 400
    23: 400 24: 400
Graphics:
  Device-1: NVIDIA GA102 [GeForce RTX 3090] driver: nvidia v: 545.29.06
  Device-2: AMD Raphael driver: amdgpu v: kernel
  Display: x11 server: X.Org v: 21.1.10 with: Xwayland v: 23.2.3 driver: X:
    loaded: amdgpu,nvidia unloaded: modesetting,nouveau dri: radeonsi
    gpu: amdgpu resolution: 1920x1080~60Hz
  API: EGL v: 1.5 drivers: nvidia,radeonsi,swrast
    platforms: gbm,x11,surfaceless,device
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: amd mesa v: 23.1.9-manjaro1.1
    renderer: AMD Radeon Graphics (raphael_mendocino LLVM 16.0.6 DRM 3.54
    6.6.7-1-MANJARO)
  API: Vulkan v: 1.3.269 drivers: nvidia,radv surfaces: xcb,xlib

I think there is more strange things going on with the sniper because I have problem running some native games through steam.

Reading the communication seems to indicate there is not much to do with gamemode but rather we just have to wait for fix through the sniper.

UnconnectedBedna avatar Dec 14 '23 18:12 UnconnectedBedna

I'm having this issue with retroarch (native linux) running through steam, so it's not just proton.

Buzgie avatar Dec 31 '23 23:12 Buzgie

I'm having this issue with retroarch (native linux) running through steam, so it's not just proton.

RetroArch uses Steam Linux Runtime 3.0 (sniper) for its container, so it would be effected like Proton games too. The app_mappings under Configuration for RetroArch at SteamDB includes Steam Linux Runtime (sniper).

https://steamdb.info/app/1118310/config/

spiffeeroo avatar Jan 01 '24 21:01 spiffeeroo

gamemoderun %command%, and mangohud is global via MANGOHUD=1 Same thing, I've queried all pids and gamemode is registered only on:

  • /home/me/.local/share/Steam/ubuntu12_32/reaper SteamLaunch AppId=480490 -- /home/me/.local/share/Steam/ubuntu12_32/steam-launch-wrapper -- /home/me/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper/_v2-entry-point --verb=waitforexitandrun -- /usr/share/steam/compatibilitytools.d/proton-ge-custom/proton waitforexitandrun /home/me/.local/share/Steam/steamapps/common/Prey/Binaries/Danielle/x64/Release/Prey.exe
  • /home/me/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/libexec/steam-runtime-tools-0/srt-bwrap --args 31 /usr/lib/pressure-vessel/from-host/bin/pressure-vessel-adverb --generate-locales --fd 21 --regenerate-ld.so-cache /var/pressure-vessel/ldso --add-ld.so-path /usr/lib/pressure-vessel/overrides/lib/x86_64-linux-gnu --add-ld.so-path /usr/lib/pressure-vessel/overrides/lib/i386-linux-gnu --set-ld-library-path /usr/lib/pressure-vessel/overrides/lib/x86_64-linux-gnu/aliases:/usr/lib/pressure-vessel/overrides/lib/i386-linux-gnu/aliases --overrides-path /usr/lib/pressure-vessel/overrides --exit-with-parent --subreaper --assign-fd=1=6 --assign-fd=2=7 --shell=none --terminal=none --ld-preload=libgamemodeauto.so.0 --ld-preload=/home/me/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so --ld-preload=/home/me/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so -- /home/me/.local/share/Steam/steamapps/common/SteamLinuxRuntime_sniper/pressure-vessel/bin/steam-runtime-launcher-interface-0 container-runtime /usr/share/steam/compatibilitytools.d/proton-ge-custom/proton waitforexitandrun /home/me/.local/share/Steam/steamapps/common/Prey/Binaries/Danielle/x64/Release/Prey.exe

Which looks okay to me, but magohud doesn't detect it. Also gamemoded's pid is in between those two if it says anything.

System:

Kernel: Linux 6.10.5-arch1-1
CPU: Intel(R) Core(TM) i5-7600K (4) @ 4.20 GHz
GPU: AMD Radeon RX 6600

qwelias avatar Aug 18 '24 18:08 qwelias

Workaround

For affected Steam games, don't use gamemoderun. Instead, set LD_PRELOAD to include the absolute path to libgamemodeauto.so.0.

Example Steam launch options for a game:

LD_PRELOAD="/usr/\$LIB/libgamemodeauto.so.0${LD_PRELOAD:+:$LD_PRELOAD}" mangohud %command%

Alternative

You could also edit gamemoderun to use the absolute path. If you use a distro package of gamemode that provides /usr/bin/gamemoderun, I'd suggest making an edited copy in /usr/local/bin/gamemoderun.

/usr/local/bin/gamemoderun:

#!/usr/bin/bash
# Helper script to launch games with gamemode

# Modified to use absolute path
# https://github.com/FeralInteractive/gamemode/issues/443
GAMEMODEAUTO_NAME="/usr/\$LIB/libgamemodeauto.so.0"

# ld will find the right path to load the library, including for 32-bit apps.
LD_PRELOAD="${GAMEMODEAUTO_NAME}${LD_PRELOAD:+:$LD_PRELOAD}"

exec env LD_PRELOAD="${LD_PRELOAD}" $GAMEMODERUNEXEC "$@"

With this, you can continue to use gamemoderun mangohud %command%

Of course, you have to remember to review this copy in case the script changes in future versions of gamemode.

Notes

This specifically affects games running in Steam Linux Runtime 3.0 (sniper), which includes all Proton 8.0 and above, and some Linux-native games (e.g. CS2, Dota 2).

The absolute path is mentioned in gamemoderun manual. However gamemoderun itself uses a relative path. See here for the practical differences.

This part ${LD_PRELOAD:+:$LD_PRELOAD} means: if variable LD_PRELOAD is empty or unset, insert nothing; if it is not empty, insert :$LD_PRELOAD (colon, then the value of the variable). So there is no stray colon.

See also man ld.so for the meaning of $LIB in LD_PRELOAD. The $ is escaped because it isn't a shell variable. There is no need to set different 32-bit and 64-bit lib path manually.

jn64 avatar Oct 06 '25 07:10 jn64