Screen tearing and stuttering issues

Hi everybody,

I have an ASUS G75VW laptop with a GeForce GTX 670M. I recently installed Debian on this laptop and everything worked fine except for graphics, which had serious screen tearing and stuttering artifacts. So I tried to install the nvidia drivers (which I got from the nvidia website), but I did not managed to install them due to continue errors during installation. So I added the non-free packages to my sources.list file and installed the package nvidia-legacy-390xx-driver, but the screen artifacts were not solved. After looking on the internet for some days, I found out that I should use a xorg.conf file in order to get everything working. So I played around with some settings (most of which have been copy-pasted from other websites) and I managed to reduce the issues, even though they are not disappeared completely. I was wondering if somebody is able to help me solving this annoying issue.

Thanks in advance.

Here’s my configuration:

  • I use an external 1280x1024 (60 or 75 Hz) external screen connected with the HDMI port of the laptop.
  • I installed Debian without any Desktop Environment, and as soon as I got to a prompt I installed xorg, i3 and compton. Then I installed the nvidia-legacy-390xx-driver and I configured the softwares as follows:

/usr/share/X11/xorg.conf.d/10-nvidia.conf

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

Section "ServerLayout"
    Identifier     "Layout0"
    Screen      0  "Screen0" 0 0
    InputDevice    "Keyboard0" "CoreKeyboard"
    InputDevice    "Mouse0" "CorePointer"
    Option         "Xinerama" "0"
EndSection

Section "Files"
EndSection

Section "Module"
    Load           "dbe"
    Load           "extmod"
    Load           "type1"
    Load           "freetype"
    Load           "glx"
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 "InputDevice"
    # generated from default
    Identifier     "Keyboard0"
    Driver         "kbd"
EndSection

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "FUS P19-3P"
    HorizSync       30.0 - 82.0
    VertRefresh     56.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 670M"
    Option         "NoLogo" "1"
    Option         "MigrationHeuristic" "greedy"
    Option         "AccelMethod" "sna"
    Option         "TearFree"    "true"
    Option "RenderAccel" "True"
    Option "AddARGBGLXVisuals" "True"
    Option "OnDemandVBlankInterrupts" "True"
    Option "InitialPixmapPlacement" "2"
    Option "BackingStore" "True"
    Option "DamageEvents" "True"
    Option "UseEvents" "False"
    Option "Coolbits" "1"
    Option "DisableGLXRootCliping" "True"
    Option "TripleBuffer" "true"
    Option "Coolbits" "24"
    Option "PixmapCacheSize" "300000"
    Option "GlyphCache" "1"

EndSection

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "metamodes" "HDMI-0: nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

~/.config/i3/config [excerpt]

exec --no-startup-id compton --config ~/.config/compton.conf -CGb --backend glx --paint-on-overlay --vsync opengl-swc

~/.config/compton.conf

# basic configuration
backend = "glx";
vsync = "opengl-swc";
paint-on-overlay = true
glx-no-stencil = true

glx-copy-from-front = true;
glx-swap-method = 2;
xrender-sync = true;
xrender-sync-fence = true;

# transparancy settings for i3
opacity-rule = [
    "0:_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
];

/etc/modprobe.d/zz-nvidia-modeset.conf

options nvidia_390_drm modeset=1

/etc/default/grub [excerpt]

#
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
# GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX_DEFAULT="quiet <b>nvidia-drm.modeset=1</b> "
GRUB_CMDLINE_LINUX=""

/etc/profile [excerpt]

export __GL_SYNC_TO_VBLANK=1
export __GL_SYNC_DISPLAY_DEVICE=DVI-I-1
export __VDPAU_NVIDIA_SYNC_DISPLAY_DEVICE==DVI-I-1
export __GL_SYNC_DISPLAY_DEVICE=DVI-I-1
export SDL_VIDEO_FULLSCREEN_HEAD=1
export SDL_VIDEO_FULLSCREEN_DISPLAY=1
export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0

nvidia-bug-report.log: attached (I’ve truncated the last 6000 lines that contained an unintelligible string of alphanumeric characters)
nvidia-bug-report.log.gz (55 KB)

Update: I tried enabling the layers.acceleration.force-enabled in Firefox, which helped a bit with the tearing issues in Firefox.

You already enabled ForceCompositionPipeline=On for the hdmi port, does it still tear on the external monitor? Otherwise, also enable it for the internal monitor.

I disabled the internal monitor and I use only the external one. If I run tests (even outside Firefox, for instance using a video and mpv to play it) I can see some stuttering (the movement is not smooth), but I cannot see video tearing anymore. Some days ago (the only thing that I changed was that option in Firefox) I could see some occasional tearing (every 2/3 seconds) which was clearly visible if I paused the video. Now the only problem left is that I have some problems with the smoothness of the videos I play: if i play https://www.youtube.com/watch?v=MfL_JkcEFbE for instance, I can see the lines trembling a little. At this point I could speculate that the tearing problem existed only in Firefox, but the stuttering (or the “trembling”) problem exists everywhere (I also tried to download that video from youtube to test it with mpv: same problem).

i have stuuttering when watching football although i enable ForceCompositionPipeline and ForceFullCompositionPipeline .when i disabled them no stutter any more on videos but i have jerky image when scrolling on chrome or firefox browser.

i use GTX 1050 ti , driver 440.31 ubuntu-mate 18.04.03 with disabled windows compositor…
regards

Try:
gsettings set org.mate.Marco.general compositing-manager false
This fixed my comption/marco problems but it makes for a rubbish desktop experience.
Damage & redraw problems everywhere. Might as well use lxde.

I have found the last 1 year of ubuntu-Mate to be total rubbish.
Strange inconsistent behaviour with compton.
You can get odd things to work better if you enable compton (marco off) & then disable it but I could never find a start-up setting that worked.

SettingFullCompositionPipeline on seems to cause frame jitter in mpv & MythTV.
MPV warns you in the logs that frame timing will be bad.

To guarantee no tearing with VDPAU it must be using overlay & NOT blitter.
The driver has an OSD setting to indicate that.

You get blitter presentation mode VDPAU if:

  • Composite managers that do not correctly support un-redirected full screen video
  • applications that do not know how to use recent full screen hinting API? (MythTV?)
  • composite manager devs do not want/care if works with Nvidia driver (marco)

I think it may well be open source drivers only are supported by composite managers.

Basically, 10 years ago Gnome Compiz & Nvidia VDPAU etc all worked fine.
Now, you can NOT have an composite decorations on a Nvidia GPU, running the proprietary driver & expect video playback to be any good.

And to top it off, latest drivers VDPAU crash every other day & were very robust 3 -10 years ago (H264 video).

i’ve enabled compton GPU compositor , disabled fullcompostingpipeline and just leaved triplebuffer enabled …now everything work without tearing .

Until it doesn’t.

Triple buffering is a hack & adds ~30ms input lag.
HTPC full screen video with compton probably has frame jitter but possible your video player can handle composite manager properly.

Good luck

A propos video player, i tested vlc, qmplay2 and kodi…
I use compiled ffmpeg from source, no nvdec, no cuvid… Only vdpau is enabled and used.
Good evening