I'm on ubuntu 20.04. I'm using an external monitor with a laptop as shown in nvidia-settings here: enter image description here

nominally this works. But, to get rid of tearing on the external display, I need to select "Force Composition Pipeline" under Advanced. This is fine, but when I try to save the X config file, a restart would remove my PRIME display completely. Only my external monitor works.

I would have to delete /etc/X11/xorg.conf to get the display back.

Is there a way to save this config and keep the prime display?

  • I am having the same issue...after saving to X config file, even if I select "merge" the internal screen isn't working. nomodset only fixes the issue for internal screen.
    – adi
    Jun 10, 2021 at 7:17
  • @adi - Did you have a chance of testing what I proposed? Jun 16, 2021 at 11:29

2 Answers 2


You may try this solution, which seems to have worked for others.

  1. Remove any xorg.conf in /etc/X11

  2. Create directory /etc/X11/xorg.conf.d

  3. Create file /etc/X11/xorg.conf.d/20-nvidia-antitear.conf with contents

     Section "OutputClass"
         Identifier "nvidia-antitear"
         MatchDriver "nvidia-drm"
         Driver "nvidia"
         Option "ForceCompositionPipeline" "true"

Related: https://wiki.archlinux.org/title/NVIDIA/Troubleshooting#Avoid_screen_tearing

Alternatively, you could write a script that applies the settings as mentioned by adi, but run it at boot time via crontab so it works for any user. This is done here.

The solution via compton posted there is yet another option.

  • 1
    Seems to work, thanks.
    – adi
    Jun 16, 2021 at 12:01

Ok so I've found a solution, courtesy of answer from the following question: How to automatically force full composition pipeline for Nvidia GPU driver?

I've changed the solution a bit though.

Step 1, create a shell script file, wherever you want, I've made it like in the answer in ~/bin/force-composition-pipeline.sh

Step 2, add the following content to the scrip:

s="$(nvidia-settings -q CurrentMetaMode -t)"

if [[ "${s}" != "" ]]; then
  s="${s#*" :: "}"
  nvidia-settings -a CurrentMetaMode="${s//\}/, ForceCompositionPipeline=On\}}"

Step 3, make the script executable:

chmod +x ~/bin/force-composition-pipeline.sh

Step 4, add the script to the sign in process, either by adding the following code to the .profile or .bash_profile, whichever you find in your home directory:

if [ -f "$HOME/bin/force-composition-pipeline.sh" ] ; then
  • This solution was the only one that worked for me with Ubuntu 22. You can put he script directly in the profile, no need to create another file. Dec 12, 2023 at 1:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .