Check out our Monthly Survey Page to see what our users are running.

Update: You can do it easier now with the NVIDIA control panel. See this newer article for info.

Thanks to a few different people for their advice (xpander for the initial advice on a script and HeavyHDx on twitter) I have finally found a way to stop screen tearing with Nvidia proprietary drivers.

I have been struggling with this issue for months across all the different desktop environments I tried (KDE, GNOME, Cinnamon, Unity), and it has caused me a fair amount of headaches and stress, so I am pleased to finally find a solution. It's not perfect, slightly annoying, but also quite useful too.

You have probably heard of ForceFullCompositionPipeline before and that is what I am using. I have two scripts setup on keyboard shortcuts depending on the resolution that I am using (4K or 1080p). Why both? I hear you ask. It's simple, performance in a lot of games at 4K resolution is terrible, and some games have tiny unreadable text, so I run certain games at 1080p.

Here's where the confusion came from...
The problem with ForceFullCompositionPipeline is when you play a game that has a fullscreen mode that changes your desktop resolution, instead of stretching a fullscreen window, is that ForceFullCompositionPipeline is reset back to disabled. If you have noticed screen tearing returning at times even with using ForceFullCompositionPipeline, that could well be your issue too. Like me, if you didn't know that, it was probably bugging you a lot. This is also why simply putting it in an xorg config file will not 100% solve it, where as with this method you can just re-run it any time you need to.

So, here are the two very simple scripts I run. They are both put in plain text files and allowed to run as an executable (right click -> properties -> permissions -> tick "Allow executing file as program").

First up is for the 4K resolution (I have this set to run at start-up so I don't have to mess with xorg stuff directly):
nvidia-settings --assign CurrentMetaMode="DP-4:3840x2160_60 +0+0 { ForceFullCompositionPipeline = On }, DVI-I-1:1920x1080_60 +3840+0 { ForceFullCompositionPipeline = On }"
And for 1080p resolution:
nvidia-settings --assign CurrentMetaMode="DP-4:1920x1080_60 +0+0 { ForceFullCompositionPipeline = On }, DVI-I-1:1920x1080_60 +1920+0 { ForceFullCompositionPipeline = On }"
If you only have one monitor, you won't need the addition part after the comma.

You can run the script at any time. Your monitor(s) will blink, and then come back all sorted.

You will of course need to change things like "DP-4" and "DVI-I-1" to the connections your monitor is using (or monitors in my case as I have two). You can find them out by running the "xrandr" command in terminal. It will give you a list of things, like this:

QuoteDP-4 connected primary 3840x2160+0+0 (normal left inverted right x axis y axis) 621mm x 341mm

 


I hope this helps someone else, as it has been driving me nutty. They are pretty safe scripts to use, I have been testing switching between them constantly, but don't blame me if you blow your computer up.

These two little scripts have literally changed my gaming life on Linux for the better.

Where it becomes even more useful
A nice side-effect of the script: Games like RunningWithRifles which has poor multi-monitor support, it actually turns off my main monitor. Hitting the desktop shortcut I set for it will bring that monitor back, and still allow me to play the game. So not only do you get zero tearing, you get your normal multi-monitor experience back.

Feel free to share what methods you're using on your favourite desktops. Let's see if we can help each other in the comments.

 

Article taken from GamingOnLinux.com.
Tags: Editorial, HOWTO
0 Likes
We do often include affiliate links to earn us some pennies. We are currently affiliated with GOG and Humble Store. See more here.
About the author -
author picture
I am the owner of GamingOnLinux. After discovering Linux back in the days of Mandrake in 2003, I constantly came back to check on the progress of Linux until Ubuntu appeared on the scene and it helped me to really love it. You can reach me easily by emailing GamingOnLinux directly.
See more from me
The comments on this article are closed.
69 comments
Page: «2/7»
  Go to:

gqmelo 12 May, 2016
Unfortunately for owners of laptops with PRIME (like me), there is yet no vsync support at all:

https://devtalk.nvidia.com/default/topic/775691/linux/vsync-issue-nvidia-prime-ux32vd-with-gt620-m-/7
Liam Dawe 12 May, 2016
Quoting: gqmeloUnfortunately for owners of laptops with PRIME (like me), there is yet no vsync support at all:

https://devtalk.nvidia.com/default/topic/775691/linux/vsync-issue-nvidia-prime-ux32vd-with-gt620-m-/7
Have you tried this script to see if it helps at all?
Grimfist 12 May, 2016
Thanks a lot Liam, I was struggeling with this myself since I bought my GTX970 last year, and boy this works. Tested Borderlands 2, Bioshock Infinite and Metro Last Light, with this script, the tearing is gone.
I think you just earned yourself a new patreon ;)
But excuse me now, I have to switch to my Win7 partition and pre-load DOOM. See you in Hell! :D
Glog78 12 May, 2016
Liam, one question?

why don't you use the following in your <xorg>.conf ?
Option "metamodes" "nvidia-auto-select +0+0 { FroceFullCompositionPipeline = On } "
minj 12 May, 2016
does this work for optirun I wonder
Liam Dawe 12 May, 2016
Quoting: Glog78Liam, one question?

why don't you use the following in your <xorg>.conf ?
Option "metamodes" "nvidia-auto-select +0+0 { FroceFullCompositionPipeline = On } "
It requires you to not have to f-about with any xorg files. It means you can store it on a partition that doesn't get wiped between installs and have it right where you need it.

That, plus, as written in the article you need to re-do it when games change your resolution. Putting it in xorg will not solve that.
manus76 12 May, 2016
On a general note: I think this is one of the more important issues and, to put it slightly hyperbolically, especially newcomers will be very easily put off if you tell them 'to get a tearing-free experience on linux you need to edit xorg.conf' they will go 'huh?' and return to Windows.
There ought to be a checkbox/drop-down menu in system settings or some other easily available place to change the setting one way or the other. Otherwise we're looking at a large number of frustrated people leaving linux or not giving a rat's ass if right from the bat you suggest they edit system files or create scripts to get such seemingly simple things done.
Btw. in Linux Mint KDE switching the compositing off (Alt+Shift+F12) works wonders too.
Glog78 12 May, 2016
Quoting: liamdawe
Quoting: Glog78Liam, one question?

why don't you use the following in your <xorg>.conf ?
Option "metamodes" "nvidia-auto-select +0+0 { FroceFullCompositionPipeline = On } "
It requires you to not have to f-about with any xorg files. It means you can store it on a partition that doesn't get wiped between installs and have it right where you need it.

That, plus, as written in the article you need to re-do it when games change your resolution. Putting it in xorg will not solve that.

Hmm the above should automatically aply the ForceFullCompostionPipeline=On to any resolution which your xorg knows about. Strange overall ... maybe someone should describe and report that "need to reenabled" issue to nvidia (sounds to me like a bug).

And i was just curious overall.
Liam Dawe 12 May, 2016
Update:

A nice side-effect of the script: Games like RunningWithRifles has poor multi-monitor support, it actually turns off my main monitor. Hitting the shortcut I set for the script will bring that monitor back, and still allow me to play the game.
Zelox 12 May, 2016
Sadly it didnt work for me. But I use Opensource drivers, could be the reason maybe?
While you're here, please consider supporting GamingOnLinux on:

Patreon, Liberapay or PayPal Donation.

We have no adverts, no paywalls, no timed exclusive articles. Just good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
The comments on this article are closed.