Screen Tearing with AMD/nVidia

Hi,
I have a problem. I have a laptop with AMD CPU (Ryzen 7) and nVidia GPU (GTX 1650), so I must use optimus-manager. (I think) But if I’m using the optimus-manager, the screen is tearing, or the “V-Sync” isn’t working. How to fix it? It’s visible if I’m moving windows, scrolling on pages, looking at the video, games, etc…
Thanks

post system info:
inxi -Faz
mhwd -l && mhwd -li
find /etc/X11/ -name "*.conf"
use formatting, click this icon: </> and copy the output there

Here, thanks for response.

System:
  Kernel: 5.15.65-1-MANJARO arch: x86_64 bits: 64 compiler: gcc v: 12.2.0
    parameters: BOOT_IMAGE=/boot/vmlinuz-5.15-x86_64
    root=UUID=ffa3f7b3-576a-4c33-a228-049fbb74a8f5 rw quiet apparmor=1
    security=apparmor udev.log_priority=3
  Desktop: Cinnamon v: 5.4.10 tk: GTK v: 3.24.34 vt: 7 dm: LightDM
    v: 1.32.0 Distro: Manjaro Linux base: Arch Linux
Machine:
  Type: Laptop System: HP product: HP Pavilion Gaming Laptop 15-ec1xxx v: N/A
    serial: <superuser required> Chassis: type: 10 serial: <superuser required>
  Mobo: HP model: 87B1 v: 31.23 serial: <superuser required> UEFI: AMI
    v: F.25 date: 08/18/2021
Battery:
  ID-1: BAT0 charge: 42.9 Wh (100.0%) condition: 42.9/42.9 Wh (100.0%)
    volts: 12.7 min: 11.6 model: Hewlett-Packard Primary type: Li-ion
    serial: N/A status: full cycles: 385
CPU:
  Info: model: AMD Ryzen 7 4800H with Radeon Graphics bits: 64 type: MT MCP
    arch: Zen 2 gen: 3 level: v3 built: 2020-22 process: TSMC n7 (7nm)
    family: 0x17 (23) model-id: 0x60 (96) stepping: 1 microcode: 0x8600106
  Topology: cpus: 1x cores: 8 tpc: 2 threads: 16 smt: enabled cache:
    L1: 512 KiB desc: d-8x32 KiB; i-8x32 KiB L2: 4 MiB desc: 8x512 KiB
    L3: 8 MiB desc: 2x4 MiB
  Speed (MHz): avg: 1488 high: 2337 min/max: 1400/2900 boost: enabled
    scaling: driver: acpi-cpufreq governor: schedutil cores: 1: 2337 2: 1397
    3: 1402 4: 1411 5: 1398 6: 1397 7: 1891 8: 1414 9: 1397 10: 1397 11: 1397
    12: 1397 13: 1397 14: 1397 15: 1397 16: 1392 bogomips: 92660
  Flags: avx avx2 ht lm nx pae sse sse2 sse3 sse4_1 sse4_2 sse4a ssse3 svm
  Vulnerabilities:
  Type: itlb_multihit status: Not affected
  Type: l1tf status: Not affected
  Type: mds status: Not affected
  Type: meltdown status: Not affected
  Type: mmio_stale_data status: Not affected
  Type: retbleed mitigation: untrained return thunk; SMT enabled with STIBP
    protection
  Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via
    prctl and seccomp
  Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer
    sanitization
  Type: spectre_v2 mitigation: Retpolines, IBPB: conditional, STIBP:
    always-on, RSB filling, PBRSB-eIBRS: Not affected
  Type: srbds status: Not affected
  Type: tsx_async_abort status: Not affected
Graphics:
  Device-1: NVIDIA TU117M vendor: Hewlett-Packard driver: nvidia v: 515.65.01
    alternate: nouveau,nvidia_drm non-free: 515.xx+ status: current (as of
    2022-08) arch: Turing code: TUxxx process: TSMC 12nm built: 2018-22 pcie:
    gen: 1 speed: 2.5 GT/s lanes: 8 link-max: gen: 3 speed: 8 GT/s lanes: 16
    ports: active: none off: HDMI-A-1 empty: none bus-ID: 01:00.0
    chip-ID: 10de:1f99 class-ID: 0300
  Device-2: AMD Renoir vendor: Hewlett-Packard driver: amdgpu v: kernel
    arch: GCN-5.1 code: Vega-2 process: TSMC n7 (7nm) built: 2018-21 pcie:
    gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s ports:
    active: eDP-1 empty: none bus-ID: 05:00.0 chip-ID: 1002:1636
    class-ID: 0300
  Device-3: Quanta HP TrueVision HD Camera type: USB driver: uvcvideo
    bus-ID: 3-3:2 chip-ID: 0408:5365 class-ID: 0e02
  Display: x11 server: X.Org v: 21.1.4 driver: X:
    loaded: modesetting,nvidia unloaded: amdgpu,nouveau
    gpu: amdgpu,nvidia,nvidia-nvswitch display-ID: :0 screens: 1
  Screen-1: 0 s-res: 3840x1080 s-dpi: 96 s-size: 1016x286mm (40.00x11.26")
    s-diag: 1055mm (41.55")
  Monitor-1: HDMI-A-1 mapped: HDMI-0 note: disabled pos: primary,right
    model: HP 27fw serial: <filter> built: 2018 res: 1920x1080 dpi: 82
    gamma: 1.2 size: 598x336mm (23.54x13.23") diag: 686mm (27") ratio: 16:9
    modes: max: 1920x1080 min: 640x480
  Monitor-2: eDP-1 mapped: eDP-1-1 pos: primary,left model: ChiMei InnoLux
    0x1521 built: 2020 res: 1920x1080 hz: 144 dpi: 142 gamma: 1.2
    size: 344x193mm (13.54x7.6") diag: 394mm (15.5") ratio: 16:9 modes:
    max: 1920x1080 min: 640x480
  OpenGL: renderer: NVIDIA GeForce GTX 1650/PCIe/SSE2 v: 4.6.0 NVIDIA
    515.65.01 direct render: Yes
Audio:
  Device-1: NVIDIA vendor: Hewlett-Packard driver: snd_hda_intel v: kernel
    bus-ID: 1-2.2:5 chip-ID: 0951:16a4 pcie: class-ID: 0300 gen: 3
    serial: <filter> speed: 8 GT/s lanes: 8 link-max: lanes: 16
    bus-ID: 01:00.1 chip-ID: 10de:10fa class-ID: 0403
  Device-2: AMD ACP/ACP3X/ACP6x Audio Coprocessor vendor: Hewlett-Packard
    driver: N/A alternate: snd_pci_acp3x, snd_rn_pci_acp3x, snd_pci_acp5x pcie:
    gen: 3 speed: 8 GT/s lanes: 16 link-max: gen: 4 speed: 16 GT/s
    bus-ID: 05:00.5 chip-ID: 1022:15e2 class-ID: 0480
  Device-3: AMD Family 17h/19h HD Audio vendor: Hewlett-Packard
    driver: snd_hda_intel v: kernel pcie: gen: 3 speed: 8 GT/s lanes: 16
    link-max: gen: 4 speed: 16 GT/s bus-ID: 05:00.6 chip-ID: 1022:15e3
    class-ID: 0403
  Device-4: Kingston HyperX 7.1 Audio type: USB
    driver: hid-generic,snd-usb-audio,usbhid
  Sound Server-1: ALSA v: k5.15.65-1-MANJARO running: yes
  Sound Server-2: JACK v: 1.9.21 running: no
  Sound Server-3: PulseAudio v: 16.1 running: yes
  Sound Server-4: PipeWire v: 0.3.57 running: yes
Network:
  Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet
    vendor: Hewlett-Packard driver: r8169 v: kernel pcie: gen: 1
    speed: 2.5 GT/s lanes: 1 port: e000 bus-ID: 02:00.0 chip-ID: 10ec:8168
    class-ID: 0200
  IF: eno1 state: up speed: 1000 Mbps duplex: full mac: <filter>
  Device-2: Realtek RTL8822CE 802.11ac PCIe Wireless Network Adapter
    vendor: Hewlett-Packard driver: rtw_8822ce v: N/A modules: rtw88_8822ce
    pcie: gen: 1 speed: 2.5 GT/s lanes: 1 port: d000 bus-ID: 03:00.0
    chip-ID: 10ec:c822 class-ID: 0280
  IF: wlo1 state: down mac: <filter>
Bluetooth:
  Device-1: Realtek 802.11ac WLAN Adapter type: USB driver: btusb v: 0.8
    bus-ID: 1-4:3 chip-ID: 0bda:b00c class-ID: e001 serial: <filter>
  Report: rfkill ID: hci0 rfk-id: 0 state: up address: see --recommends
Drives:
  Local Storage: total: 1.38 TiB used: 265.54 GiB (18.9%)
  SMART Message: Required tool smartctl not installed. Check --recommends
  ID-1: /dev/nvme0n1 maj-min: 259:0 vendor: Samsung
    model: MZVLQ512HALU-000H1 size: 476.94 GiB block-size: physical: 512 B
    logical: 512 B speed: 31.6 Gb/s lanes: 4 type: SSD serial: <filter>
    rev: HPS4NFXV temp: 32.9 C scheme: GPT
  ID-2: /dev/sda maj-min: 8:0 vendor: Crucial model: CT1000MX500SSD1
    size: 931.51 GiB block-size: physical: 512 B logical: 512 B speed: 6.0 Gb/s
    type: SSD serial: <filter> rev: 023 scheme: GPT
Partition:
  ID-1: / raw-size: 546.18 GiB size: 536.54 GiB (98.23%) used: 13.98 GiB
    (2.6%) fs: ext4 dev: /dev/sda2 maj-min: 8:2
  ID-2: /boot/efi raw-size: 100 MiB size: 96 MiB (96.00%) used: 27.3 MiB
    (28.4%) fs: vfat dev: /dev/nvme0n1p1 maj-min: 259:1
Swap:
  Alert: No swap data was found.
Sensors:
  System Temperatures: cpu: 64.1 C mobo: N/A
  Fan Speeds (RPM): N/A
  GPU: device: nvidia screen: :0.0 temp: 49 C device: amdgpu temp: 50.0 C
Info:
  Processes: 355 Uptime: 1h 27m wakeups: 1 Memory: 14.99 GiB used: 3.37 GiB
  (22.4%) Init: systemd v: 251 default: graphical tool: systemctl
  Compilers: gcc: 12.2.0 clang: 14.0.6 Packages: pm: pacman pkgs: 1259
  libs: 400 tools: pamac,yay pm: flatpak pkgs: 0 Shell: Bash v: 5.1.16
  running-in: gnome-terminal inxi: 3.3.21
[johnacek@johnacek ~]$ mhwd -l && mhwd -li
> 0000:02:00.0 (0200:10ec:8168) Network controller Realtek Semiconductor Co., Ltd.:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
         network-r8168            2016.04.20                true            PCI


> 0000:01:00.0 (0300:10de:1f99) Display controller nVidia Corporation:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2021.11.04               false            PCI
video-hybrid-amd-nvidia-470xx-prime            2021.11.04               false            PCI
          video-nvidia            2021.11.04               false            PCI
    video-nvidia-470xx            2021.11.04               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI


> 0000:05:00.0 (0300:1002:1636) Display controller ATI Technologies Inc:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
video-hybrid-amd-nvidia-prime            2021.11.04               false            PCI
video-hybrid-amd-nvidia-470xx-prime            2021.11.04               false            PCI
           video-linux            2018.05.04                true            PCI
     video-modesetting            2020.01.13                true            PCI
            video-vesa            2017.03.12                true            PCI


> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
           video-linux            2018.05.04                true            PCI
video-hybrid-amd-nvidia-prime            2021.11.04               false            PCI


Warning: No installed USB configs!

you forget output from this:
find /etc/X11/ -name "*.conf"
and do you have installed optimus-manager and optimus-manager-qt?

Yes, I have both installed. Ah, sorry, here is it.

/etc/X11/xorg.conf.d/00-keyboard.conf
/etc/X11/xorg.conf.d/10-optimus-manager.conf
/etc/X11/xorg.conf
/etc/X11/mhwd.d/nvidia.conf

post output from the configs:
cat /etc/X11/xorg.conf
cat /etc/X11/mhwd.d/nvidia.conf
cat /etc/X11/xorg.conf.d/10-optimus-manager.conf

and there are settings in optimus-manager-qt, to enable vscyn, tripple buffer etc, dont have it no longer installed, so cant check …

1)
Section "ServerLayout"
	Identifier     "X.org Configured"
	Screen      0  "Screen0" 0 0
	Screen      1  "Screen1" RightOf "Screen0"
	InputDevice    "Mouse0" "CorePointer"
	InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
	ModulePath   "/usr/lib/xorg/modules"
	FontPath     "/usr/share/fonts/misc"
	FontPath     "/usr/share/fonts/TTF"
	FontPath     "/usr/share/fonts/OTF"
	FontPath     "/usr/share/fonts/Type1"
	FontPath     "/usr/share/fonts/100dpi"
	FontPath     "/usr/share/fonts/75dpi"
EndSection

Section "Module"
	Load  "glx"
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
EndSection

Section "InputDevice"
	Identifier  "Mouse0"
	Driver      "mouse"
	Option	    "Protocol" "auto"
	Option	    "Device" "/dev/input/mice"
	Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Monitor"
	Identifier   "Monitor1"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "Accel"              	# [<bool>]
        #Option     "SWcursor"           	# [<bool>]
        #Option     "EnablePageFlip"     	# [<bool>]
        #Option     "SubPixelOrder"      	# [<str>]
        #Option     "ZaphodHeads"        	# <str>
        #Option     "AccelMethod"        	# <str>
        #Option     "DRI3"               	# [<bool>]
        #Option     "DRI"                	# <i>
        #Option     "ShadowPrimary"      	# [<bool>]
        #Option     "TearFree"           	# [<bool>]
        #Option     "DeleteUnusedDP12Displays" 	# [<bool>]
        #Option     "VariableRefresh"    	# [<bool>]
        #Option     "AsyncFlipSecondaries" 	# [<bool>]
	Identifier  "Card0"
	Driver      "amdgpu"
	BusID       "PCI:5:0:0"
EndSection

Section "Device"
        ### Available Driver options are:-
        ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
        ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
        ### <percent>: "<f>%"
        ### [arg]: arg optional
        #Option     "SWcursor"           	# [<bool>]
        #Option     "HWcursor"           	# [<bool>]
        #Option     "NoAccel"            	# [<bool>]
        #Option     "ShadowFB"           	# [<bool>]
        #Option     "VideoKey"           	# <i>
        #Option     "WrappedFB"          	# [<bool>]
        #Option     "GLXVBlank"          	# [<bool>]
        #Option     "ZaphodHeads"        	# <str>
        #Option     "PageFlip"           	# [<bool>]
        #Option     "SwapLimit"          	# <i>
        #Option     "AsyncUTSDFS"        	# [<bool>]
        #Option     "AccelMethod"        	# <str>
        #Option     "DRI"                	# <i>
	Identifier  "Card1"
	Driver      "nouveau"
	BusID       "PCI:1:0:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "Screen"
	Identifier "Screen1"
	Device     "Card1"
	Monitor    "Monitor1"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection
2)
##
## Generated by mhwd - Manjaro Hardware Detection
##
3)
Section "Files"
	ModulePath "/usr/lib/nvidia"
	ModulePath "/usr/lib32/nvidia"
	ModulePath "/usr/lib32/nvidia/xorg/modules"
	ModulePath "/usr/lib32/xorg/modules"
	ModulePath "/usr/lib64/nvidia/xorg/modules"
	ModulePath "/usr/lib64/nvidia/xorg"
	ModulePath "/usr/lib64/xorg/modules"
EndSection

Section "ServerLayout"
	Identifier "layout"
	Screen 0 "nvidia"
	Inactive "integrated"
EndSection

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

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

Section "Device"
	Identifier "integrated"
	Driver "modesetting"
	BusID "PCI:5:0:0"
EndSection

Section "Screen"
	Identifier "integrated"
	Device "integrated"
EndSection

so did you checked the settings in optimus manager qt:

and did the screen tearing happened before you have installed optimus?
and did the screen tearing happens on amdgpu or on nvidia?

I checked, but I didn’t found any option to VSync or something else. The screen tearing is only on the second monitor, on the monitor on laptop is it okay. Bcs without optimus, the second monitor isn’t working for me, I must have optimus. It’s happening on nVidia, because monitor is connected only to nVidia card.

so you are switched to nvidia?

Yes, I’m.

so open nvidia settings, and check if there is ForceCompositionPipeline=On

Um, In optimus?

no, nvidia x server settings, search for it in application launcher

Nope, Force Composition Pipeline and Force Full Composition Pipeline are unchecked.

so select first Force Composition Pipeline, click apply/save and test if it helped …
if not select the full composition and see if that helped

Yeeees, the first worked for me. Thanks a lot, I had a problem with this like a year and finally, I fixed it. :smile:

glad it worked, so test so more, and if there are still issues, check if triple buffer is on, and AllowIndirectGLXProtocol is off … dont need to change it, if it works…

Okey, thanks.

am curious, the Force Full Composition Pipeline didnt worked?