Difference between revisions of "Improving performance"
Line 3: | Line 3: | ||
== Major tweaks == | == Major tweaks == | ||
This will give a ''huge'' boost for all games. If your presets are bad, this could easily double your performance: | This will give a ''huge'' boost for all games. If your presets are bad, this could easily double your performance: | ||
*[https://github.com/lutris/docs/blob/master/InstallingDrivers.md Install the correct drivers]. | *[https://github.com/lutris/docs/blob/master/InstallingDrivers.md Install the correct drivers, especially if you have an Nvidia graphics card (GPU)]. | ||
**If you don't have an Nvidia GPU, you likely won't need to do this. | |||
*If you use X11, [[Compositor|disable composition]]. | *If you use X11, [[Compositor|disable composition]]. | ||
**X11 is the default on most Ubuntu-based beginner distros like Pop OS! | |||
*Set GPU and CPU to maximum performance. This might not always be necessary, but will give large improvements in some cases. Definitely try it if you notice stuttering or input lag. | *Set GPU and CPU to maximum performance. This might not always be necessary, but will give large improvements in some cases. Definitely try it if you notice stuttering or input lag. | ||
**CPU: You can use [[Gamemode|GameMode]] or [[CoreCtrl]] to do this. | **CPU: You can use [[Gamemode|GameMode]] or [[CoreCtrl]] to do this. | ||
**GPU: Read the AMD/Nvidia specific tweaks section to see how. | **GPU: Read the AMD/Nvidia specific tweaks section to see how. | ||
*[[Misc#Watching the temperature|Look at your thermals]] and if they are too high, adapt the fan speed. | *[[Misc#Watching the temperature|Look at your thermals]], and if they are too high, adapt the fan speed. | ||
==Minor tweaks== | ==Minor tweaks== | ||
This will not make a difference as big as the major tweaks. But depending on the game, it can still give you something in the scale of ~20% FPS. Maybe more, maybe less. | This will not make a difference as big as the major tweaks. But depending on the game, it can still give you something in the scale of ~20% FPS. Maybe more, maybe less. | ||
Line 29: | Line 31: | ||
EndSection</pre> | EndSection</pre> | ||
* Use [https://github.com/ishitatsuyuki/LatencyFleX LatencyFleX] (warning: | * Use [https://github.com/ishitatsuyuki/LatencyFleX LatencyFleX] (warning: may trigger anticheat): An alternative to NVIDIA Reflex. Lowers input lag. Manually frame capping your game (so that your GPU never exceeds 80%) should be equally good. (If you use MangoHud to do this, this might add additional input lag!) | ||
*You can use <code>DXVK_ASYNC=1</code> as [[Environment variables|environment variable]] to display frames even if they are not completely rendered. This will reduce stuttering a lot, but might trip anti cheat! Your wine version needs to be compatible or patched to use it. Proton-GE is compatible. | *You can use <code>DXVK_ASYNC=1</code> as an [[Environment variables|environment variable]] to display frames even if they are not completely rendered. This will reduce stuttering a lot, but might trip anti cheat! Your wine version needs to be compatible or patched to use it. Proton-GE is compatible. | ||
*You might want to have a look at the extensive [https://wiki.archlinux.org/title/Gaming#Improving_performance | *You might want to have a look at the extensive [https://wiki.archlinux.org/title/Gaming#Improving_performance Arch Wiki page]. | ||
==Input lag, Desktop Environments, and | ==Input lag, Desktop Environments, and X11/Wayland== | ||
{{Needs work|Problem=Might be outdated, and there is missing data for various desktop environments and window managers}} | {{Needs work|Problem=Might be outdated, and there is missing data for various desktop environments and window managers}} | ||
*It appears that KDE Plasma (X11) with no composition (currently) is (one of) the best regarding performance, and input lag. Gnome is also ok.<ref>https://www.reddit.com/r/linux_gaming/comments/cii545/linux_input_lag_analysis_v26des_windows_10_1809/</ref> | *It appears that KDE Plasma (X11) with no composition (currently) is (one of) the best regarding performance, and input lag. Gnome is also ok.<ref>https://www.reddit.com/r/linux_gaming/comments/cii545/linux_input_lag_analysis_v26des_windows_10_1809/</ref> | ||
**Generally you should be fine if you can disable [[Compositor|composition]]. This is not possible in Gnome, but Gnome uses unredirection (the same thing, Windows does) instead, which is almost as good. | **Generally you should be fine if you can disable [[Compositor|composition]]. This is not possible in Gnome, but Gnome uses unredirection (the same thing, Windows does) instead, which is almost as good. | ||
*You should only use Wayland | *You should only use Wayland if you can enable FreeSync, because otherwise it will force vsync. If you are using KDE and you have FreeSync enabled, the performance and input lag should be close to KDE X11 with composition disabled.<ref>https://zamundaaa.github.io/wayland/2021/12/14/about-gaming-on-wayland.html</ref> The input lag will increase by the "half frame" that is displayed with tearing. It's basically the question whether or not you want to wait for the frame to complete before displaying it. KDE Plasma is currently the best DE for Wayland.<ref>https://www.reddit.com/r/linux_gaming/comments/rghr60/about_gaming_and_latency_on_wayland/hpox61p/?context=3</ref> | ||
It should be noted that we are talking about milliseconds here (the best value is 20ms, the worst is 90ms). If you are not susceptible to this, you | It should be noted that we are talking about milliseconds here (the best value is 20ms, the worst is 90ms). If you are not susceptible to this, you may not even notice. But generally speaking, the game will feel more responsive if your input lag is low. You might also notice stuttering if your 99th percentile is bad. | ||
==AMD/Nvidia specific tweaks== | ==AMD/Nvidia specific tweaks== | ||
Line 52: | Line 54: | ||
*Use DKMS. DKMS is a prerequisite for using custom kernels like Zen, Xanmod or tkg with the Nvidia driver. It also lets you update to newer kernel versions without waiting for an Nvidia driver update. <ref>https://wiki.archlinux.org/title/Dynamic_Kernel_Module_Support</ref>Every distro that has proprietary Nvidia driver support offers a DKMS version. | *Use DKMS. DKMS is a prerequisite for using custom kernels like Zen, Xanmod or tkg with the Nvidia driver. It also lets you update to newer kernel versions without waiting for an Nvidia driver update. <ref>https://wiki.archlinux.org/title/Dynamic_Kernel_Module_Support</ref>Every distro that has proprietary Nvidia driver support offers a DKMS version. | ||
*The [https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Overclocking_and_cooling Arch Wiki] is the best place to start. Enable coolbits as the link explains. Good is, setting the coolbits value to 28 on anything currently supported (post-Fermi) to enable full control over the GPU (at least, as much control as you're allowed to be given). | *The [https://wiki.archlinux.org/title/NVIDIA/Tips_and_tricks#Overclocking_and_cooling Arch Wiki] is the best place to start. Enable coolbits as the link explains. Good is, setting the coolbits value to 28 on anything currently supported (post-Fermi) to enable full control over the GPU (at least, as much control as you're allowed to be given). | ||
*Use GreenWithEnvy for overclocking, setting power limits (raise or lower) and fan curves. It's the closest alternative we have to MSI Afterburner. | *Use [https://gitlab.com/leinardi/gwe GreenWithEnvy] for overclocking, setting power limits (raise or lower) and fan curves. It's the closest alternative we have to MSI Afterburner. | ||
*Make sure to use a Proton version of 6.3, Experimental, Proton-6.21-GE-2 or later for Proton-GE and Proton-tkg/wine-tkg-git of 6.17 or greater (or build your own) for DLSS support. For Steam, you need to put <code>PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 %command%</code> in your launch options (side note: there should only ever be one <code>%command%</code>). | *Make sure to use a Proton version of 6.3, Experimental, Proton-6.21-GE-2 or later for Proton-GE and Proton-tkg/wine-tkg-git of 6.17 or greater (or build your own) for DLSS support. For Steam, you need to put <code>PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 %command%</code> in your launch options (side note: there should only ever be one <code>%command%</code>). | ||
*For non-Steam games, use the latest lutris or wine-ge-custom build, '''with [[Lutris]]''', and make sure to toggle on DLSS support in the Configure -> Runner options menu. For non-Steam games, you also need a dxvk.conf file with <code>dxgi.nvapiHack = False</code> in it. You can just create one (mine is <code>~/Documents/dxvk.conf</code>) and set <code>DXVK_CONFIG_FILE=/path/to/dxvk.conf</code> in your <code>/etc/environment</code>. | *For non-Steam games, use the latest lutris or wine-ge-custom build, '''with [[Lutris]]''', and make sure to toggle on DLSS support in the Configure -> Runner options menu. For non-Steam games, you also need a dxvk.conf file with <code>dxgi.nvapiHack = False</code> in it. You can just create one (mine is <code>~/Documents/dxvk.conf</code>) and set <code>DXVK_CONFIG_FILE=/path/to/dxvk.conf</code> in your <code>/etc/environment</code>. |
Revision as of 05:52, 23 March 2022
Game performance on Linux varies from game to game. Some games run better than on Windows, some run worse. Generally, you should be expecting about the same performance (±5%). If your experience is much worse, there is probably an issue. But even if your performance is already good, you might be able to get an even better experience, maybe even significantly better than on Windows (dependent the game, and on the hardware).
Major tweaks
This will give a huge boost for all games. If your presets are bad, this could easily double your performance:
- Install the correct drivers, especially if you have an Nvidia graphics card (GPU).
- If you don't have an Nvidia GPU, you likely won't need to do this.
- If you use X11, disable composition.
- X11 is the default on most Ubuntu-based beginner distros like Pop OS!
- Set GPU and CPU to maximum performance. This might not always be necessary, but will give large improvements in some cases. Definitely try it if you notice stuttering or input lag.
- Look at your thermals, and if they are too high, adapt the fan speed.
Minor tweaks
This will not make a difference as big as the major tweaks. But depending on the game, it can still give you something in the scale of ~20% FPS. Maybe more, maybe less.
- Enable
Fsync
. You need to use a compatible Kernel (likezen
,tkg-pds
, orXanmod
; kernel above 5.16 is compatible with F-sync out of the box), and enable it in Lutris: Right click the game ->Configure
->Runner options
-> EnableFsync
- If you can't or don't want to install a kernel that is Fsync compatible, you can also enable Esync. The performance boost is usually not as large, though.
- Install an optimized kernel like
zen
,linux-tkg-pds
, orXanmod
. This will also prevent the system from becoming unresponsive when under heavy CPU load.linux-tkg-pds
(linux-tkg with PDS scheduler) seems to perform better thanzen
[1], and has lower input lag (this is definitely noticeable in competitive shooters). Some people recommend usinglinux-tkg-bmq
(linux-tkg with BMQ scheduler) to get more consistent frame times. You can get it from chaotic AUR (list of available packages). To get all benefits you have to compile it yourself, though.
Optional
- Use FSR. This might dramatically improve your framerate in GPU limited games but will definitely hurt the image quality.
- To lower your input lag even more (after doing all major and minor tweaks), you can disable page flipping (this will result in more tearing).
- For AMD GPUs, create the following file:
/etc/X11/xorg.conf.d/20-amdgpu.conf
with the content:
- For AMD GPUs, create the following file:
Section "Device" Identifier "AMD" Driver "amdgpu" Option "TearFree" "false" Option "EnablePageFlip" "false" EndSection
- Use LatencyFleX (warning: may trigger anticheat): An alternative to NVIDIA Reflex. Lowers input lag. Manually frame capping your game (so that your GPU never exceeds 80%) should be equally good. (If you use MangoHud to do this, this might add additional input lag!)
- You can use
DXVK_ASYNC=1
as an environment variable to display frames even if they are not completely rendered. This will reduce stuttering a lot, but might trip anti cheat! Your wine version needs to be compatible or patched to use it. Proton-GE is compatible. - You might want to have a look at the extensive Arch Wiki page.
Input lag, Desktop Environments, and X11/Wayland
- It appears that KDE Plasma (X11) with no composition (currently) is (one of) the best regarding performance, and input lag. Gnome is also ok.[2]
- Generally you should be fine if you can disable composition. This is not possible in Gnome, but Gnome uses unredirection (the same thing, Windows does) instead, which is almost as good.
- You should only use Wayland if you can enable FreeSync, because otherwise it will force vsync. If you are using KDE and you have FreeSync enabled, the performance and input lag should be close to KDE X11 with composition disabled.[3] The input lag will increase by the "half frame" that is displayed with tearing. It's basically the question whether or not you want to wait for the frame to complete before displaying it. KDE Plasma is currently the best DE for Wayland.[4]
It should be noted that we are talking about milliseconds here (the best value is 20ms, the worst is 90ms). If you are not susceptible to this, you may not even notice. But generally speaking, the game will feel more responsive if your input lag is low. You might also notice stuttering if your 99th percentile is bad.
AMD/Nvidia specific tweaks
AMD
- Use CoreCtrl to add performance profiles for your games, set fan speeds, and overclock/undervolt.
- Only install mesa drivers. Do not install amdgpu-pro, or amdvlk. They typically perform worse, and the system defaults to use drivers in alphabetical order (thus e.g. amdvlk being preferred over mesa).
Nvidia
- Use DKMS. DKMS is a prerequisite for using custom kernels like Zen, Xanmod or tkg with the Nvidia driver. It also lets you update to newer kernel versions without waiting for an Nvidia driver update. [5]Every distro that has proprietary Nvidia driver support offers a DKMS version.
- The Arch Wiki is the best place to start. Enable coolbits as the link explains. Good is, setting the coolbits value to 28 on anything currently supported (post-Fermi) to enable full control over the GPU (at least, as much control as you're allowed to be given).
- Use GreenWithEnvy for overclocking, setting power limits (raise or lower) and fan curves. It's the closest alternative we have to MSI Afterburner.
- Make sure to use a Proton version of 6.3, Experimental, Proton-6.21-GE-2 or later for Proton-GE and Proton-tkg/wine-tkg-git of 6.17 or greater (or build your own) for DLSS support. For Steam, you need to put
PROTON_HIDE_NVIDIA_GPU=0 PROTON_ENABLE_NVAPI=1 %command%
in your launch options (side note: there should only ever be one%command%
). - For non-Steam games, use the latest lutris or wine-ge-custom build, with Lutris, and make sure to toggle on DLSS support in the Configure -> Runner options menu. For non-Steam games, you also need a dxvk.conf file with
dxgi.nvapiHack = False
in it. You can just create one (mine is~/Documents/dxvk.conf
) and setDXVK_CONFIG_FILE=/path/to/dxvk.conf
in your/etc/environment
. - For Arch-based distributions, use TKG's
nvidia-all
repo, with_dkms=""
set to true incustomization.cfg
.[6]
Troubleshooting
- Limiting FPS with MangoHud can introduce input lag. (I assume it adds one frame delay. It might as well be a bug, and only happen in specific scenarios. If you know more, why this happens, if, or how it can be avoided, please add information here.)
- You might have a distribution that uses PulseAudio instead of Pipewire. Pulseaudio introduces heavy audio delay. You should switch to Pipewire.
References and notes
- ↑ https://www.youtube.com/watch?v=qNzd57b0h08
- ↑ https://www.reddit.com/r/linux_gaming/comments/cii545/linux_input_lag_analysis_v26des_windows_10_1809/
- ↑ https://zamundaaa.github.io/wayland/2021/12/14/about-gaming-on-wayland.html
- ↑ https://www.reddit.com/r/linux_gaming/comments/rghr60/about_gaming_and_latency_on_wayland/hpox61p/?context=3
- ↑ https://wiki.archlinux.org/title/Dynamic_Kernel_Module_Support
- ↑ https://www.reddit.com/r/linux_gaming/comments/sc9dv7/need_help_writing_wiki_article_about_how_to_tweak/hu54e1g/?context=3