Got tearing with proprietary NVIDIA? Try this.

نام نویسنده:

 Behzadi 31

If you're using a reasonably modern NVIDIA graphics card on your Linux box with the proprietary driver, there's a fair chance you may encounter that nasty thing called 'screen tearing'. There is a little setting worth trying in NVIDIA's blob driver called 'ForceCompositionPipeline' that can severely reduce tearing to a minimum, perhaps even completely. Here's how to do it.

With the proprietary NVIDIA driver, if you're using a composited Desktop Environment such as GNOME or KDE Plasma, they can hide the screen tearing for the most part, generally to even a quite satisfactory level. But not always. And if you use a non-composited, non-hardware accelerated desktop such as LXDE or MATE, then... chances are you'll be in screen tearing hell, even with NVIDIA's V-sync enabled. And that's the way things will be until we all have support for Wayland.

Thankfully, as long as you're running NVIDIA drivers no older than a year or so, there's a feature worth trying called 'ForceCompositionPipeline'. There's also a variant called 'ForceFullCompositionPipeline', although I am sketchy as to the exact difference between them other than presumably the latter is a stronger version.

Fair warning: this feature has been reported in the past to reduce performance in some OpenGL applications. Up to date NVIDIA drivers seem to have largely optimized the feature enough that the difference generallyis barely noticeable (it may cost 1-5 frames here and there in benchmarks as a rough average) whereas in the first iterations, the performance cost used to be nearly as much as 30-40%! Thankfully that seems to be no longer the case, but just bear in mind the potential for loss of performance.

Alright, let's get to it!

Open up a terminal and execute this command:

nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceCompositionPipeline = On }" 

Note that you can try either 'ForceCompositionPipeline' or 'ForceFullCompositingPipeline'. I tried (and use) the former and it works just fine. But you may need to experiment.

All going well, you should still be at your desktop and if you do some actions like scrolling pages in Firefox, play videos (both windowed and fullscreen) and move some windows around, hopefully your tearing problem is pretty much fixed! If not, perhaps it's not supported on your specific graphics card. Also, on the off-chance that you simply get a black screen or some sort of problem after running the above command, fret not. Just reboot, as the change is only for your current running session.

But it works and I wanna make it permanent!

No worries, fellow Linux user, if you can bear with a bit more terminal text work, you can make this a permanent change that will survive reboots.

Open up a terminal again and, with super user privileges, use your favorite text editor to edit the file /etc/X11/xorg.conf, assuming the file exists but it should for most users using the NVIDIA blob driver.Also it's a good idea to backup the file first, eg. sudo cp /etc/X11/xorg.conf /etc/X11/xorg.conf.backup. Now, onto opening the file.

Example (using Pluma text editor, replace with gedit or vim or whatever you please):

sudo pluma /etc/X11/xorg.conf

You then need to add the following line to the "Screen" section of the opened Xorg configuration file:

Option "metamodes" "nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"

I should also add that the key string to add to /etc/X11/xorg.conf is { ForceCompositionPipeline = On } to the end of the Option "metamodes" line in /etc/X11/xorg.conf.

Some people (like me) have that line already, with custom settings that will get messed up if you replace the entire line with the sample you provide. So, for example, my line now looks like this:

Option "metamodes" "DVI-I-1: 1920x1200 +1920+0, HDMI-0: nvidia-auto-select +0+120 { ForceCompositionPipeline = On }"

So if your xorg.conf file already contains an Option "metamodes" be sure to add just the { ForceCompositionPipeline = On } line of code between the quotation marks at the very end. Save the file and that's it.

منبع: thelinuxrain

اخبار مرتبط

دیگر اخبار نویسنده

ارسال نظر

شخصی سازی Close
شما در این صفحه قادر به شخصی سازی نمیباشید