As many may already know, proprietary nvidia
drivers for Linux are far from being perfect, with many options limited or even not present at all. One different case is PowerMizer performance mode, which is present in Linux driver, but its value gets purged after every system reboot and returns back to "Auto".
In order to fix that it's necessary to create systemD unit that will enroll new setting every time the system is booted. To do that make sure first that your systemD user configuration directory does exist or create one:
$ cd ~/.config/systemd/user/
If instead you get an error saying that the directory does not exist, create it by typing:
$ mkdir -p ~/.config/systemd/user/
And create nvidia-powermizer-fix.service
file inside it with the following content:
[Unit]
Description=Enforce Nvidia PowerMizer performance mode on startup
After=graphical.target
[Service]
Environment=DISPLAY=:0
ExecStart=/usr/bin/nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=<VALUE>"
[Install]
WantedBy=default.target
Where instead of <VALUE>
you must insert one of the following numbers:
0
- Adaptive1
- Prefer Maximum Performance2
- Auto
Then make sure to reload systemd units and enable your newly created one by running those two commands:
$ systemctl --user daemon-reload
$ systemctl --user enable nvidia-powermizer-fix.service
And reboot your system.
To verify that everything worked as expected run the following command:
$ systemctl --user status nvidia-powermizer-fix.service
Expected output should be similar to:
nvidia-settings[584]: Attribute 'GPUPowerMizerMode' (hostname:0[gpu:0]) assigned value <YOUR VALUE>.