Sometimes OpenGL Is All You Have
OpenGL is a great way to create cross-platform 3D rendering without having to port everything. If a developer is trying to publish a game for Windows, Linux, and Mac, the traditional path of least resistance is to focus the most finesse on the largest demographic (Windows, DirectX) and port the game using OpenGL for everyone else. Since OpenGL doesn’t communicate as directly with the GPU as DirectX and Vulkan, this leads to more reliance on the CPU and therefore slightly diminished performance in many situations. Since MoltenVK now exists for Mac and people can run Vulkan on all popular operating systems, what API you use is a matter of choice. Newer game developers can choose to forego OpenGL entirely and just rely on Vulkan. Unfortunately, a large number of games ported to Linux will still rely on OpenGL, which cannot match the performance of DirectX in situations where high performance is crucial.
Vulkan Still Has Things to Overcome
Linux’s answer to DirectX, Vulkan, is the brainchild of over 170 organizations and independent developers who as a community decided to provide a high-performance low-level API usable on all platforms. Since its release in February 2016, it’s become a juggernaut and (pun very much intended) game-changer for graphics developers the world over, punching far above its weight, and in many instances, surpassing the performance of DirectX. That’s all well and good, but if you’re experiencing stuttering on a game that was ported for Linux using the Vulkan API, this grand achievement may not impress you so much. Indeed, Vulkan has a few shortcomings, not the least of which is on-screen stability. An analysis published by HWRIG that compares performance between Windows’ DX12 and Vulkan using benchmarking tools demonstrates that although Vulkan achieves 5 percent higher average frame rates than DX, its minimum frame rate drops lower. What this translates to in real world use is an increased occurrence of stuttering when dealing with intense graphical load. That being said, it’s still important to note that Vulkan can be fantastic when a game is designed around it as opposed to being ported as an afterthought. A good example of this is Valheim, a survival sandbox released in February 2021. Forcing the game to run on Vulkan increases performance remarkably compared to DX12.
It Might Not Even Be GPU-Related
In Linux, just as in Windows, your CPU’s performance is affected by the system’s power management settings. If you’re playing a game that’s CPU-heavy without using much of the GPU (e.g., a grand-strategy map-painting game like Hearts of Iron or Europa Universalis) and experiencing a drop in performance, then Linux might be pushing your CPU to the “powersave” governor. This happens often if you’re on a laptop that’s running on battery. For the most part, modern CPUs and the powersave governor work fine together but still sometimes provide noticeable input lag when gaming. To counteract this, you could use auto-cpufreq to make laptops more battery efficient and increase your CPU performance by quickly switching the governor to “performance” when it’s most needed.
Linux Ports Are Still (Largely) an Afterthought
Although Linux’s share in the pie of all desktop platforms has seen a steady rise in the last decade to a current value of 2.4%, that’s still very low compared to the juggernauts it’s competing with of Apple and Microsoft. Unfortunately, this means that many game developers will quickly port their product to Linux without paying too much attention to optimization. At that point, they are focused on the release deadline more than they are on appeasing a potential two-point-something percent of the playerbase. Performance issues aside, in the years following the mid 2010s, the Linux gaming community has achieved quite a lot of love in the form of very acceptable options for gameplay and improved performance as a product of both Linux developers’ efforts and those of the games’ publishers themselves.
Graphics Driver Issues
The first thing we have to get out of the way if you’re not experiencing the same performance on a ported game as you would on its version for any other system is your graphics driver. If you’re using Noveau or any other default open-source driver, this is your most likely culprit. To get the best framerate possible on your games, barring any other limitations, you need to install the latest drivers for your GPU. If you’re using an Nvidia card on Ubuntu or any other Debian-based Linux distribution, have a look at our guide to learn how to install the proprietary drivers.
Dual Monitor Woes
If you’re using two monitors on your distro and are frustrated by poor FPS performance when you’re trying to play games in general, unplug one of them and restart your game. Are you suddenly getting deliciously buttery-smooth performance? Should your answer be “yes,” then you may be able to help this issue by fiddling a little bit with Nvidia’s graphics settings. Sometimes, display scaling doesn’t work very well when using dual-monitor setups, so it may help to move that work over to the GPU itself. To do this, go to Nvidia’s control panel, navigate to “Adjust desktop size and position” and select “GPU” from the drop-down menu under “Perform scaling on.” After you’ve done this, if you’ve still not noticed any increase in performance, make sure you don’t have any other bottlenecks in your hardware. Check that you have enough CPU power and RAM to run the game and render whatever you have on your other monitor. In the worst case scenario, you’ll have to live with turning your second monitor off before running a game until you’re able to clear the hardware bottleneck.
1. Is OpenGL generally bad?
Just because Vulkan and DX surpass OpenGL in performance overall doesn’t make the latter irrelevant. Games that don’t rely primarily on very detailed graphical environments (like Factorio, EU IV, HoI4, etc.) don’t need the extra performance achieved by lower-level APIs. Porting it all to Vulkan doesn’t make sense from a development standpoint in those cases because it creates a lot of tedium that could be avoided by using something simple like OGL. From a developer’s perspective, if you can avoid using Vulkan or DirectX to squeeze performance into your game, you can focus more on polishing your product before release and maintaining it afterward. This is an invisible benefit to the player that manifests itself in the form of a better overall gaming experience.
2. What is a CPU governor?
The CPU’s governor is an operating system’s way of telling the CPU what range of clock frequencies it should use. The performance governor will always tell your CPU to suck up as much juice as it wants to do as it pleases. Conversely, a power-saving governor will put the reins on your CPU to prioritize lower power usage.
3. What else can I do to improve gaming performance on Linux?
Aside from the advice given in this article, here are a few more things that could help:
Update your drivers to ensure that the OS knows how to communicate with your GPU most effectively.Keep your kernel up to date so that Linux is best equipped to work safely and efficiently with your hardware.Try out different desktop environments, like KDE, GNOME, Budgie, or LXDE. You may notice better performance in some. I’ve personally noticed some performance issues with XFCE in graphical environments, and a large number of Linux users have reported the same, which is why I did not mention this desktop environment.
Wrapping Up
It’s important to put things into perspective: Linux is not the perfect operating system for gamers, but it’s also many times better than the competition. As developers take those coming from the Linux world in their communities more seriously, they’re making larger efforts to optimize their games for the OS. Since its rockier moments in the early 2000s, Linux has made considerable strides in multiple departments and it’s just now starting to flourish as an operating system that’s welcoming to those who want to bring their games over. A lot of credit also has to go to Steam for developing Proton, which makes use of libraries like VKD3D to make games that were exclusive to Windows fully playable on Linux. You can also take part in this by visiting the discussion boards of your favorite games and making your voice heard as a Linux gamer. It’s important to let developers know that their non-Windows demographic consists of actual people and not just some tiny segment of their usage and purchase statistics. You should also check out the key features that make monitors great for gaming.