NV-Google-Home-Logo

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

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.

Quick Fix

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.

COMMENTS (beta)

?
Add your comment here...
5
beyonim 2 mons ago
Thank you! I will hope found the solution for a few years!
4
Dimitrios Charalampidis Sep '15
I know this article will be 1 year old in a few days, but I followed the instructions, my machine booted normally but tearing is still there and it is a lot of it... (Running ROSA Desktop Fresh R6)
3
petran79 Jan '15
unfortunately Ubuntu 14.04 fails to load and brings me to command line. Have to reset xorg.conf settings. Only solution is the maximum performance option.
2
Guido Oct '14
Hi, i've tried this and now I can't boot into ubuntu, it stays on the logo screen freeze. do you know what should I do?
1
Liron Oct '14 Guido
Hi, I'm sorry to hear that, well if you're Ubuntu doesn't boot because of the herein modifications, the first I would do would be to remove the config files created: When you boot to Ubuntu and reach the login screen, press Ctrl + Alt + F1 or F2 this should take you to a different run level (you'll see a terminal like screen), enter "root" for login and then your password. Now, if you wish to remove the config files entirely - use one of the following commands (depends where the config files are stored): rm /etc/profile.d/profile.sh rm /etc/X11/xorg.conf rm /etc/X11/xorg.conf.d/nvidia.conf when you're done type reboot and enter to reboot. If you don't wish to remove the config files completely but to edit them, use nano to do so: again, when you're inside the the Terminal-like screen, replace the "rm" in above commands with "nano" like so - nano /etc/X11/xorg.conf edit the file the way you need, press *Ctrl + X > y > enter* to save and exit. Hopes this helps...
2
Guido Oct '14 Liron
Great, thanks man, I'll try that tonight and let you know if someone had the same problem
3
Guido Oct '14 Liron
After deleting profile.sh worked like a charm :) Thanks for the help man!
4
Liron Oct '14 Guido
Great! thanks for letting anyone who visits this page know...
1
delawyn Sep '14
This worked great on Fedora 20, thank you!
1
Liron Sep '14 delawyn
Happy to hear that, you welcome ;)