SammiLucia here 😊
I was trying to play several new games on Linux and quickly became obvious there aren't many clear, up-to-date examples of how to configure Linux for optimal gaming.
First of all, I'd like to address that there are several distros purported to be built for gaming. While this may be true for many people, unfortunately if you're on newer hardware, in general those distros do not give you the most current kernel or packages, which will undoubtedly cause you problems...
We recommend Fedora, followed by Arch for gaming. Fedora probably takes the least work to get going. Also be aware Manjaro is only loosely based on Arch so we don't recommended it. If you're on PopOS! and Ubuntu and having great success—great! However we don't recommend these distros, either.
Thanks to Leopard on the asus-linux Discord for your help with this guide 😊
Arch?
Note, this was originally written for Arch, and adapted for Fedora. Please let me know in the Discord if you find any ploblems.
Fedora
I'm now using Fedora, which does a lot of the prep for games for you (as you'd expect with Fedora). The /etc/environment
settings are still useful, however, as well as the Mutter VRR patch.
Contributing
Please feel free to contribute! I most certainly am not the expert on this topic, just trying to work out how to play games! 😊
Updates should be posted to this blog article, please also update the Changelog below.
Prerequisites
-
This guide assumes you have the latest NVIDIA drivers installed and working correctly. Version 5.10.xx at the time of writing.
-
The guide also assumes you have a kernel with FSYNC enabled, this means either kernel 5.17 or higher, or Xanmod. Xanmod enables FSYNC, and Intel Clear patches, and some other performance chages, and generally has the lastest performance (and possibly hardware) updates.
-
If your distro doesn't yet have the 5.17 kernel (you can check with
uname -r
), you can install Xanmod by following the instructions here for Arch, or it should be fairly easy to find a recent Xanmod built for your distro. -
To enable vsync passthrough (depending on how well a game implements its vsync), add
nvidia-drm.modeset=1
to theGRUB_CMDLINE_LINUX_DEFAULT
line in/etc/default/grub
-
You can also reduce mouse latency by adding
usbhid.mousepoll=1
toGRUB_CMDLINE_LINUX_DEFAULT
. Note this is probably broken since kernel 4.4.x, however it shouldn't hurt to add it. -
Regenerate grub by running
grub-mkconfig -o /boot/grub/grub.cfg
on Arch, orgrub2-mkconfig -o /etc/grub2.cfg
on Fedora. -
Reboot.
Gnome/Wayland Mutter
If your screen has FreeSync or supports variable refresh rate (VRR) and you use Wayland (you really should use Wayland) ensure you're running the latest Mutter (version 42.5.vrr or higher on Fedora 36 at the time of writing).
This might take a while to get merged into Gnome proper, in the meantime you can install the Mutter VRR patch from here: https://copr.fedorainfracloud.org/coprs/kylegospo/gnome-vrr/.
This fixes a bunch of potential screen/cursor lags, as well as halved refresh rates on external monitors. I've been on the beta for several weeks and it's been great.
Steam configuration
- Install the latest Steam, login and download your games
- If you want Steam to start with certain command line options, create a file
~/.config/steam-runtime-flags.conf
and put the options in there. (Note: if this doesn't work for you, you may need to modify theExec
in thesteam.desktop
shortcut. There are a few ways to list flags... I find one per line clearest, e.g: - In Steam > Settings > Steam Play > Enable Steam Play for all other titles > Proton Experimental
- Force the new game to run with Proton Experimental: Right click the game > Properties > Compatibility > Force the use of a specific Steam Play compatibility tool > Proton Experimental
- Change the Launch Options for the game to
enable gamemode (see below), andforce NVIDIA: Right-click game > Properties > General > Launch Options >__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia __VK_LAYER_NV_optimus=NVIDIA_only VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json %command%
Enable Game Mode scheduling
gamemode
is no longer needed, there's no advantage over the regular performance
governer/scheduler.
Enable saving the Shader Cache
By default the Shader Cache will generate every time a game is launched. To enable saving of the Shader Cache:
- Right-click game > Properties > Shader Pre-Caching > Check Enable Shader Pre-Caching AND Allow background processing of Vulkan shaders:
The Shader Cache should now start generating and saving the cache for that game.
Fix laggy screen updates
Note: This has caused a problem for at least one person. I also don't know how it interacts with the latest Mutter VRR
For whatever reason (maybe me not understanding something) vblank_mode=0
still leaves me with a weird laggy display and screen tearing. This fix shouldn't hurt and it works for me. Do:
- Create a new config file with
nano /etc/drirc
. - Add the following to the file:
<driconf>
<device>
<application name="Default">
<option name="vblank_mode" value="0" />
</application>
</device>
</driconf>
- Reboot.
Using environment variables instead
If you don't want to specify launch options for every single game you can put known safe options into /etc/environment
so they are enabled during login. To do this:
- Create and edit the file with
nano /etc/environment
if it doesn't already exist. - Add your desired options, for example:
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#
# Configure AMD. Only required if you have AMD iGPU and/or dGPU
# "AMDVLK" = AMD's Vulkan driver
# "RADV" = mesa's RADV driver (recommended)
AMD_VULKAN_ICD="RADV"
# Force AMD ACO shader compiler threading (may cause instability in some games)
# Note: mesa alredy enables this for some games. See here for the whitelist:
# https://cgit.freedesktop.org/mesa/mesa/tree/src/util/00-mesa-defaults.conf
#mesa_glthread=true
# Set video decode to AMD. This should be set automatically since 12.0.1 of
# libva-mesa-driver. This is only in here for testing.
#VDPAU_DRIVER="radeonsi"
# Enable raytracing (VKD3D-proton). Recommended with RADV above (not AMDVLK).
# Recommendation is to use RADV built from Git.
VKD3D_CONFIG=dxr,dxr11
#RADV_PERFTEST=rt # uncomment for AMD
# Pascal speed hack for Vulkan. This could make a big difference for a game but
# is best enabled per in Steam Launch options because it may cause problems.
# You can try it per game in the game launch options.
#VKD3D_CONFIG=force_static_cbv
# Enable DLSS for NVidia.
PROTON_ENABLE_NVAPI=1
PROTON_HIDE_NVIDIA_GPU=0
PROTON_ENABLE_NGX_UPDATER=1
# AMD FidelityFX Super Resolution (FSR) for Vulkan games (dxvk and vkd3d-proton
# included) and Proton Experimental or ProtonGE. Some games may not need this
# setting.
#WINE_FULLSCREEN_FSR=1
# The amount of FSR sharpening to be applied: 5 being the default, 2 is AMD's
# recommendation.
#WINE_FULLSCREEN_FSR_STRENGTH=5
# Compensate for compositing Window Managers:
# 1 = Display _previous_ rendered frame. Highest FPS, but higher latency
# 2 = Display _latest_ rendered frame, better latency, but _possibly_ lower FPS
PRIMUS_SYNC=2
# Enable shader disk cache per game instead of regenerating the cache at every
# game launch. The disk cache path should no longer be required, however if
# the shader cache is being regenerated each launch, try specifying it.
__GL_SHADER_DISK_CACHE=1
#__GL_SHADER_DISK_CACHE_PATH=/var/cache/shaders # Change to suit your system
# Enable threaded optomisation for OpenGL.
__GL_THREADED_OPTIMIZATION=1
- In the above example you would still use the Launch Options above to force the use of NVIDIA. Using Launch Options this way enables you to still run some games on the iGPU, so you can play less demanding games on battery.
Asus fan settings
If you are on a recent Asus notebook, see asus-linux.org for guides on how to properly configure NVIDIA drivers and support for configurable fan curves.
I use the following commands to set fan curves for the Performance power profile with asusctl. You don't need sudo
for these:
asusctl fan-curve -m "balanced" -f cpu -D "20c:0%,40c:0%,50c:0%,60c:5%,70c:15%,80c:40%,90c:70%,100c:80%
to set the CPU fan curve.asusctl fan-curve -m "balanced" -f gpu -D "20c:0%,40c:0%,50c:0%,60c:5%,70c:15%,80c:40%,90c:70%,100c:80%
to set the GPU fan curve.
Lutris installation
Warning: For me, installing Lutris made games run worse. I don't yet know why, however games became extremely choppy and unplayable. Removing Lutris fixed this(!)
With all the above config, you actually shoudln't need Lutris.
You can install Lutris, which provides a single interface for all your games, and runs games with community optimised settings.
To install, do:
pacman -S lutris python-magic
- Ensure your Steam profile and games list is set to public. This is how Lutris discovers your games list. (Everything else can be set to private.)
Run a game, and rungamemoded -s
to check gamemode is still active while launching a game from Lutris.
That should be it! Run Lutris to start and configure games from Lutris. If you have any problems, you can run lutris -d
to see what might be going on.
What do the flags do?
Note: This has caused a problem for at least one person. I also don't know how it interacts with the latest Mutter VRR
vblank_mode=0
prevents Proton for trying to wait for vblank (the next screen redraw), which depending on a number of factors (desktop environment, and your specific config), it may not even get. This can lead to a really weird tearing effect. If you don't see this problem, you do not need to enable this flag. This may vary by game, depending on how each game has implemented vsync (i.e: "well", or "poorly").__NV_PRIME_RENDER_OFFLOAD=1
causes VK_LAYER_NV_optimus (Vulkan) to be loaded. I'm not sure this is needed any more.__GLX_VENDOR_LIBRARY_NAME=nvidia
together with__NV_PRIME_RENDER_OFFLOAD=1
forces OpenGL to choose the NVIDIA driver.__VK_LAYER_NV_optimus=NVIDIA_only
together with__NV_PRIME_RENDER_OFFLOAD=1
forces Vulkan to choose the NVIDIA driver.
"Experimental" flags
VKD3D_CONFIG=dxr,dxr11
enables RTX/raytracing support. This may cause some games to not start up, but has worked great for me. It works a lot better on NVidia than AMD when last I tested. Raytracing support is still in active development.__GL_THREADED_OPTIMIZATION=1
allows the NVIDIA driver to work multithreaded for OpenGL only (not Vulkan), however be aware threading is not always good! As a rule of thumb if the GPU is under heavy burden, this may actually decrease FPS.
Futher reading
- Lutris docs - a list of many launch flags.
- Gaming - ArchWiki the Arch Wiki may have some other tweaks. Please note the section on
schedule
andscheduled
should not be required with Game Mode (unverified). - Xanmod kernel - including the Asus ROG patches from (Asus Linux)[https://asus-linux.org/]
Changelog
20-Sep-22:
- Stupid typow
- Added Mutter VRR patch
19-Sep-22:
- Added Mutter
- Added Fedora note
- Removed
gamemode
, no longer requireed - Added FSR settings
- Cleaned up/clarified
/etc/environment
- Added warning about
vblank_mode
- Added grub command for Fedora
- Updated fan curves
15-Apr-22:
- Moved to asus-linux.org website
- Updated for 5.17 kernel and NVidia 5.10.x drivers
- Added warning about non Arch/Fedora distros
29-Dec-21:
- Added changelog
- Enabled launching of some games on iGPU
- Added warning about Lutris
- Fixed fan curve typos
28-Dec-21:
- Added Lutris
27-Dec-21 #2:
- Added renice
- Added gamemode
- Added renice fix
- Added fan curves
- Added vblank fix
27-Dec-21 #1:
- Initial version