Stuttering and tearing in videos (nvidia - kde)

I know the situation of Nvidia proprietary drivers in this regard, but I would like to know if there is already some kind of fix to this.
Everyone seems to fix this with the option “activate composition pipeline” in nvidia settings, but it´s not my case, this option solves the tearing in the desktop, but I still have some other problems that I don´t know if they have solution yet.

When I play videos in mpv (mostly when there are at 60fps) I notice some “jumps” in some frames, which is really annoying. Since I tried almost everything possible, I noticed that this happens in KDE and XFCE at least, and in KDE when activating vsync in the compositor, it happens less frequently than with the option of force full composition pipeline in nvidia settings, but still happens. If both options vsync in compositor and force composition pipeline are activated, the performance is awful, so I have to decide in one of them. Also if I have the video in full screen with vsync enabled and pipeline disabled, it does not happen, but still happens in window mode… really weird.

Also in firefox, at least in the current version of manjaro (in the previous version this wasn´t happening, I THINK, I´m not sure even after hours of testing because this seems to be really erratic) when playing a video in youtube or any web I get the typical tearing problem which should be fixed with force composition pipeline and it´s kind of impossible to watch anything while dealing with it. I tried with and without hardware acceleration, with different profiles and with different about:config options and it´s the same. It happens also in chromium and brave so I concluded that the problem is the whole system display, and not only the web browser.

I´ve been dealing with this since I installed manjaro kde 2 years ago, so it´s not because of some drivers update. Some updates seems to fix or broke this somehow, but my system has never been absolutely stable in this regard.

Summary:
-Random Stuttering in mpv with different options.
-Awful tearing in browsers.
If I enable composite pipeline I get bad mpv performance and better firefox one, and if I enable kde vsync I get better mpv performance and impossible to watch videos in browsers.

Any possible solution?.

1 Like

what? I didn´t withdrawn anything

1 Like

I don´t have any option “NoLogo” and I would like not to use triple buffer since I saw some people saying that it would be aggressive on hardware. I´m sure that a better solution exists.
Also I don´t have any problems gaming, so my problem could be different than yours.

So, you previously modified the nvidia.conf then?
Make sure at least you have the last config entries from default one


Section "Extensions"
    Option         "COMPOSITE" "Enable"
EndSection

 
Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Don’t know who those people are, how they understand things, or if you do, but with triple buffering, the graphics hardware is working just as hard as it does with double buffering and no vsync and the end user gets all the benefit without the potential downside. Triple buffering does take up a handful of extra memory on the graphics hardware, but on modern hardware this is not a significant issue. On my end it never went above this, only when i render files in Blender

image

Your GPU is much modern than mine.

I didn´t modify the file myself, I just used nvidia-settings to get some options keep on restart.
This is my xorg.conf file:

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

# nvidia-xconfig: X configuration file generated by nvidia-xconfig
# nvidia-xconfig:  version 430.64

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

Section "Files"
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"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LG Electronics LG FULL HD"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1060 6GB"
EndSection

Section "Screen"

# Removed Option "metamodes" "nvidia-auto-select +0+0"
# Removed Option "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
# Removed Option "metamodes" "nvidia-auto-select +0+0"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-1"
    Option         "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

If what you say it´s true then I would try tripple buffering, but if that is so useful why is not activated by default?.

Yeah, that means YOU modified it :slight_smile: and indeed your conf is missing the last lines i mentioned. Also, using both Force and ForceFull is a bad idea.

Have you seen my comment ?

In principle, once wayland will be a real thing, the .conf file will be obsolete, but for now is provided as a minimum default so anybody can use it regardless the DE and if they want to try wayland to not get into a trouble that might make the system unrecoverable.

I understand.
Why ForceFull is a bad idea? It works just as Force.
Also when using wayland there are no problems like this? Should I try it instead of messing with the configs when KDE updates to get wayland support?
And if I delete the kwin.sh file and delete Option "TripleBuffer" "On" from xorg.conf, the system will be like now or some of those apply permanent configurations to some part of the system?. I would like to know it in case I find another solution or I want to return to my current state for some reason.

The difference between ForceCompositionPipeline and ForceFullCompositionPipeline is that the former will still use the display engine’s scaling if it can, while the latter does everything including scaling in the graphics engine. This is what i gathered and is not a good idea to have them both doing one thing.

If you delete them then it will be back to what is without them. There is no other place that those are saved.

Ok I did it and added
Option “TripleBuffer” “On”
Option “ConnectToAcpid” “Off”

in the section “screen” of xorg.conf, and I have Force only activated.

Also I created the kwin.sh file with
export KWIN_TRIPLE_BUFFER=1
in it.

The behavior is exactly the same as described in my first post, so it didn´t work at all.

Also I have to say that the triple buffer option took more than 20% of my gpu memory, that could be a problem with some games…

I’m from the other “school” regarding how to configure Nvidia drivers, and I’m using Nvidia Settings and Force Full Composition Pipeline, after setting the resolution AND refresh rate to the appropriate one (for example my monitor let me select two different ‘60Hz’ refresh rate, but only the second one give me proper result so be careful of that too). One thing to note, after setting everything in Nvidia Settings, I start it again with sudo nvidia-settings to save the new config file to /etc/X11/mhwd.d/nvidia.conf (do not merge, just overwrite it). When it is saved with sudo on the system config file, do not forget to reboot or else the setting will not work properly. Also before configuring the Nvidia settings, I disable Vsync in KDE. See screenshots (click the album):

This method works on every single Nvidia computer I had on hands. Note that this is always said that one should never run a graphical program with sudo, but I still do it for Nvidia Settings, and never had issue following the same steps.

PS: I do not use the triple buffer trick either.

1 Like

Well your “school” is what I already tried without any improvement XD

I have exactly your same configuration in the compositor, and I already tried with a manually selected resolution and refresh rate. I restart after every change and still no impact at all in my problem.

Also if I set in the compositor something else than “always” in the windows thumbnail option, the whole system becomes reaaaally laggy for some reason.

Are you sure you don´t have a little stuttering with mpv and 60fps videos?, it´s barely noticeable but it´s still there, and also the tearing in firefox or chromium videos. I´m starting to think that everyone have the problem but no one is as fussy as me when watching videos…

No I don’t have any kind of stutter or tearing in SMPlayer, or Firefox. I’m pretty confident I would spot anything not 100% fluid.

I saw you said you tried full composition, but I doubt it is not working for you if you exactly follow all the steps. Are you sure you overwrite the config file with setting from Nvidia Settings as explained, before rebooting (simply setting for the user does not work for me, I need to ‘duplicate’ the configuration with sudo)?

1 Like

Yeah, trust me I´ve done every step correctly, as I said I have tried to fix this problem lots of times with no result, and I was wondering if this time I could solve it.
I tried composition with and without full, every possible kde compositor settings combination and some other tricks like that one of the triple buffer.
My current state is with your same config in nvidia-settings and with the same in compositor but the window thumbnails option, and I have been with this configuration for some days until today and with this stuttering problems.
Also yes, I know the sudo thing with nvidia-settings, I do the same like you.

As a last resort have you considered trying to wipe Nvidia from your computer and reinstalling clean? Maybe something went wrong during the update (I see you went from Nvidia 430 to 460 with the configs you posted, supposedly during the big Nvidia change in Manjaro recently) and you have a mystery issue?

Maybe try again to find some configuration but if Bogdancovaciu’s method, and mine fail, then either you’re doing something wrong or something we don’t know on your system interferes, or maybe something is not working as intended with the drivers?

//EDIT: I was comparing our hardware/system from your profile, you’re using very old Kernel maybe drivers don’t work good with Kernel 4.19, maybe try 5.10.

Before the update I had the same problems but worse, I had the composite pipeline disabled, and vsync with kde enabled. I got that config after lots of try and failure and noticing that nvidia-settings composite pipeline was waaaay laggy than what is like now. After the update, since the drivers got updated, I thought that now the problem could be fixed with composite pipeline, and it´s better than before the update, but still no perfect.

oh sorry about that, I´m using 5.4, my profile is outdated.

All right. I don’t know what else you could try, I have similar system and it just works. You shouldn’t have any issue regarding performance.

Here is my proposal, backup your config and use this one:

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"
    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"
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "LG Electronics LG FULL HD"
    HorizSync       30.0 - 83.0
    VertRefresh     56.0 - 75.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "GeForce GTX 1060 6GB"
    Option         "TripleBuffer"  "On"
    Option  "ConnectToAcpid"    "Off"
EndSection

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

Section "Extensions"
    Option         "COMPOSITE" "Enable"
EndSection

 
Section "InputClass"
    Identifier          "Keyboard Defaults"
    MatchIsKeyboard        "yes"
    Option              "XkbOptions" "terminate:ctrl_alt_bksp"
EndSection

Add to the kwin.sh all this 3 lines:

export KWIN_TRIPLE_BUFFER=1
export __GL_YIELD=USLEEP
export __GL_MaxFramesAllowed=1

Run this command from terminal after that:
sudo mhwd-gpu --setmod nvidia --setxorg /etc/X11/mhwd.d/nvidia.conf
Reboot the system.
You can comment out the triple buffer if you will want that, or is not working and also remove the kwin.sh, but with this settings even a GTX 650, i have on another machine performs, well on KDE Plasma …

1 Like

I don´t think that it´s a matter of performance or power, it´s just like some kind of output lag between the video and the display, I don´t know how to explain it, but it´s not like the gpu is overloaded and I need a configuration for an older gpu.
Still I´ll try with that and see if it fixes this.
Should I disable compositor in kde? or just disable vsync? or all enabled?

Also I´m doing the chages to xorg.conf file and they apply correctly since previously the triple buffer activated correctly, and nvidia-settings shows all that I set in that file when reboot, is it necessary to use mhwd.d/nvidia.conf? that file is empty in my system.