18 Nov 2021
I've had an nvidia graphics card for the past 8 years (and nvidia gtx770), I usually alternate between the nvidia proprietary driver and the nouveau open-source driver, i.e. there is a problem in one, I try the other. But I used the proprietary driver more than the nouveau driver, the latter usually performed worse than it's binary-blob-corporate-jailed driver.
Recently I found that the latest nvidia proprietary driver will finally get GBM support instead of the EGLStream that it currently has (AFAIK, all the other gfx drivers in Linux use GBM, except for nvidia), but... in typical nvidia fashion, they also decided to drop support for older cards, and my card falls into that group, so again, thank you nvidia! again!
That irked me, so I decided to try using the nouveau driver again; it looks like one of the reasons it always did badly in my current distro is that I didn't have the libdrm_nouveau2 package installed (it's likely that it was installed by default and then I removed it). Once I installed that it seemed to work much better (glxinfo
is actually a very useful tool).
But it still felt a bit "slower" than the proprietary driver, I tried tweaking the compositor settings in Plasma (systemsettings -> Display and Monitor -> Compositor), and here is what worked for me:
for what it's worth, setting the vsync option to "only when cheap" I still don't see any tearing, but it seemed to improve the performance quite a bit.
It seemed to work, apart from some hard system locks (not too frequent, but still annoying), thankfully it looked like a viable option.
Then I started wondering if there is a way to change the "performance level", which is an option in the nvidia-settings GUI tool for the proprietary driver; as far as I understand it changes the clock speeds of the various components in the hardware. The proprietary driver could change those levels dynamically based on the load on the system.
It turns out, I can actually change the "performance level" with the nouveau driver too (I'll post a link to the sources I found at the end).
Someone had sent me an email to kindly point out that someone reading my blog posts could try the stuff I post about, which is a fair point; so here is a disclaimer, try the following at your own risk, and after you've done your own research.
With that out of the way, here we go:
# cat /sys/kernel/debug/dri/0/pstate 07: core 405 MHz memory 648 MHz 0a: core 405-1032 MHz memory 1620 MHz 0e: core 405-1202 MHz memory 7010 MHz 0f: core 405-1202 MHz memory 7010 MHz AC DC AC: core 1058 MHz memory 7009 MHz
0f
state, and it seemed to work:
# echo 0f > /sys/kernel/debug/dri/0/pstate # cat /sys/kernel/debug/dri/0/pstate 07: core 405 MHz memory 648 MHz 0a: core 405-1032 MHz memory 1620 MHz 0e: core 405-1202 MHz memory 7010 MHz 0f: core 405-1202 MHz memory 7010 MHz AC DC * AC: core 1058 MHz memory 7009 MHz
I tried glmark2 (a benchmarking tool available for Linux), and it gave a score of ~100 before this change and ~1000 afterwards, whatever that score means. And indeed the system seems/feels better.
15
, which is the decimal equivalent of the hex value 0x0f
):
nouveau.config=NvClkMode=15
On my distro, I had to edit /etc/default/grub
and add that string to GRUB_CMDLINE_LINUX_DEFAULT:
GRUB_CMDLINE_LINUX_DEFAULT="nouveau.config=NvClkMode=15"
then as root, I executed grub2-mkconfig
to update the boot entries (check your distro's documentation).
Now my system is running "well"; sure, there is no dynamic management of the performance levels, but I'd rather crank it up to the top level, than suffer the slowness and performance hit.
Sources: