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, I've only tested these instructions on Arch. Know what you're doing or have backups before applying to Fedora.
π 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
. -
Reboot.
π 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), and force NVIDIA: Right-click game > Properties > General > Launch Options >
gamemoderun __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
Game Mode configures the CPU governer, scheduler, and process niceness for maximum performance for games. To enable Game Mode:
- First enable the multilib repo if you haven't already. Edit
/etc/pacman.conf
to add
[multilib] Include = /etc/pacman.d/mirrorlist
- Run
pacman -Syy
to update your repositories. - Install
lib32-gamemode
withpacman -S lib32-gamemode
link to library. - Install
gamemode
withpacman -S gamemode
. - Add
gamemoderun
to the beginning of your Steam game Launch Options. - Create a new user group with
groupadd -r gamemode
. - Add yourself to the group with
usermod -a <yourUserName> -G gamemode
. - Edit system security limits for users
nano /etc/security/limits.conf
to add the line:
@gamemode - nice 10
This will enable user accounts that are members of the gamemode group to increase (or 'renice') processes up to a value of 10.
- Now test everything is working by running
gamemoded -t
and fix any errors (hopefully none).
Note: you can check whether Game Mode is active with gamemoded -s
from a command line. For more information on Game Mode and an example config (ini) file see the Arch Wiki.
π 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
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/dGPU AMD_VULKAN_ICD="RADV" QT_QPA_PLATFORMTHEME="qt5ct" MOZ_ENABLE_WAYLAND=1 # Enable AMD ACO shader compiler threading 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 rendering. Still in development, will probably crash! #VKD3D_CONFIG=dxr11 #VKD3D_CONFIG=dxr # Pascal speed hack for Vulkan for all games. This should make a big difference # however _may_ cause problems in some games. If it does for you, move it from # here to steam Launch Options. VKD3D_CONFIG=force_static_cbv # Enable DLSS. This is still fairly new. PROTON_ENABLE_NVAPI=1 PROTON_HIDE_NVIDIA_GPU=0 # 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 # 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 performance -f cpu -D 30c:80,40c:80,50c:80,60c:180,70c:180,80c:180,90c:220,100c:220
to set the CPU fan curve.asusctl fan-curve -m performance -f gpu -D 30c:80,40c:80,50c:80,60c:180,70c:180,80c:180,90c:220,100c:220
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 run
gamemoded -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?
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=dxr11
orVKD3D_CONFIG=dxr
enables RTX/raytracing support. I haven't had any success with this, it's caused some games to not start up after enabling RTX, and manually having to disable RTX in the games.ini
. Raytracing support is still in development, so proceed with caution.__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
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