New to Linux and the open source world? We have compiled a huge list of resources to help you go through Linux and its distributions. Visit the full Linux guide page right now.
Linux has been historically known for its less-than-Windows performance in terms of gaming. We have drivers issues, game platforms issues, and performance issues altogether everywhere. Still, having an OK-ish gaming experience on Linux is quite possible. And this is nice for people who do not want to dual-boot both Windows and Linux to do different tasks.
Most Linux users today either enjoy their games via Steam, which has 25% of its games supporting Linux out-of-the-box and the other 75% possibly supporting it with Proton, or with Wine and complement libraries and software. There are some other gaming platforms on Linux such as GOG and others. We won’t talk about how to install those platforms on Linux now, but instead, in today’s article, we’ll give you some tips on how to enhance your gaming performance regardless of how you are running them.
Tips for Better Gaming on Linux
Grab the Latest Drivers
This must be the very first straightforward thing to think of if you are planning to do gaming on Linux. Graphics drivers on Linux are usually not always “feature-complete” whenever they are released, meaning that they are simply just like Windows and you install them and it’s done, no. Instead, the performance of those drivers gradually increases with each new version and until it reaches a good level that can compete with Windows. This applies to both NVIDIA and AMD.
AMD provides its drivers as open source, and they are integrated in the Linux kernel and other default packages under the name
AMDGPU, and also provides a proprietary driver named
AMDGPU-PRO, but the latter isn’t really needed in most cases (doesn’t offer improved FPS rate). Where as NVIDIA doesn’t provide its drivers as open source (There’s a community-backed open source driver called
nouveau, but it isn’t supported by NVIDIA and its performance is poor for gaming), so you’ll have to get the proprietary NVIDIA drivers for a good gaming experience.
Getting the latest versions of these two varies a lot depending on the Linux distribution you are using.
For NVIDIA users, you can always grab the latest binary NVIDIA drivers from the official website here, or possibly search your distribution’s official repositories for already prepared packages of those drivers.
For AMD users (And also NVIDIA users who would like to use the open source driver, and also the Intel users), since its drivers are open source, then you’ll need to get the latest Mesa packages installed (and kernel too, more to come later). Mesa is a famous 3D graphics library for Linux that allows various applications and games to communicate with the actual graphics hardware via implementing various APIs to all the major vendors (AMD, Intel and NVIDIA). In other much simpler words, you need to install the latest versions of Mesa in order to get the latest open source graphics APIs and libraries in order to increase performance and possibly solve previous bugs and issues.
This also depends on what Linux distribution you are using. In general, it’s recommended that you switch into using a rolling-release model distribution such as Arch or Manjaro if you are mainly only interested in gaming, so that you can get the latest versions of these packages. However, you are not forced to. You can use the Oibaf PPA on Ubuntu and all its derivatives to get the latest Git versions of Mesa and many other packages. For Fedora, usually you don’t need to do any extra effort, as they already try to ship the latest stable versions in their official repositories. Same is true for openSUSE Tumbleweed users, and for other versions you can check the Xorg repository.
Install the Latest Kernel
The Linux kernel you are using can also affect performance, too.
What we mentioned before in the “drivers” section wasn’t accurately about the drivers, it was about updating and installing whatever was implementing the OpenGL graphics rendering engine for you, which is what we can call the “software side” of the things. However, there’s also a kernel-side of the drivers which contains the actual real drivers for the hardware you are using. Those ones get updated between each kernel release and can possibly enhance performance or even allow your GPU to unlock its full power on Linux after it wasn’t doing so.
Getting the latest kernel is tricky. For Ubuntu users, you can get them via manually grabbing the DEB packages from the Kernel Mainline. Simply choose the latest stable available version (currently 5.5), open its folder in that page, and download the
linux-modules-generic packages under the
Build for amd64 section and install them, and then reboot your system.
You can make sure you are running the latest version using the
uname -a command in the terminal after you reboot. (It should be the same version that you downloaded and installed).
Rolling release distributions such as Arch and Manjaro typically have the latest kernel versions already in few days since their release, so you just have to continuously update them. For Fedora users, you can grab your packages from here.
Set CPU Governor to Performance
The CPU governor is simply put, the controlling algorithm for how you CPU clock frequency should be set while running. There are many possible CPU governors under Linux, which are:
- Ondemand: Check the current system load and whether it may require higher frequency or not.
- PowerSave: Put the CPU frequency on the lowest possible.
- Performance: Put the CPU frequency on the highest possible.
- Userspace: The CPU frequency is determined by the user or his root applications.
- Conservative: Similar to
ondemand, but gradually increases or decreases the frequency when needed instead of instantly setting it.
Now, where’s the issue, you may ask? The issue is that in most Linux distributions out there, the governor is always set to
ondemand sadly doesn’t unlock your full CPU power when running games, so the performance decreases dramatically, especially if you were running on an integrated graphics card where the CPU would have to render the graphics. You need to set the CPU governor to
The easiest way to do that is (if you were using GNOME Shell) to use the CPUfreq extension. It’s a very nice extension that allows you to set your CPU governor to whatever you like. If you are not using GNOME, then you can use some GUI programs like CPUPower-GUI.
If you prefer the command line, then first install the
cpufrequtils package, and then run the following commands:
echo 'GOVERNOR="performance"' | sudo tee /etc/default/cpufrequtils sudo systemctl disable ondemand
Then check if it enhances your performance or not.
Check Your Graphics Card Isn’t Being Suppressed by the OS
This applies to dedicated AMD cards.
It sounds that there’s some weird issue where the Linux kernel (or its default configurations) always try to suppress the GPU in order to keep it cool, regardless of the workload you are requiring from it. For example, for my graphics card, it was keeping my GPU clock speed on 300MHz, which is extremely low. But then after I made a change, my system now uses its full power at 1750MHz, and the difference in games is unbelievable.
This is because of a small configuration flag that can be set either on
high to determine how to use the GPU. You can grab the current status of that flag via the following command (Make sure to become root):
You can also get a full output of your current GPU status via:
For me, right now it gives me the following parameters about my GPU:
GFX Clocks and Power:
300 MHz (MCLK)
377 MHz (SCLK)
600 MHz (PSTATE_SCLK)
1000 MHz (PSTATE_MCLK)
750 mV (VDDGFX)
30.101 W (average GPU)
Now, let us set it on
echo high > /sys/class/drm/card0/device/power_dpm_force_performance_level
And see the huge difference:
GFX Clocks and Power: 1750 MHz (MCLK) 1360 MHz (SCLK) 600 MHz (PSTATE_SCLK) 1000 MHz (PSTATE_MCLK) 1131 mV (VDDGFX) 46.154 W (average GPU)
The performance effect in games can sometimes reach 100 FPS because of this. However, you shouldn’t always leave your GPU on
high, as it drains unnecessary power. When you don’t need it, turn it back to
echo auto > /sys/class/drm/card0/device/power_dpm_force_performance_level
I think similar thing happens too for NVIDIA and Intel cards, but I didn’t research about them as I have no hardware to test on. You should search about that yourself if you have cards from them.
Test Various Desktop Environments
This can be strange, but the desktop environment you are using can also affect your gaming performance.
XFCE for example is a very gorgeous desktop, but XFCE suffers a very serious bug that causes it to lose so many frames compared to other desktop environments when running games. I still don’t know about the reason or the cause behind this, but people have been recommending turning compositing off when playing games, which isn’t really a nice thing to do every time.
A good user on Reddit took the matter further, and provided a detailed benchmark of his tests for games on various desktop environments. Cinnamon and XFCE were the worst ones for gaming in terms of results:
So make sure your desktop environment is correctly configured and isn’t affecting your gaming experience.
So we have reached the end of our post. The Linux gaming performance is OK compared to Windows after applying those tips, but the sad reality is that still in 2020, as Linux users, we have to dig our own roads and do our own experiments in order to reach a satisfying performance we can live with. While on Windows, an average user simply installs the drivers and runs whatever games he/she wants.
This is mainly because of the small userbase of Linux, which may not exceed %1 of all operating systems users. Vendors see very little in value return compared to what they’ll need to invest to fully support Linux and its drivers. Perhaps they are right, if we are looking at it from a business point of view, and perhaps they are wrong, if we look into it from a customer point of view.
In anyway, the gaming experience on Linux is becoming better and better. NVIDIA drivers 10 years ago sucked hardly, and Optimus technology wasn’t fully supported. AMD (or ATi back then) had horrible bugs in their drivers too, but all of that is getting better, as we enter a new decade of better support for our favorite OS choice.
If you have any gaming experiences on Linux, I would love to hear about them in the comments below.