There's an interesting issue with certain Linux CPU governors that will actually bring down performance in Vulkan games. You might not need this, depending on what CPU governor you have installed.
You might end up seeing jerking or micro-stutter, far more than you would in OpenGL games. The issue is that when using OpenGL in games, you're generally taxing a single core of your CPU due to less multi-threading. With Vulkan spreading the load more, your CPU isn't being used so much.
The Linux CPU governor takes that as an opportunity to bring down your CPU performance, as right now it's not the smartest bulb in the tanning bed.
Here's what a Croteam developer said about the issue:
QuotePowersave governor is an awful choice for playing games. It may quite be the case that it's not happening for OpenGL especially because GL runs slower.
When the game is running fast enough that CPU has to wait on the GPU, the governor sees that as an opportunity to downclock the CPU, or put cores to sleep. The jerking is a result of the CPU throttling up and down very quickly.
In general, CPU governors on Linux are much, much dumber than the Windows one. (It seems that Windows overrides the throttling for all 3D apps, or similar.)
That's why we have this warning in the log. Switch over to Performance governor, at least while playing.
So a tip for now when playing Vulkan games on Linux: Set your CPU to high performance mode, you can do it like so in terminal ("performance" is just an example, see more here):
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
A higher performance mode will generally result in higher power consumption too.
Then to set it back to normal. You don't need to use "powersave" see more options here, as it's just an example. According to the Arch Wiki you likely want "ondemand" for AMD:
echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
You can find out what performance mode you're in right now by running this in terminal:
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
My default on the Intel i7 5960x is powersave, for example.
Hopefully this issue will be fixed as more games come over to Vulkan. It would be nice if developers didn't need to code around issues like this on Linux.
Quoting: poisond@liamdawe
Uh, powersave isn't the default governor, at least it shouldn't be. powersave will run your CPU at the minimum freq.
You want ondemand.
https://www.kernel.org/doc/Documentation/cpu-freq/governors.txt
I'm not 100% sure, but AFAIK, I found powersave and performance the only states implemented for my i3570K when I looked.
*edit*
http://www.phoronix.com/scan.php?page=news_item&px=MTM3NDQ
The reality is that such control algorithms are CPU specific, the notion of a generic "for all cpus" governors is just outright flawed; hardware behavior is key to the algorithm in the first place....
Last edited by Eike on 23 March 2017 at 10:45 am UTC
I would generally advise "powersave" only when battery life is a problem, to maximize its capacity (and bear with a bit of stuttering/other), maybe lower the settings a bit as well to minimize the power draw.
Now, on desktop, I think that "interactive" is the default, which is a good one IMO. I would be curious to see some comparison with "performance" on Vulkan, but I don't expect it to change the result by more than 0.5-1%, and you might have much higher idle power draw. I personally never bother to change it.
You might also want to avoid "conservative", which might have lower performance than "powersave".
That's if for the basic performance governors, but I want to point out that, while performance governors and schedulers might seem "dumb" (probably because they are well-documented, and generally don't try the one-size-fits-all approach), they are well-proven and battle tested, from small embedded devices, to Android phones, to supercomputers.
There is also more to scheduling than performance governors, and the schedulers can have a role to play as well, but I don't think that gaming is the most complex scenario to handle, so this should make little difference, except for special cases.
EDIT: Ninja'd by a bunch of people :P Also, it seems that I am confusing "ondemand" and "interactive". I can't check ATM that "interactive" is what I am using, but IIRC, it should be a bit more aggressive on frequencies than "ondemand". Not that much difference, though. And yeah, "ondemand" might be the default.
Last edited by MayeulC on 23 March 2017 at 10:49 am UTC
Quoting: M@yeulCUh? "powersave" shouldn't be the default. I think "interactive" is. It provides some sane balance between power usage and performance.My Manjaro system doesn't even have an interactive governor
I would generally advise "powersave" only when battery life is a problem, to maximize its capacity (and bear with a bit of stuttering/other), maybe lower the settings a bit as well to minimize the power draw.
Now, on desktop, I think that "interactive" is the default, which is a good one IMO. I would be curious to see some comparison with "performance" on Vulkan, but I don't expect it to change the result by more than 0.5-1%, and you might have much higher idle power draw. I personally never bother to change it.
You might also want to avoid "conservative", which might have lower performance than "powersave".
That's if for the basic performance governors, but I want to point out that, while performance governors and schedulers might seem "dumb" (probably because they are well-documented, and generally don't try the one-size-fits-all approach), they are well-proven and battle tested, from small embedded devices, to Android phones, to supercomputers.
There is also more to scheduling than performance governors, and the schedulers can have a role to play as well, but I don't think that gaming is the most complex scenario to handle, so this should make little difference, except for special cases.
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
performance powersave
QuoteDepending on the scaling driver, one of these governors will be loaded by default:
ondemand for AMD and older Intel CPU.
powersave for Intel CPUs using the intel_pstate driver (Sandy Bridge and newer).
my script is like that:
pkexec cpupower frequency-set -g performance && notify-send "Performance Mode" "Cpu clocks set to perfromance mode" -t 2000 -i messagebox_info
and other one for the ondemand mode also. pkexec is for polkit rule to not have to use root.
Quoting: KeyrockQuoting: M@yeulC...My Manjaro system doesn't even have an interactive governor
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
performance powersave
Yeah, I remembered reading the other posts that it might not be standard. I don't have my computer with me ATM, unfortunately, so I can't check, but I will do in a couple hours.
"interactive" seems to be more of a real time governor, it looks more common on Android.
What I said is generally valid about "ondemand", though it ramps up a bit slower.
My bad, here I was thinking defaults were a bit less fragmented all over the place. Hey, that's part of the Linux charm, no? :D
Quoting: KeyrockThanks for the heads up, Liam. I made two files, called gov_perf and gov_psav and copied the short scripts into them, then made them executable and copied them to usr/bin. That way I can issue the commands from any directory with a single word typed. I'm sure I could add gov_perf to launcher scripts of games so that the process is auto-magic. Now to figure out a way to make games trigger gov_psav upon exit...
Maybe setting the following Steam game launch config works...
kdesu gov_perf ; %command% ; kdesu gov_psav
(You can use whatever method you like to get privileges. kdesu is just an example)
add an non steam game (it is an steam game, but do it anyway)
echo performance | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor ;
command to launch the game ;
echo powersave | sudo tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
not tested!
See more from me