2

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?

mugetsu
  • 165

2 Answers2

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"
     EndSection
    

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

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:

#!/bin/bash
s="$(nvidia-settings -q CurrentMetaMode -t)"

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

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
    ~/bin/force-composition-pipeline.sh
fi
adi
  • 845
  • 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. – Enrico Dias Dec 12 '23 at 01:44