NV-Google-Home-Logo

Finally, Linux Nvidia Tearing Issue Fix Has Been Found! + Bonus: Nvidia Optimization

Updated 20 Mar, 2016

Latest Nvidia drivers have introduced a rather excruciating bug which decreases the overall performance of your machine and causes a lot of frustration amongst Linux users.

Whether the blame completely belongs to Nvidia or perhaps in part belongs to another component of your OS such as, the compositor or Xorg for example is yet remains not entirely clear.

However if you find yourself suffering from one or more of the following symptoms, then you’ll probably want to apply this fix in order to save yourself a lot of frustration.

Are You Experiencing The Bug?

Symptoms: general video tearing, slow or delayed – typing or scrolling or erasing, screen doesn’t redraw / repaint / refresh as it should i.e. either it’s delayed or the picture (screen) comes out choppy, screen-freezes momentarily.

Most noticeable apps in which you encounter these symptoms are:

Text editors such as – Gedit, Kwrite, Mousepad, etc… Terminal – you may encounter scrolling delay, web browsers – you might notice lags when switching tabs, file-managers – naming files / erasing file names and also switching tabs might lag, and of course video players – frames get torn up.

Now, many promises had been made lately that pledge these issues would all be gone once desktop environments will make the switch to Wayland display manager, but that doesn’t seems like it’s going to happen anytime soon, so what shall we do until then?

Well, a few months back, when the bug was relatively fresh, iWillFolo has offered its readers a workaround to temporarily bypass the issue.

That workaround still works but it’s not without a cost and that’s running your card to the max which leads to the waste of unnecessary power and also excess hit coming out from your machine.

Hence that fix was definitely not ideal, and certainly requiered a better, permanent solution.

Nvidia tearing

Fixing Nvidia Tearing + Optimizing The Driver For Your System

Warning: before using any of the below commands, please note that messing with your graphics configuration files may cause your distro not to display properly or even a black screen upon login.Use at your own risk. Use only If you know what you’re doing.

In order to fix the issue we are going to tweak Nvidia’s configuration a little bit, don’t worry though, it’s nothing too complicated, and the good part is this tweaking will also make it more optimized for your machine, ready? let’s do this.

Open up Terminal and type:

sudo nvidia-xconfig

This will generate an automatic /etc/X11/xorg.conf file which is suitable to run on your computer. Next, type:

sudo nvidia-settings

Set your screen resolution and refresh rate in the X Server Display Configuration (I set mine to 1920×1080 @59hz) and click Save to X configuration File.

Note: if you’re not sure about your screen resolution and refresh rate, install a tool called xrandr (if it’s not installed on your OS yet), then type xrandr in Terminal to see what is your resolution and refresh rate.

Also, inside OpenGL Settings, tick:  Sync to Vblank, Allow Flipping, Use Conformant Texture Clamping. Close the app

Return to Terminal and type:

sudo kwrite (or gedit whichever you have installed) /etc/X11/xorg.conf

Edit the device section like so:

Section “Device”
Identifier “Device0”
Driver “nvidia”
VendorName “NVIDIA Corporation”
BoardName “GeForce GTX 650” (use your own board name, if you don’t know then add a “#” sign to the left of the line without the quotes)
Option “RegistryDwords” “PerfLevelSrc=0x2233”
Option “TripleBuffer” “True”
EndSection

Save the file and close the app. Done! restart your computer to apply the changes.

Note: xorg.conf is being depreciated, meaning some distros don’t use it, others will stop using it eventually so you might want to move the file and rename it thusly:

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.d/nvidia.conf

Bonus:

Use the following parameters to maximize your performance even more.

sudo dolphin  (or nautilus, whichever file-manager you have)

Now go into /etc/profile.d and create a text file, you may name it profile.sh, and copy pate the following lines:

export __GL_YIELD="USLEEP"
export __GL_THREADED_OPTIMIZATIONS=1

Note: do not use both at the same time. GL_THREADED_OPTIMIZATIONS may cause some applications to act strange, thus, in most cases its use is deprecated.

Save and close, reboot to apply the changes.

The comment section is temporarily closed due to remodeling.