Fixing video tearing and CPU issues in KDE

Note: This applies to the freedom-hating nvidia proprietary drivers, but might give clues for issues in other use cases as well.

If you start KDE and notice screen tearing (e.g when scrolling up and down, or watching videos) there a few things to check.
Firstly, fire up the “Nvidia Server Settings” and under “OpenGL Settings” ensure that “Sync to VBlank” is ticked.
Next, we need to make a few updates to your X Server. The actual file you need to modify depends on how your X Server is running.

If you have the file “/etc/X11/xorg.conf”, update that. If you don’t check and see if you have the file “/etc/X11/xorg.conf.d/20-nvidia.conf”. If not, create it (including the folders if necessary). If you have both (which would be very odd), the update “20-nvidia.conf” and if that seems to have no effect, update “xorg.conf”.
What you are looking for in this file, is something that describes your current setting. e.g.:

Section "Device"
Identifier "Default nvidia Device"
Driver "nvidia"
EndSection

Modify that to make sure you have these new settings:

Section "Device"
Identifier "Default nvidia Device"
Driver "nvidia"
Option "NoLogo" "True"
Option "CoolBits" "1"
Option "TripleBuffer" "True"
EndSection

“NoLogo” stops the nvidia logo appearing (you can remove this if you happen to like that)
“CoolBots” will allow overclocking on some devices.
“TripleBuffer” allows games to use, well, triple buffering. Your card does need a semi-decent amount of RAM for this, so don’t add this if you have less that 128MB.

Finally, add the following line to the start of “/etc/profile”

export __GL_YIELD="USLEEP"

This should allow KWIN (the window manager in KDE) to synchronise with the CPU wait/sleep cycles.

This fixed it for me and don’t panic if you mess this up. At worst you just need to log in via a text terminal, remove your changes and restart.

There’s more detail in KDE Bug 322060.

Leave a Reply