GameMode is a new daemon/lib combo for Linux that will allow you to optimize your PC for gaming. It’s not magic, it won’t suddenly make your Linux games suddenly get better performance, but it’s something that can help.
You might have seen a message box pop up with some more recent Linux ports from Feral Interactive, one that tells you that your current CPU governor is not optimised—like this:
When games end up waiting on the GPU, some CPU performance governors may downclock the CPU and then up it again later, which can result in performance problems. GameMode, as it is right now, is to help you with that. Curious about it and wanting to know a little more direct from the developers, Feral agreed to answer some quick questions I had about it:
1) Can you give us a rundown on what exactly GameMode is and why Linux gamers might need it?
“GameMode is a daemon/library combo for Linux, written in C, which allows games to request that a set of optimisations be temporarily applied to the host OS. These optimisations improve the performance of the game.
To apply these optimisations, some of our games require that users manually swap the CPU governor using sudo privileged commands. We've had some feedback from people saying that they'd prefer not to have to do so much setup in order to get the best performance from their game. Further to this, some users voiced concerns about the increased energy usage that might result from leaving the CPU in a higher power usage mode.
By automatically applying these optimisations when the game is running and removing them when it isn't, GameMode saves users the trouble of having to tinker. It also ensures that the CPU is restored to a more efficient state when they've finished playing.”
2) You say it is "intended to be expanded beyond just CPU governor states", what extras did you have in mind?
“A lot of good ideas have been put forward by beta testers, including de-activating tools like f.lux, swapping KWin from OpenGL to xrender, and changing users' chat client status to "Playing X". GameMode is Open Source, so pull requests, or forks with features like these are welcome.”
3) To be clear for our readers, is this something that will ship built-in with Feral games and will users have to do any manual steps to enable it?
“GameMode won't ship with the games; since it's open source, users will need to install it themselves using the steps on GitHub. The tool will only need to be installed once, and will work with all future Linux titles released by Feral.
It will also work with previously released games, provided users adjust their launch options on Steam.”
It’s currently under a “BSD 3-Clause License (Revised)” license and you can find out more on GitHub. It’s certainly going to be interesting to see how this project evolves over time, could end up being something extremely useful. It already made its way to the AUR for Arch users.
Once you've installed it using their instructions, you can then tell any game to use it by doing this command:
LD_PRELOAD=/usr/\$LIB/libgamemodeauto.so ./game
You can also add it as a Steam launch option for each of your games like so:
LD_PRELOAD=$LD_PRELOAD:/usr/\$LIB/libgamemodeauto.so %command%
If you wish to know what current CPU governor is in use, you can run this command in terminal:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
I actually had pre-announcement access to it and testing it has given me some good early results. Obviously this will be game and hardware dependent and yes, all tests were done over multiple runs to ensure it wasn't a fluke.
Testing it with F1 2017 for example, gave these FPS results:
That might not look like a big difference, however, behind the FPS results are the frame timings:
Without Game Mode | With Game Mode | |
---|---|---|
Min Frame Time | 10.32ms | 10.03ms |
Average Frame Time | 13.31ms | 11.88ms |
Max Frame Time | 19.36ms | 16.02ms |
As you can see, it has helped to reduce frame timings while increasing the overall framerate, so using GameMode (or manually using performance mode) can have an impact resulting in a smoother game. Using GameMode instead of doing it manually, does have the benefit of your CPU reverting to a more power efficient mode afterwards of course.
Testing Deus Ex: Mankind Divided was a slightly different story, as it always gave a better minimum FPS score when using GameMode, but the average and maximum showed little difference—certainly still worth it though! As for frame timings, the built-in benchmark doesn't give them.
Company of Heroes 2 is similar to Deux Ex with the benchmark mode only giving FPS scores. During my testing, both in the benchmark mode and actually playing it, the difference was noticable when using GameMode—with it being much smoother overall:
Again, to stress, your results will depend on your hardware and it's no different to manually changing your CPU governor to performance—for now (until they do more with it), although it does bring it back down to powersave or ondemand automatically which is nice.
Rise of the Tomb Raider will be the first game from Feral to have support for it integrated, so you won't need to give it any special launch options. However, you still need to install the tool yourself.
It’s great to see Feral Interactive do more open source projects, as they already have their game launcher scripts up on GitHub too.
Feral wrote "The first Feral release to integrate the tool is Rise of the Tomb Raider, an incredible action-adventure coming to Linux this month." But Liam is testing it with other games. What does that mean? In the moment, it has to be trigger manually, and starting with Rise of the Tomb Raider, it will do automatically if it finds the daemon?For Rise, it has code built-in to detect GameMode and apply it. Other games need the launch arguments to apply it.
What I meant was it should be automatic. No need for human intervention, no need to install a separate program.
Governor can't know what your needs are. ondemand in theory should do the job already, but it's not good enough for some demanding games. Running in performance all the time is not good because it uses CPU more heavily consuming more power and reducing CPU lifetime. So it should only happen when you really need it and it's up to you to switch it. I suppose some more intelligent switching between those modes could be built into the system indeed, but for now it's manual.
Last edited by Shmerl on 10 April 2018 at 11:54 am UTC
What I meant was it should be automatic. No need for human intervention, no need to install a separate program.
That's what governors like "ondemand" are supposed to do, but don't always succeed in.
Last edited by Eike on 10 April 2018 at 11:54 am UTC
What I meant was it should be automatic. No need for human intervention, no need to install a separate program.
That's what governors like "ondemand" are supposed to do, but don't always succeed in.
Just for the reference, when cores are loaded evenly, ondemand works well. When cores are loaded unevenly, ondemand misses scaling. I noticed it with dxvk. When dxvk wasn't saturating cores well, switching to performance boosted framerate in TW3 (Ryzen 7 1700X). But when dxvk added a fix to use memory differently and started loading all cores better - switching to performance wasn't changing anything, meaning that ondemand started working as it should.
Last edited by Shmerl on 10 April 2018 at 11:58 am UTC
ondemand also isn't a thing with newer Intel CPUs. There's only powersave and performance.What I meant was it should be automatic. No need for human intervention, no need to install a separate program.
That's what governors like "ondemand" are supposed to do, but don't always succeed in.
Just for the reference, when cores are loaded evenly, ondemand works well. When cores are loaded unevently, ondemand misses scaling. I noticed it with dxvk.
There seems to be a lot of confusion on this, the default shipping in Ubuntu for newer Intel chips is powersave. Likely because they don't split their download between desktop and laptops.
There's likely a majority of users on newer Intel chips on powersave on their desktop, without knowing.
For archlinux users I created some aur packages.
Did you find a way to test it?
I've been using it for a month or so. I'm the person who wrote the original PKGBUILD file that's in the gamemode git repo.
ondemand also isn't a thing with newer Intel CPUs. There's only powersave and performance.
There seems to be a lot of confusion on this, the default shipping in Ubuntu for newer Intel chips is powersave. Likely because they don't split their download between desktop and laptops.
There's likely a majority of users on newer Intel chips on powersave on their desktop, without knowing.
Interesting. For Ryzen I only see "schedutil", "ondemand" and "performance".
Last edited by Shmerl on 10 April 2018 at 12:00 pm UTC
Indeed, different CPU and different governor. See here.ondemand also isn't a thing with newer Intel CPUs. There's only powersave and performance.
There seems to be a lot of confusion on this, the default shipping in Ubuntu for newer Intel chips is powersave. Likely because they don't split their download between desktop and laptops.
There's likely a majority of users on newer Intel chips on powersave on their desktop, without knowing.
Interesting. For Ryzen I only see "schedutil", "ondemand" and "performance".
Nice, now we need a way to force the clocks of the GPU :P
easy with nvidia :D
nvidia-settings --assign [gpu:0]/GPUPowerMizerMode=1
so:
pkexec cpupower frequency-set -g performance && nvidia-settings --assign [gpu:0]/GPUPowerMizerMode=1 && nvidia-settings -a [gpu:0]/GpuFanControlState=1 -a [fan:0]/GPUTargetFanSpeed=45 && notify-send "Performance Mode" "CPU set to Performance & GPU fan 45%" -t 2000 -i messagebox_info
something like that :)
I guess this won't do much for us AMD-users since they don't usually default to "powersave"? When I used Ubuntu 17.10 I think it defaulted to "ondemand" with my Ryzen 1700X, and now I'm on Debian Sid which seems to default to "performance".
Edit: I just realized the latter could be because I run a custom kernel.
I want to say that my Ryzen on Ubuntu 17.10 only has powersave and performance for options, the default being powersave.
Edit: I just checked. The default is ondemand, but powersave is an option as is performance, conservative, and schedutil.
Last edited by Audi on 15 April 2018 at 9:51 pm UTC
Why isn't it getting fixed?
It's not easy, probably. It involves prediction (which is hard especially when it concerns the future, they say ;) ). Question is, may I throttle down the processor, or will it be needed in full power in a bunch of nanoseconds?
I wonder why there isn't an overclocking tool for the GPU like the ones available for Windows.
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.29.0
Source dir: /home/user/gamemode
Build dir: /home/user/gamemode/build
Build type: native build
Build machine cpu family: x86_64
Build machine cpu: x86_64
Project name: gamemode
Native c compiler: cc (gcc 5.4.0-6ubuntu1)
Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".
It refuses to compile for me, followed the instructions to the letter, scratching my head right now, any help would be appreciated.
./bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.29.0
Source dir: /home/user/gamemode
Build dir: /home/user/gamemode/build
Build type: native build
Build machine cpu family: x86_64
Build machine cpu: x86_64
Project name: gamemode
Native c compiler: cc (gcc 5.4.0-6ubuntu1)
Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".
It refuses to compile for me, followed the instructions to the letter, scratching my head right now, any help would be appreciated.
/home/"user"? Is that correct?
Edit.. ok forget it! :)
Last edited by Nevertheless on 10 April 2018 at 3:47 pm UTC
I guess I should have said I edited the output to remove my name../bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.29.0
Source dir: /home/user/gamemode
Build dir: /home/user/gamemode/build
Build type: native build
Build machine cpu family: x86_64
Build machine cpu: x86_64
Project name: gamemode
Native c compiler: cc (gcc 5.4.0-6ubuntu1)
Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".
It refuses to compile for me, followed the instructions to the letter, scratching my head right now, any help would be appreciated.
/home/"user"? Is that correct?
Ah, excellent, now to find the newer version. :D./bootstrap.sh
+ meson --prefix=/usr build -Dwith-systemd-user-unit-dir=/etc/systemd/user
The Meson build system
Version: 0.29.0
Source dir: /home/user/gamemode
Build dir: /home/user/gamemode/build
Build type: native build
Build machine cpu family: x86_64
Build machine cpu: x86_64
Project name: gamemode
Native c compiler: cc (gcc 5.4.0-6ubuntu1)
Meson encountered an error in file meson.build, line 32, column 0:
Unknown function "join_paths".
It refuses to compile for me, followed the instructions to the letter, scratching my head right now, any help would be appreciated.
Update Meson.
You are using 0.29, but the join_paths function was added in version 0.36.
Thanks Corralx & Nevertheless. :D
See more from me