Set Nvidia GPU Performance Level possible?

I experience a serious performance problem, when plugging my Gaming Laptop back in AC after it ran on battery - as observed in the Nvidia Settings the Performance Level of my GPU keeps on jumping between 4 (highest) and 2 (low) resulting in a system wide graphics lag.

Here’s what i found:
Laptop on AC - Performance Level 4 (high perf.)
Laptop on battery - Performance Level 0 and 1 (very low, wish i could change that as well)
Laptop back on AC - Performance Level 4 and 2 (serious lag, massive framedrops also in games)

Only solution for now, either

  • reboot the whole system or
  • kill process kwin_x11
    both don’t even qualify as “workarounds”.

Can anyone tell me, if it’s possible to set the Nvidia Performance Level manually?

Found this posting to force Low-Performance Settings, but indeed the same settings (Parameter 0x3) solved my problem with Performance Level jumping and thus creating system lag after plugging the laptop to AC again.
Works as intended: Laptop back on AC - Performance Level 4 constant

no links allowed here, so google this:
forums.developer.nvidia solved-forcing-maximum-power-saving-on-the-desktop-minimum-power-mode-for-powermizer

- edit / create file:

sudo nano /etc/X11/xorg.conf.d/20-nvidia.conf

(you may choose your favorite texteditor instead of nano)

- edit /paste in file:

Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
Option “Coolbits” “1”
Option “RegistryDwords” “PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerLevel=0x3; PowerMizerDefault=0x3; PowerMizerDefaultAC=0x3”

- reboot

How are you monitoring the performance level?

With the Nvidia Settings…it will jump between 2 and 4…even in Games and Videos

Oh, okay. I usually look at nvtop. However, I can’t look at anything right now as my development laptop is out of commission right now. :sob: My old laptop has an AMD APU, so I’m afraid I’m not much help right now.

I realize this is an old post, but I have the same exact issue.
I’ve tried your solution below but this results in my desktop environment to fail loading. It just gets stuck at tty post decrypt of the filesystem. I can open another tty instance with control+shift+F* key, and then remove the config additions to 20-nvidia.conf

I’ve tried a few nvidia-settings config changes as well but no dice. There is definitely weirdness going on even when just on battery.

Yes, it is. Also the post on the NVIDIA forums he linked to is from 2013. Maybe the last post in the thread will help as it’s from 2020, at least:

Super late reply, but from this its possible to force 0x1 or 0x4, but still does not solve the issue described of unplugging and replugging leading to being capped at level 0x2 no matter what. It’s not unique to Manjaro. Same issue happens on Pop!OS and Mint.

It only allows to exceed 0x2 back to 0x3/0x4 after logging out and relogging back in.

I’m looking into it more and will post an update if this is resolved