Video Stuttering- Nvidia

So I’m having an issue where all video is stuttering when playing. This includes streamed video through a browser or even a video playing on VLC. It has been happening for a few weeks. I am using a GTX1060 with the nvidia drivers, which used to work perfectly fine. I’m unsure where to even start troubleshooting this and hoping someone can provide some guidance!

System:
  Kernel: 5.17.6-1-MANJARO arch: x86_64 bits: 64 Desktop: GNOME v: 42.1
    Distro: Manjaro Linux
Machine:
  Type: Desktop Mobo: ASRock model: Z170 Extreme4 serial: <filter>
    UEFI-[Legacy]: American Megatrends v: P7.20 date: 11/22/2016
CPU:
  Info: quad core model: Intel Core i7-6700K bits: 64 type: MT MCP cache:
    L2: 1024 KiB
  Speed (MHz): avg: 4008 min/max: 800/4400 cores: 1: 2373 2: 3425 3: 4271
    4: 4400 5: 4400 6: 4400 7: 4400 8: 4400
Graphics:
  Device-1: NVIDIA GP104 [GeForce GTX 1060 6GB] driver: nvidia v: 510.68.02
  Display: server: X.Org v: 21.1.3 with: Xwayland v: 22.1.1 driver: X:
    loaded: nvidia gpu: nvidia resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz
    3: 1920x1200~60Hz
  Message: Unable to show GL data. Required tool glxinfo missing.
Audio:
  Device-1: Intel 100 Series/C230 Series Family HD Audio
    driver: snd_hda_intel
  Device-2: NVIDIA GP104 High Definition Audio driver: snd_hda_intel
  Sound Server-1: ALSA v: k5.17.6-1-MANJARO running: yes
  Sound Server-2: PipeWire v: 0.3.51 running: yes
Network:
  Device-1: Intel Ethernet I219-V driver: e1000e
  IF: enp0s31f6 state: down mac: <filter>
  Device-2: Intel Wireless 8260 driver: iwlwifi
  IF: wlp7s0 state: up mac: <filter>
  IF-ID-1: vboxnet0 state: up speed: 10 Mbps duplex: full mac: <filter>
Drives:
  Local Storage: total: 26.36 TiB used: 14.72 TiB (55.8%)
  ID-1: /dev/sda vendor: Western Digital model: WD4004FZWX-00GBGB0
    size: 3.64 TiB
  ID-2: /dev/sdb vendor: Samsung model: SSD 870 EVO 500GB size: 465.76 GiB
  ID-3: /dev/sdc vendor: Samsung model: SSD 870 EVO 1TB size: 931.51 GiB
  ID-4: /dev/sdd vendor: Geil model: ZENITH R3 480GB size: 447.13 GiB
  ID-5: /dev/sde vendor: Western Digital model: WD6003FZBX-00K5WB0
    size: 5.46 TiB
  ID-6: /dev/sdf vendor: Western Digital model: WD101FZBX-00ATAA0
    size: 9.1 TiB
  ID-7: /dev/sdg vendor: Seagate model: ST4000DM005-2DP166 size: 3.64 TiB
  ID-8: /dev/sdh vendor: Hitachi model: HDS5C3020BLE630 size: 1.82 TiB
  ID-9: /dev/sdi vendor: Marvell model: Raid VD size: 931.43 GiB
Partition:
  ID-1: / size: 255.12 GiB used: 101.13 GiB (39.6%) fs: ext4 dev: /dev/sdb1
  ID-2: /home size: 915.82 GiB used: 245.13 GiB (26.8%) fs: ext4
    dev: /dev/sdc1
Swap:
  ID-1: swap-1 type: partition size: 31.98 GiB used: 97.8 MiB (0.3%)
    dev: /dev/sdb2
Sensors:
  System Temperatures: cpu: 33.0 C pch: 40.5 C mobo: 33.0 C gpu: nvidia
    temp: 36 C
  Fan Speeds (RPM): fan-1: 0 fan-2: 1539 fan-3: 0 fan-4: 1300 fan-5: 885
    fan-6: 0 gpu: nvidia fan: 55%
Info:
  Processes: 383 Uptime: 2h 52m Memory: 31.29 GiB used: 14.99 GiB (47.9%)
  Shell: Zsh inxi: 3.3.16

Can you check the system load with top or htop ?

System load seems fine. htop gave this: ‘Load average: 2.20 1.95 1.75’
CPU’s are sitting around 15% utilisation. Memory: using 14G out of 31.3G. (I do have a VM running atm hence the high memory usage - But issue still occurs if the VM is not running).

Issue happens even after a fresh restart.

Care to share /etc/X11/mhwd.d/nvidia.conf ?

Well that’s strange, I have no nvidia.conf in there. I do have this: /etc/X11/xorg.conf
I’m not sure it’s even in use or how to tell if it is… It seems as if it isn’t as I have been using 3 monitors for a while now and there’s only 2 listed in xorg.conf

I assume this could be part of my problem? What would be the best way to generate it?

Here’s xorg.conf:

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

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"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "ViewSonic VX2757"
    HorizSync       83.0 - 83.0
    VertRefresh     48.0 - 76.0
    Option         "DPMS"
EndSection

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

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-4"
    Option         "metamodes" "DP-2: nvidia-auto-select +0+0, HDMI-0: nvidia-auto-select +1920+0"
    Option         "SLI" "Off"
    Option         "MultiGPU" "Off"
    Option         "BaseMosaic" "off"
    SubSection     "Display"
        Depth       24
    EndSubSection
EndSection

Delete that file.
You manually edited it and save it there. Since Manjaro is suing MHWD, the proper place is as mentioned, and also /etc/X11/xorg.conf.d/90-mhwd.conf should be a symlink to /etc/X11/mhwd.d/nvidia.conf

You excluded the last few lines in the conf, so here is as i recommend it, close to default.

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

Section "Files"
EndSection

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

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

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "ViewSonic VX2757"
    HorizSync       83.0 - 83.0
    VertRefresh     48.0 - 76.0
    Option         "DPMS"
EndSection

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

Section "Screen"
    Identifier     "Screen0"
    Device         "Device0"
    Monitor        "Monitor0"
    DefaultDepth    24
    Option         "Stereo" "0"
    Option         "nvidiaXineramaInfoOrder" "DFP-4"
    Option         "metamodes" "DP-2: nvidia-auto-select +0+0, HDMI-0: nvidia-auto-select +1920+0"
    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

Once you save it in /etc/X11/mhwd.d/nvidia.conf run this command from terminal:

sudo mhwd-gpu --setmod nvidia --setxorg /etc/X11/mhwd.d/nvidia.conf

and reboot the system.
If is not much of a change, there is another thing we can try.

2 Likes

@bogdancovaciu Thank’s for the detailed write up. I followed all the above steps with only one small change to the screen section of nvidia.conf to include my third monitor:

From this: Option "metamodes" "DP-2: nvidia-auto-select +0+0, HDMI-0: nvidia-auto-select +1920+0"
To this: Option "metamodes" "DP-2: nvidia-auto-select +1920+120, HDMI-0: nvidia-auto-select +0+0, DP-5: nvidia-auto-select +3840+120"

I created the symlink /etc/X11/xorg.conf.d/90-mwhd.conf and then ran the setxorg command.

After a reboot unfortunately the problem still persists, what would your other suggestion be?

EDIT: I didn’t even have those last few lines that you mentioned I was missing in the conf, but I have added them.

So to be clear: It is only video playback and NOT the whole desktop?

Use this instead:

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

Section "Files"
EndSection

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

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

Section "Monitor"
    # HorizSync source: edid, VertRefresh source: edid
    Identifier     "Monitor0"
    VendorName     "Unknown"
    ModelName      "ViewSonic VX2757"
    HorizSync       83.0 - 83.0
    VertRefresh     48.0 - 76.0
    Option         "DPMS"
EndSection

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
    BoardName      "NVIDIA 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-4"
    Option "metamodes" "DP-2: nvidia-auto-select +1920+120 {ForceCompositionPipeline=On}, HDMI-0: nvidia-auto-select +0+0 {ForceCompositionPipeline=On}, DP-5: nvidia-auto-select +3840+120 {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

create the file /etc/profile.d/kwin.sh
add this lines to it

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

Reboot and see if you notice improvements.

1 Like

@megavolt Yes, only video playback and NOT the whole desktop.

1 Like

So it happens to any videos? Are videos at 2k or 4k resolution? If so, then you need to enable gpu acceleration.

@bogdancovaciu Thanks again for the steps, I changed my nvidia.conf to the above and added the kwin.sh file.

Unfortunately there is still no difference, the video stutter is still there the same as it was before. Do you have any other sugggestions?

@megavolt Yes with any video, I just found some old 480p videos and tried them with the same result. Same when streaming in a browser window, it doesn’t matter what quality the video is played in.

My monitors are only 1080p and the videos I’m playing are 10880p max, definitely not in 2k or 4k.

EDIT: For clarification, it also happens when playing videos in VLC so not just in a browser.

Ok that reminds of something: Maybe Nvidia’s GLX is not active?

journalctl --boot 0 --user --grep "\([A-Z][A-Z]\)" --no-hostname 

Look for something like that:

/usr/lib/gdm-x-session[786]: (II) LoadModule: "glx"
/usr/lib/gdm-x-session[786]: (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
/usr/lib/gdm-x-session[786]: (II) Module glx: vendor="X.Org Foundation"
/usr/lib/gdm-x-session[786]: (II) LoadModule: "nvidia"
/usr/lib/gdm-x-session[786]: (II) LoadModule: "glxserver_nvidia"
/usr/lib/gdm-x-session[786]: (II) Loading /usr/lib/nvidia/xorg/libglxserver_nvidia.so
/usr/lib/gdm-x-session[786]: (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"

Since I have only 1 screen, I just this as config:

$ cat /etc/X11/xorg.conf.d/91-nvidia.conf                                                                                            ✔ 

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

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

Everything is detected automatically and I use nvidia 470xx driver.

1 Like

@megavolt Thanks, I found this:

/usr/lib/gdm-x-session[1963]: (II) LoadModule: "glx"
/usr/lib/gdm-x-session[1963]: (II) Loading /usr/lib/xorg/modules/extensions/libglx.so
/usr/lib/gdm-x-session[1963]: (II) Module glx: vendor="X.Org Foundation"
/usr/lib/gdm-x-session[1963]: (II) LoadModule: "nvidia"

and this:

/usr/lib/gdm-x-session[1963]: (II) LoadModule: "glxserver_nvidia"
/usr/lib/gdm-x-session[1963]: (II) Loading /usr/lib/nvidia/xorg/libglxserver_nvidia.so
/usr/lib/gdm-x-session[1963]: (II) Module glxserver_nvidia: vendor="NVIDIA Corporation"

So it looks like GLX is fine, but I did also find the below, not sure if it might indicate an issue or not.

/usr/lib/gdm-x-session[1963]: (II) Initializing extension GLX
/usr/lib/gdm-x-session[1963]: (II) Initializing extension GLX
/usr/lib/gdm-x-session[1963]: (II) Indirect GLX disabled.
/usr/lib/gdm-x-session[1963]: (II) GLX: Another vendor is already registered for screen 0

I’m using the most recent driver: 510.68.02 - Installed via Manjaro Settings Manager (video-nvidia)
As this issue is somewhat recent, maybe I should try an older driver?

Could be worth a try. Also, maybe a dumb question, but could it be that you run “Gnome Classic” (fallback option)? It has no OpenGL acceleration.

1 Like

Definitely not a dumb question, it wouldn’t be the first time that a problem is solved by something so simple that it’s overlooked! I actually wasn’t sure so I logged out and back in to see which option is selected at the login screen and GNOME is what I’m using NOT Gnome Classic.

I don’t have the time atm to change drivers and test, dinner is calling. But I’ll give it a try tomorrow after work when I have some free time.

I really appreciate the time you’ve taken to help me out (you too @bogdancovaciu) If you happen to have any other ideas please let me know!!

@megavolt @bogdancovaciu So I tried an earlier nvidia driver (470xx) and the problem still persists, upon further inspection, it could be that the whole desktop is suffering from the stutter.

It’s not something that I noticed previously, but I noticed a loading bar on an app that seemed to have the same stutter, I then noticed it when scrolling a webpage quickly I then ran glxgears and that has the same stutter.

So it seems it might be a different issue altogether, any advice?

Can you post inxi -G ?
And: is there another graphics driver installed ?
mhwd -li

@Keruskerfuerst thanks for the reply.

Graphics:
  Device-1: NVIDIA GP104 [GeForce GTX 1060 6GB] driver: nvidia v: 470.129.06
  Display: x11 server: X.Org v: 21.1.3 with: Xwayland v: 22.1.1 driver: X:
    loaded: nvidia gpu: nvidia resolution: 1: 1920x1080~60Hz 2: 1920x1080~60Hz
    3: 1920x1200~60Hz
  OpenGL: renderer: NVIDIA GeForce GTX 1060 6GB/PCIe/SSE2
    v: 4.6.0 NVIDIA 470.129.06

and

> Installed PCI configs:
--------------------------------------------------------------------------------
                  NAME               VERSION          FREEDRIVER           TYPE
--------------------------------------------------------------------------------
    video-nvidia-470xx            2021.12.18               false            PCI
     video-modesetting            2020.01.13                true            PCI
           video-linux            2018.05.04                true            PCI
            video-vesa            2017.03.12                true            PCI

So yes there is other drivers installed but not being used… should I remove them?