8

I have terrible screen tearing, and I don't know how to go about trouble shooting it. I would LOVE to switch to Ubuntu completely, but with this tearing, it's just too irritating. It's only present on Ubuntu based distros, (including element OS). On Manjaro (Arch fork), it does not suffer from tearing.

PC Configuration: Motherboard: Aorus Pro Wifi z390 CPU: Intel i7 9700k RAM: 32GB GPU: Nvidia 1060 6GB DisplayPort output connects to monitor's HDMI

Monitor reported refresh rate 75hz, Ubuntu monitor settings reported refresh rate 74.97 (can change to 60hz, doesn't help).

7
  • 1
    Check the solution proposed in this video
    – singrium
    Oct 31, 2019 at 15:32
  • 1
    Desktop, self built, intel i7 9700k, Nvidia 1060 6GB, 32GB RAM, Aorus Pro Wifi z390 mobo, connected to monitor DisplayPort > HDMI. Monitor reported refresh rate 75hz, Ubuntu monitor settings reported refresh rate 74.97 (can change to 60hz, doesn't help). No tearing in Windows or Manjaro, but I really want to use Ubuntu! Oct 31, 2019 at 15:48
  • 1
    @singrium I will try following the video's instructions and report back, thanks for the link! Oct 31, 2019 at 15:55
  • 2
    @singium well I'll be darned! It worked! Thank you so much! I can finally use Linux for 99% of my computing needs (the other 1% is VR gaming) Sending you a virtual pint... Cheers! 🍻 Oct 31, 2019 at 16:45
  • 2
    Answer your own question and summarize the steps you took so if the link disappears, others may still have your solution.
    – ubfan1
    Oct 31, 2019 at 18:50

3 Answers 3

9

As discussed in the comment, I post the answer.
To solve the tearing problem, add this following command to be run at startup:
nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
To do so, you can search for 'Startup Applications Preferences' and add the command to startup commands by pressing the Add button, pasting the command in the Command field (you can add the name you want in the Name section) then press Add.

Or you can add that command to your Crontab by:

  • Run crontab -e on the terminal.
  • If it is the first time you open Crontab, you'll be asked to choose an editor, choose nano for example (which is number 1) then press Enter.
  • Add the following line to the end of the file: @reboot nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
  • Save using Ctrl + O and exit.

In order to make the changes effective, you should reboot your computer (for both methods).


If the tearing problem still persists even after applying the steps above, please do the following:

  • Install compton using sudo apt install compton compton-conf
  • Add compton to be run at startup following one of the methods already described.

If it the screen is still tearing:

  • Add compton.conf to .config folder by running: touch ~/.config/compton.conf
  • Add compton --config ~/.config/compton.conf

And restart your computer.

CREDITS: Fix Screen Tearing in Linux with Nvidia Graphics

8
  • 1
    How would this work for a dual screen setup? Currently, the nvidia-settings command always deactivate the second screen.
    – mxmlnkn
    Apr 8, 2020 at 20:07
  • @mxmlnkn, sorry I have no idea. I only tried this with single screen.
    – singrium
    Apr 9, 2020 at 10:25
  • 3
    After using the GUI to configure, you can query the current setting with: nvidia-settings --query CurrentMetaMode. Then, you can append everything after the first :: to CurrentMetaMode=. For me it turns out to be something like this: nvidia-settings --assign CurrentMetaMode='DPY-2: nvidia-auto-select @1920x1080 +0+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0, ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}, DPY-6: nvidia-auto-select @1920x1080 +1920+0 {ViewPortIn=1920x1080, ViewPortOut=1920x1080+0+0, ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}'
    – mxmlnkn
    Jun 2, 2020 at 8:06
  • 2
    @mxmlnkn Please post this as a separate answer, my screen tearing only happens with two displays and your solution could be highlighted by being a separate comment! Thanks for your contribution. Also explaining various resolutions would be very helpful for those using a projector or TV with another monitor such as a laptop display.
    – Tmanok
    Jul 8, 2020 at 17:15
  • 1
    @Tmanok Finally got around to write a separate answer. Sorry for the delay.
    – mxmlnkn
    Jul 31, 2020 at 14:25
8

The trick already mentioned in the other answer is to check the "Force Full Composition Pipeline" option in the NVIDIA X Server Settings. This option has to be checked for each monitor. You can do this using the nvidia-settings command to start the configuration GUI. If that option is not visible, you'll have to click on the "Advanced..." button first. After checking the checkbox, click on "Apply" to save the settings.

nvidia-settings example

However, in order to run this automatically on startup you'll need a command line to set these options in crontab or your session startup. To get this command line you can simply query the current settings after setting them in the GUI using nvidia-settings --query CurrentMetaMode. For my dual monitor setup, I got this output (formatted for better readability):

Attribute 'CurrentMetaMode' (mypcname:0.0): 
id=50, switchable=no, source=RandR :: 
DPY-2: nvidia-auto-select @1920x1080 +0+0
{
    ViewPortIn=1920x1080, 
    ViewPortOut=1920x1080+0+0,
    ForceCompositionPipeline=On, 
    ForceFullCompositionPipeline=On
}, 
DPY-6: nvidia-auto-select @1920x1080 +1920+0 
{
    ViewPortIn=1920x1080, 
    ViewPortOut=1920x1080+0+0, 
    ForceCompositionPipeline=On, 
    ForceFullCompositionPipeline=On
}

Everything from the third line can then be directly copy-pasted to the

nvidia-settings --assign CurrentMetaMode=...

command. So with the above example this would work:

nvidia-settings --assign CurrentMetaMode="
DPY-2: nvidia-auto-select @1920x1080 +0+0
{
    ViewPortIn=1920x1080, 
    ViewPortOut=1920x1080+0+0,
    ForceCompositionPipeline=On, 
    ForceFullCompositionPipeline=On
}, 
DPY-6: nvidia-auto-select @1920x1080 +1920+0 
{
    ViewPortIn=1920x1080, 
    ViewPortOut=1920x1080+0+0, 
    ForceCompositionPipeline=On, 
    ForceFullCompositionPipeline=On
}"

Theoretically, you could write these settings manually. The important thing is the ForceFullCompositionPipeline=On part. But unfortunately, that option can't be set without specifying the arrangement of the monitors. And determining the desired geometry coordinates is a bit more troublesome to do by hand.

3
  • Great answer. I wish there was some way to leverage this to apply on startup though.
    – Slbox
    Dec 5, 2021 at 18:38
  • @Slbox Why can't you put a shell script doing this into your autostart list?
    – mxmlnkn
    Dec 5, 2021 at 18:51
  • When using a setup with multiple monitors where sometimes one monitor is connected, and sometimes two - I haven't found any way to apply these changes programmatically that hasn't resulted in the graphics output disappearing and requiring a reboot.
    – Slbox
    Dec 6, 2021 at 19:52
0

For ThinkPad W540 I've made this script:

echo "options nvidia-drm modeset=1" > /etc/modprobe.d/zz-nvidia-modeset.conf
update-initramfs -u
apt-get purge nvidia-*
apt install nvidia-driver-450

First you must run telinit 3, then those commands. After restart you've got working nvidia 450 drivers with absolutely no tearing. I've run GTA5 from steam on this ancient laptop and it was playable at 1600x900 (of course all settings to low). I've checked it on xubuntu 20.04.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.