Nvidia settings force compostion (mult. monitor) - screen tearing

I’ve a minor problem with screen tearing on my secondary monitor, it’s fairly minor, but noticeable when scrolling through long webpages. Following the advice on arch wiki for NVIDIA and forcing a full composition pipeline seems to resolve the issue. Initially, I’ve done this though GUI for nvidia-settings, right now I’m trying to persist this after reboot.

The file generated by GUI application is missing some settings mentioned in Arch wiki, specificallyTripleBuffering should be enabled and AllowIndirectGLXProtocol should be disabled in the driver configuration as well.

# nvidia-settings: X configuration file generated by nvidia-settings
# nvidia-settings:  version 535.113.01

# Automatically generated by EnvyControl

Section "ServerLayout"
    Identifier     "layout"
    Screen      0  "Screen0" 0 0
    Inactive       "intel"
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "InputDevice"
    # generated from default
    Identifier     "Mouse0"
    Driver         "mouse"
    Option         "Protocol" "auto"
    Option         "Device" "/dev/psaux"
    Option         "Emulate3Buttons" "no"
    Option         "ZAxisMapping" "4 5"
EndSection

Section "Monitor"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "Microstep MSI MAG342CQR"
    HorizSync       30.0 - 222.0
    VertRefresh     48.0 - 125.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "nvidia"
    Driver         "nvidia"
    BusID          "PCI:1:0:0"
EndSection

Section "Device"
    Identifier     "intel"
    Driver         "modesetting"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce RTX 2060"
EndSection

Section "Screen"
    Identifier     "nvidia"
    Device         "nvidia"
    Monitor        "Monitor0"
    Option         "AllowEmptyInitialConfiguration"
EndSection

Section "Screen"
    Identifier     "intel"
    Device         "intel"
    Monitor        "Monitor0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "3440x1440_100 +1920+0 {ForceCompositionPipeline=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I need to set this up for mult. monitor, but I’m not quite sure how the command should look following the given example in the wiki.

The output of nvidia-settings --query CurrentMetaMode is below.

Attribute 'CurrentMetaMode' (yury-endeavour-os:1.0): id=50, switchable=yes, source=RandR :: DPY-0: 3440x1440_100 @3440x1440 +1920+0 {ViewPortIn=3440x1440, ViewPortOut=3440x1440+0+0}

Also, how to translate to /etc/X11/xorg.conf.d/20-nvidia.conf, looking at the wiki I think it should be something like below:

Section "Screen"
    Identifier     "intel"
    Device         "intel"
    Monitor        "Monitor0"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-0"
    Option         "metamodes" "3440x1440_100 +1920+0 {ForceCompositionPipeline=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    Option         "AllowIndirectGLXProtocol" "off"
    Option         "TripleBuffer" "on
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

I’m actually not sure if this needs to be a mult. monitor setup as this a laptop, as only external screen is connected to NVIDIA card though HDMI, I believe the build in screen uses Intel CPU. Below are specs for the laptop, and current display setup.

 ~  inxi -Fazy                                                                                                                                                                                  ✔  05:16:34 PM 
System:
  Kernel: 6.5.5-arch1-1 arch: x86_64 bits: 64 compiler: gcc v: 13.2.1
    clocksource: tsc available: hpet,acpi_pm
    parameters: initrd=\6b380c6eb31c4f619722bcbdedef7d8f\6.5.5-arch1-1\initrd
    nvme_load=YES nowatchdog rw rootflags=subvol=/@
    rd.luks.uuid=8c90355f-3586-490d-8097-a9bb7b120ab9
    root=/dev/mapper/luks-8c90355f-3586-490d-8097-a9bb7b120ab9
    nvidia-drm.modeset=1 systemd.machine_id=6b380c6eb31c4f619722bcbdedef7d8f
  Desktop: GNOME v: 44.5 tk: GTK v: 3.24.38 wm: gnome-shell dm: GDM v: 44.1
    Distro: EndeavourOS base: Arch Linux
Machine:
  Type: Laptop System: Micro-Star product: GF65 Thin 9SEXR v: REV:1.0
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: Micro-Star model: MS-16W1 v: REV:1.0 serial: <superuser required>
    UEFI: American Megatrends v: E16W1IMS.10A date: 03/26/2020
Battery:
  ID-1: BAT1 charge: 45.1 Wh (100.0%) condition: 45.1/51.3 Wh (88.0%)
    volts: 12.9 min: 11.4 model: MSI Corp. MS-16W1 type: Li-ion serial: N/A
    status: full
  Device-1: hidpp_battery_0 model: Logitech MK700 serial: <filter>
    charge: 70% (should be ignored) rechargeable: yes status: discharging
  Device-2: hidpp_battery_1 model: Logitech Wireless Mouse MX Master
    serial: <filter> charge: 55% (should be ignored) rechargeable: yes
    status: discharging
CPU:
  Info: model: Intel Core i7-9750H bits: 64 type: MT MCP arch: Coffee Lake
    gen: core 9 level: v3 note: check built: 2018 process: Intel 14nm family: 6
    model-id: 0x9E (158) stepping: 0xA (10) microcode: 0xF4
  Topology: cpus: 1x cores: 6 tpc: 2 threads: 12 smt: enabled cache:
    L1: 384 KiB desc: d-6x32 KiB; i-6x32 KiB L2: 1.5 MiB desc: 6x256 KiB
    L3: 12 MiB desc: 1x12 MiB
  Speed (MHz): avg: 802 high: 834 min/max: 800/4500 scaling:
    driver: intel_pstate governor: powersave cores: 1: 800 2: 800 3: 834 4: 800
    5: 800 6: 800 7: 800 8: 800 9: 800 10: 800 11: 800 12: 800 bogomips: 62431
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 vmx
  Vulnerabilities:
  Type: gather_data_sampling mitigation: Microcode
  Type: itlb_multihit status: KVM: VMX disabled
  Type: l1tf mitigation: PTE Inversion; VMX: conditional cache flushes, SMT
    vulnerable
  Type: mds mitigation: Clear CPU buffers; SMT vulnerable
  Type: meltdown mitigation: PTI
  Type: mmio_stale_data mitigation: Clear CPU buffers; SMT vulnerable
  Type: retbleed mitigation: IBRS
  Type: spec_rstack_overflow status: Not affected
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: IBRS, IBPB: conditional, STIBP: conditional,
    RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds mitigation: Microcode
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: Intel CoffeeLake-H GT2 [UHD Graphics 630] vendor: Micro-Star MSI
    driver: i915 v: kernel arch: Gen-9.5 process: Intel 14nm built: 2016-20
    ports: active: eDP-1 empty: none bus-ID: 00:02.0 chip-ID: 8086:3e9b
    class-ID: 0300
  Device-2: NVIDIA TU106M [GeForce RTX 2060 Mobile] vendor: Micro-Star MSI
    driver: nvidia v: 535.113.01 alternate: nouveau,nvidia_drm non-free: 535.xx+
    status: current (as of 2023-09) arch: Turing code: TUxxx
    process: TSMC 12nm FF built: 2018-22 pcie: gen: 1 speed: 2.5 GT/s lanes: 16
    link-max: gen: 3 speed: 8 GT/s ports: active: none off: HDMI-A-1
    empty: none bus-ID: 01:00.0 chip-ID: 10de:1f15 class-ID: 0300
  Display: x11 server: X.Org v: 21.1.8 with: Xwayland v: 23.2.1
    compositor: gnome-shell driver: X: loaded: modesetting,nvidia dri: iris
    gpu: i915,nvidia,nvidia-nvswitch display-ID: :1 screens: 1
  Screen-1: 0 s-res: 5360x1440 s-dpi: 96 s-size: 1418x381mm (55.83x15.00")
    s-diag: 1468mm (57.81")
  Monitor-1: HDMI-A-1 mapped: HDMI-0 note: disabled pos: primary,right
    model: MSI MAG342CQR serial: <filter> built: 2021 res: 3440x1440 dpi: 110
    gamma: 1.2 size: 797x333mm (31.38x13.11") diag: 856mm (33.7") modes:
    max: 3440x1440 min: 640x480
  Monitor-2: eDP-1 mapped: eDP-1-1 pos: left model: AU Optronics 0xd0ed
    built: 2019 res: 1920x1080 hz: 120 dpi: 142 gamma: 1.2
    size: 344x193mm (13.54x7.6") diag: 394mm (15.5") ratio: 16:9
    modes: 1920x1080
  API: EGL v: 1.5 hw: drv: intel iris drv: nvidia platforms: device: 0
    drv: nvidia device: 1 drv: iris device: 3 drv: swrast surfaceless:
    drv: nvidia x11: drv: nvidia inactive: gbm,wayland,device-2
  API: OpenGL v: 4.6.0 compat-v: 4.5 vendor: nvidia mesa v: 535.113.01
    glx-v: 1.4 direct-render: yes renderer: NVIDIA GeForce RTX 2060/PCIe/SSE2
    memory: 5.86 GiB
Audio:
  Device-1: Intel Cannon Lake PCH cAVS vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel alternate: snd_soc_skl,snd_sof_pci_intel_cnl
    bus-ID: 00:1f.3 chip-ID: 8086:a348 class-ID: 0403
  Device-2: NVIDIA TU106 High Definition Audio vendor: Micro-Star MSI
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:10f9 class-ID: 0403
  API: ALSA v: k6.5.5-arch1-1 status: kernel-api
    tools: alsactl,alsamixer,amixer
  Server-1: PipeWire v: 0.3.80 status: active with: 1: pipewire-pulse
    status: active 2: wireplumber status: active 3: pipewire-alsa type: plugin
    4: pw-jack type: plugin tools: pactl,pw-cat,pw-cli,wpctl
Network:
  Device-1: Intel Cannon Lake PCH CNVi WiFi driver: iwlwifi v: kernel
    bus-ID: 00:14.3 chip-ID: 8086:a370 class-ID: 0280
  IF: wlan0 state: up mac: <filter>
  Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Micro-Star MSI driver: r8169 v: kernel pcie: gen: 1 speed: 2.5 GT/s
    lanes: 1 port: 3000 bus-ID: 03:00.0 chip-ID: 10ec:8168 class-ID: 0200
  IF: enp3s0 state: down mac: <filter>
  IF-ID-1: docker0 state: down mac: <filter>
Bluetooth:
  Device-1: Intel Bluetooth 9460/9560 Jefferson Peak (JfP) driver: btusb v: 0.8
    type: USB rev: 2.0 speed: 12 Mb/s lanes: 1 mode: 1.1 bus-ID: 1-14:3
    chip-ID: 8087:0aaa class-ID: e001
  Report: btmgmt ID: hci0 rfk-id: 0 state: down bt-service: enabled,running
    rfk-block: hardware: no software: yes address: <filter> bt-v: 5.1 lmp-v: 10
    status: discoverable: no pairing: no
Drives:
  Local Storage: total: 476.94 GiB used: 84.48 GiB (17.7%)
  SMART Message: Unable to run smartctl. Root privileges required.
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Toshiba
    model: KBG40ZNV512G KIOXIA size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 tech: SSD serial: <filter>
    fw-rev: AEXA0101 temp: 52.9 C scheme: GPT
Partition:
  ID-1: / raw-size: 475.96 GiB size: 475.96 GiB (100.00%)
    used: 84.23 GiB (17.7%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
    mapped: luks-8c90355f-3586-490d-8097-a9bb7b120ab9
  ID-2: /home raw-size: 475.96 GiB size: 475.96 GiB (100.00%)
    used: 84.23 GiB (17.7%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
    mapped: luks-8c90355f-3586-490d-8097-a9bb7b120ab9
  ID-3: /var/log raw-size: 475.96 GiB size: 475.96 GiB (100.00%)
    used: 84.23 GiB (17.7%) fs: btrfs dev: /dev/dm-0 maj-min: 254:0
    mapped: luks-8c90355f-3586-490d-8097-a9bb7b120ab9
Swap:
  Kernel: swappiness: 60 (default) cache-pressure: 100 (default) zswap: yes
    compressor: zstd max-pool: 20%
  ID-1: swap-1 type: file size: 24 GiB used: 0 KiB (0.0%) priority: -2
    file: /swap/swapfile
Sensors:
  System Temperatures: cpu: 53.0 C pch: 63.0 C mobo: N/A gpu: nvidia temp: 51 C
  Fan Speeds (rpm): N/A
Info:
  Processes: 346 Uptime: 59m wakeups: 7 Memory: total: 16 GiB
  available: 15.47 GiB used: 4.04 GiB (26.1%) Init: systemd v: 254
  default: graphical tool: systemctl Compilers: gcc: 13.2.1 clang: 16.0.6
  Packages: pm: pacman pkgs: 1122 libs: 295 tools: yay Shell: Zsh v: 5.9
  running-in: kgx inxi: 3.3.30
 ~  xrandr --query                                                                                                                                                                          INT ✘  05:12:42 PM 
Screen 0: minimum 8 x 8, current 5360 x 1440, maximum 32767 x 32767
HDMI-0 connected primary 3440x1440+1920+0 (normal left inverted right x axis y axis) 797mm x 333mm
   3440x1440     50.00 + 100.00* 
   3840x2160     59.94  
   2560x1440    120.00  
   2560x1080     59.94  
   1920x1080    100.00    60.00    59.94    50.00  
   1720x1440     60.00  
   1680x1050    100.00    59.95  
   1440x900     100.00    59.89  
   1280x1024    100.00    75.02    60.02  
   1280x720      59.94    50.00  
   1024x768      75.03    70.07    60.00  
   800x600       75.00    72.19    60.32    56.25  
   720x576       50.00  
   720x480       59.94  
   640x480       75.00    72.81    59.94    59.93  
eDP-1-1 connected 1920x1080+0+0 (normal left inverted right x axis y axis) 344mm x 193mm
   1920x1080    120.11*+  59.97    59.96    59.93    48.08  
   1680x1050     59.95    59.88  
   1400x1050     74.76    59.98  
   1600x900      59.99    59.94    59.95    59.82  
   1280x1024     85.02    75.02    60.02  
   1400x900      59.96    59.88  
   1280x960      85.00    60.00  
   1440x810      60.00    59.97  
   1368x768      59.88    59.85  
   1280x800      59.99    59.97    59.81    59.91  
   1152x864      75.00  
   1280x720      60.00    59.99    59.86    59.74  
   1024x768      85.00    75.05    60.04    85.00    75.03    70.07    60.00  
   1024x768i     86.96  
   960x720       85.00    75.00    60.00  
   928x696       75.00    60.05  
   896x672       75.05    60.01  
   1024x576      59.95    59.96    59.90    59.82  
   960x600       59.93    60.00  
   832x624       74.55  
   960x540       59.96    59.99    59.63    59.82  
   800x600       85.00    75.00    70.00    65.00    60.00    85.14    72.19    75.00    60.32    56.25  
   840x525       60.01    59.88  
   864x486       59.92    59.57  
   700x525       74.76    59.98  
   800x450       59.95    59.82  
   640x512       85.02    75.02    60.02  
   700x450       59.96    59.88  
   640x480       85.09    60.00    85.01    72.81    75.00    59.94  
   720x405       59.51    58.99  
   720x400       85.04  
   684x384       59.88    59.85  
   640x400       59.88    59.98    85.08  
   576x432       75.00  
   640x360       59.86    59.83    59.84    59.32  
   640x350       85.08  
   512x384       85.00    75.03    70.07    60.00  
   512x384i      87.06  
   512x288       60.00    59.92  
   416x312       74.66  
   480x270       59.63    59.82  
   400x300       85.27    72.19    75.12    60.32    56.34  
   432x243       59.92    59.57  
   320x240       85.18    72.81    75.00    60.05  
   360x202       59.51    59.13  
   360x200       85.04  
   320x200       85.27  
   320x180       59.84    59.32  
   320x175       85.27  
  1680x1050 (0x1c8) 146.250MHz -HSync +VSync
        h: width  1680 start 1784 end 1960 total 2240 skew    0 clock  65.29KHz
        v: height 1050 start 1053 end 1059 total 1089           clock  59.95Hz
  1280x1024 (0x1cc) 135.000MHz +HSync +VSync
        h: width  1280 start 1296 end 1440 total 1688 skew    0 clock  79.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  75.02Hz
  1280x1024 (0x1cd) 108.000MHz +HSync +VSync
        h: width  1280 start 1328 end 1440 total 1688 skew    0 clock  63.98KHz
        v: height 1024 start 1025 end 1028 total 1066           clock  60.02Hz
  1024x768 (0x1d0) 78.750MHz +HSync +VSync
        h: width  1024 start 1040 end 1136 total 1312 skew    0 clock  60.02KHz
        v: height  768 start  769 end  772 total  800           clock  75.03Hz
  1024x768 (0x1d1) 75.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1328 skew    0 clock  56.48KHz
        v: height  768 start  771 end  777 total  806           clock  70.07Hz
  1024x768 (0x1d2) 65.000MHz -HSync -VSync
        h: width  1024 start 1048 end 1184 total 1344 skew    0 clock  48.36KHz
        v: height  768 start  771 end  777 total  806           clock  60.00Hz
  800x600 (0x1d4) 50.000MHz +HSync +VSync
        h: width   800 start  856 end  976 total 1040 skew    0 clock  48.08KHz
        v: height  600 start  637 end  643 total  666           clock  72.19Hz
  800x600 (0x1d3) 49.500MHz +HSync +VSync
        h: width   800 start  816 end  896 total 1056 skew    0 clock  46.88KHz
        v: height  600 start  601 end  604 total  625           clock  75.00Hz
  800x600 (0x1d5) 40.000MHz +HSync +VSync
        h: width   800 start  840 end  968 total 1056 skew    0 clock  37.88KHz
        v: height  600 start  601 end  605 total  628           clock  60.32Hz
  800x600 (0x1d6) 36.000MHz +HSync +VSync
        h: width   800 start  824 end  896 total 1024 skew    0 clock  35.16KHz
        v: height  600 start  601 end  603 total  625           clock  56.25Hz
  640x480 (0x1d9) 31.500MHz -HSync -VSync
        h: width   640 start  656 end  720 total  840 skew    0 clock  37.50KHz
        v: height  480 start  481 end  484 total  500           clock  75.00Hz
  640x480 (0x1db) 25.175MHz -HSync -VSync
        h: width   640 start  656 end  752 total  800 skew    0 clock  31.47KHz
        v: height  480 start  490 end  492 total  525           clock  59.94Hz

What would be the proper way to persists the config is this situation? I appreciate the help, thanks in advance.

Following the example in the wiki, I’ve created a /etc/X11/xorg.conf.d/20-nvidia.conf file with the below content, it doesn’t seem to worked, as the tearing persists, and pipeline composition is shown as disabled in GUI app.

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA GeForce RTX 2060"
EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    Option         "ForceFullCompositionPipeline" "on"
    Option         "AllowIndirectGLXProtocol" "off"
    Option         "TripleBuffer" "on"
EndSection

Following the guide here, and installing nvidia-force-comp-pipeline from AUR has solved the issue for me. If someone can point out what was wrong in my initial steps, I’d appreciate it.

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.