How to limit frame rate for all games on Linux Mint?
NVIDIA-specific solution
Disclaimer: The use of an official driver package from the repository, NOT from a PPA, is recommended by me. You can learn how to install or update your drivers in my other question here: How to install the latest Nvidia drivers on Linux Mint 20
Important Notice
Disclaimer: This solution has been verified and tested only on one Ubuntu 18.04 or 20.04 based system. If you have an older one, DO NOT FOLLOW; use caution on newer versions too.
Solution for Ubuntu 18.04 and 20.04 based systems
This solution utilizes V-Sync (Vertical Synchronization). If you don't like using it, this solution is not for you.
Thank you, Xander, for the comment on enabling V-Sync. With this hint, I was able to find out, that I only need to do the following steps.
-
Create the following new (if not yet existing) file in your favorite text editor:
/etc/modprobe.d/nvidia-drm-nomodeset.conf
-
Put this single line in there, save and close the file; in case the file exists already, then ensure this line is there:
options nvidia-drm modeset=1
-
Update all of your
initramfs
images with:sudo update-initramfs -u -k all
or if you only want to test it, you can update just the latest image with:
sudo update-initramfs -u
-
Reboot your system.
-
The V-Sync shall be on now, verify with:
sudo cat /sys/module/nvidia_drm/parameters/modeset
It will say:
-
Y
if V-Sync is On
-
N
if V-Sync is Off
You should be done now, capped to your display refresh rate (usually 60).
In spite, I am satisfied with this solution, feel free to add your own (AMD-specific, Intel-specific, whatever...) to make this question useful for others.
Related videos on Youtube
![Vlastimil Burián](https://i.stack.imgur.com/4XOCT.jpg?s=256&g=1)
Vlastimil Burián
I am passionate about Linux systems in general and POSIX shell scripting in particular.
Updated on September 18, 2022Comments
-
Vlastimil Burián almost 2 years
Affected OS
-
Linux Mint 19.1 "Tessa" - Cinnamon (64-bit), based on Ubuntu 18.04 LTS. (Unimportant, but later updated to 19.3 version.)
the above system was later upgraded to:
-
Linux Mint 20.2 "Uma" - Cinnamon (64-bit), based on Ubuntu 20.04 LTS. (This is my primary OS now.)
Related Hardware
-
CPU: Intel, Core 7th gen (Kaby Lake), i7-7700HQ, base clock 2.80 GHz, max Turbo Boost 3.80 GHz, Smart Cache 6 MB
-
GPU: NVIDIA, GeForce GTX 1060, Max-Q Design, 6 GB GDDR5 VRAM
-
Screen: 4K laptop 15.6 inch display (UHD 3840 x 2160)
Problem
There are about 200 - 300 FPS while playing any non-GPU-heavy game(s), so I'm thinking there is a lot of power being wasted, and my hardware is overheating if such a game is in the foreground for many hours straight. Additionally, even if I don't pay the electricity bills, I think my hardware is more prone to fault if playing on a maximum frame rate, which in ordinary games can be the above-stated, hardly believable, 200 - 300 FPS.
Question
How can I set an FPS limit for all games on my Nvidia-based hardware? If possible even, to name a few such games?
For example, NOT an advertisement, Hexcells franchise uses so little GPU, and I tested my solution below on these games.
-