You are not logged in.

#1 2021-12-30 02:41:26

raiguard
Member
Registered: 2021-12-29
Posts: 11

Constant stuttering in all programs and on all screens

Greetings,

Ever since switching to Linux, I have had constant issues with screen stutter. This happened on Zorin OS, Manjaro, and now vanilla Arch, with Gnome, KDE, and Qtile, with and without compositors. None of the fixes I have found online have worked, and some have even made it worse. I'm hoping we can find a solution here, because it is absolutely maddening.

Neofetch:

OS: Arch Linux x86_64 
Kernel: 5.15.11-arch2-1 
Uptime: 1 hour, 9 mins 
Packages: 802 (pacman) 
Shell: bash 5.1.12 
Resolution: 2560x1440, 2560x1440 
DE: qtile 
WM: LG3D 
Theme: Breeze-Dark [GTK2/3] 
Icons: breeze-dark [GTK2/3] 
Terminal: kitty 
CPU: AMD Ryzen 5 3600 (12) @ 3.600GHz 
GPU: NVIDIA GeForce RTX 2060 SUPER 
Memory: 2989MiB / 32078MiB 

Driver: NVIDIA Propreitary
Displays: 3 (the third is my TV and is normally disabled)

I have early KMS enabled to make Wayland actually load, but this happens regardless if it's enabled or not.

Things I have tried:
- Switching on Force Composition Pipeline / Force Full Composition Pipeline
    - When these options are off, there is abhorrent screen tearing, but no stutter
    - With these options on, the tearing is fixed, but the stutter is introduced
- Using Picom with vsync and glx, and FCP / FFCP off - this noticeably improved results on the Vsync test, but did not improve it in games
- Using Wayland - I couldn't get it to behave long enough to test, it kept crashing or hanging
- Unplugging all but one display - tried all three with the same results on all of them
- Using FreeSync on my primary display and Gsync my TV - no effect
- Running my primary display at 75 hz with and without Gsync - no effect

I searched the forum for `nvidia stutter` and tried everything I hadn't already tried with no luck, though I almost definitely missed a few things.

The stutter did not happen on Windows, but I no longer have a Windows partition to test with.

Logs:
journalctl
xrandr
/var/log/Xorg.0.log

(noise in the Xorg log is due to turning on my AVR to get xrandr to recognize my TV at 4k instead of 1080p)

Vsync test results:
https://i.imgur.com/4P07ha0.png

Mod Edit: removed inline image

Last edited by raiguard (2021-12-30 02:53:54)


Don't forget, you're here forever.

Offline

#2 2021-12-30 03:14:35

HalosGhost
Forum Fellow
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,097
Website

Re: Constant stuttering in all programs and on all screens

Raiguard,

Welcome  the BBS! Please take a moment to review the Code of Conduct you agreed to when you registered (note the link to the Guidelines for the BBS specifically and the section within that mentions pasting images).

All the best,

-HG

Offline

#3 2021-12-30 03:31:29

jonno2002
Member
Registered: 2016-11-21
Posts: 842

Re: Constant stuttering in all programs and on all screens

remove the "/etc/X11/xorg.conf" file and create the file "/etc/X11/xorg.conf.d/20-nvidia.conf" and put the following in it:

Section "Screen"
    Identifier     "Screen"
    Option         "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
    Option         "AllowIndirectGLXProtocol" "off"
    Option         "TripleBuffer" "on"
EndSection

worth a try

[edit] i know you said youve tried this but without posting your config file its hard to help, so this is my stab in the dark

Last edited by jonno2002 (2021-12-30 03:34:21)

Online

#4 2021-12-30 04:17:57

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

HalosGhost wrote:

Please take a moment to review the Code of Conduct you agreed to when you registered (note the link to the Guidelines for the BBS specifically and the section within that mentions pasting images).

Oops, sorry about that, I missed the general guidelines link. I'll take a look at it before making another post.

jonno2002 wrote:

remove the "/etc/X11/xorg.conf" file and create the file "/etc/X11/xorg.conf.d/20-nvidia.conf" and put the following in it:

[edit] i know you said youve tried this but without posting your config file its hard to help, so this is my stab in the dark

I actually hadn't tried enabling triple buffer yet, so I gave this a shot, but unfortunately it made no difference.

Here is what my xorg.conf was before trying your suggestion.


Don't forget, you're here forever.

Offline

#5 2021-12-30 15:45:58

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,150

Re: Constant stuttering in all programs and on all screens

Despite the xrandr output, the vsync tester seems to measure the vblank frequency at ~62Hz while the output renders at 60FPS (ie. too slow) what would make tearing and stutter the same effect (when you're syncing, the sync has to wait for the vblank signal and since the render is tooslow™, it will miss the signal and has to sit out a complete frame - hello stutter)

If you only run DP-2 xor DP-4 at 1920x1080@60 and use

Option "ForceFullCompositionPipeline" "On"

instead of the "metamodes" option but no picom: does the problem remain?
What fps does "glxgears" (mesa-demos package) generate?

Offline

#6 2021-12-30 18:01:30

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

seth wrote:

If you only run DP-2 xor DP-4 at 1920x1080@60 and use

Option "ForceFullCompositionPipeline" "On"

instead of the "metamodes" option but no picom: does the problem remain?
What fps does "glxgears" (mesa-demos package) generate?

Running DP-2 at those settings and killing picom makes the vsync test pass perfectly with no visible stutter. However, games - tested with Factorio (native Linux) and Breath of the Wild (CEMU & Wine) - still stutter like crazy.

New vsync test:
https://i.imgur.com/tughq6c.png

glxgears output (ran with the suggested xrandr and nvidia settings):

rai@tantal ~> glxgears
Running synchronized to the vertical refresh.  The framerate should be
approximately the same as the monitor refresh rate.
304 frames in 5.0 seconds = 60.636 FPS
301 frames in 5.0 seconds = 60.000 FPS
301 frames in 5.0 seconds = 59.970 FPS
301 frames in 5.0 seconds = 60.030 FPS
301 frames in 5.0 seconds = 59.972 FPS
301 frames in 5.0 seconds = 60.030 FPS
300 frames in 5.0 seconds = 59.997 FPS
301 frames in 5.0 seconds = 60.001 FPS

glxgears is stuttering just like the games.


Don't forget, you're here forever.

Offline

#7 2021-12-30 21:07:58

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,150

Re: Constant stuttering in all programs and on all screens

Do you get stutter w/ either

__GL_YIELD=NOTHING glxgears
__GL_SYNC_TO_VBLANK=0 glxgears # this one obviously disables vsync

?

Offline

#8 2021-12-31 02:28:51

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

seth wrote:

Do you get stutter w/ either

__GL_YIELD=NOTHING glxgears
__GL_SYNC_TO_VBLANK=0 glxgears # this one obviously disables vsync

?

The stutter disappears with the second one, but it's running at 10,000 FPS.

rai@tantal ~> __GL_SYNC_TO_VBLANK=0 glxgears # this one obviously disables vsync
48388 frames in 5.0 seconds = 9677.489 FPS
53532 frames in 5.0 seconds = 10706.298 FPS
55378 frames in 5.0 seconds = 11075.431 FPS
55478 frames in 5.0 seconds = 11095.580 FPS
50544 frames in 5.0 seconds = 10108.786 FPS
53873 frames in 5.0 seconds = 10774.465 FPS
53320 frames in 5.0 seconds = 10663.855 FPS

I tried disabling vsync in my games already but it didn't make a difference there.


Don't forget, you're here forever.

Offline

#9 2021-12-31 07:20:54

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,150

Re: Constant stuttering in all programs and on all screens

I tried disabling vsync in my games already

How? And does it help to export __GL_SYNC_TO_VBLANK=0 to the games?

Offline

#10 2021-12-31 07:30:29

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

seth wrote:

How did you disable vsync? And does it help to export __GL_SYNC_TO_VBLANK=0 to the games?

There is an in-game option to disable it. Passing that variable to Factorio made no difference - it is still stuttering every second or so.


Don't forget, you're here forever.

Offline

#11 2022-01-01 16:44:14

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,150

Re: Constant stuttering in all programs and on all screens

I'm not sure whether that still does anything, but you could try adding

Option "UseNvKmsCompositionPipeline" "false"

to the screen options, https://forums.developer.nvidia.com/t/v … /57733/111

Otherwise we'll have to go back to square #1

- Switching on Force Composition Pipeline / Force Full Composition Pipeline
    - When these options are off, there is abhorrent screen tearing, but no stutter
    - With these options on, the tearing is fixed, but the stutter is introduced

So maybe let's go w/ the tearing instead of the stutter (the full composition pipeline is expensive) and deal with that.
Notably whether you can isolate or mitigate it w/ exporting "__GL_SYNC_DISPLAY_DEVICE" eg.

__GL_SYNC_DISPLAY_DEVICE=DP-4 glxinfo

to sync to that output.

Offline

#12 2022-01-02 05:20:49

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

seth wrote:

So maybe let's go w/ the tearing instead of the stutter (the full composition pipeline is expensive) and deal with that.
Notably whether you can isolate or mitigate it w/ exporting "__GL_SYNC_DISPLAY_DEVICE" eg.

__GL_SYNC_DISPLAY_DEVICE=DP-4 glxinfo

to sync to that output.

I tried your first suggestion with no effect, so I removed the force composition pipeline settings and passed the environment variable. Unfortunately, it made no difference - there is still large amounts of screen tearing in games and YouTube videos.

Strangely, glxgears does not tear at all, even without Force Composition Pipeline.


Don't forget, you're here forever.

Offline

#13 2022-01-02 08:47:13

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,150

Re: Constant stuttering in all programs and on all screens

Passed the environment where?
The glxinfo situation makes me wonder whether games™ - steam? - just clear the environment.
What if you export it to picom/glx?
What for games  like https://archlinux.org/packages/community/x86_64/warsow/ or https://archlinux.org/packages/communit … etuxracer/ ? (There're more but warsow is already > 400MB and the others aren't smaller)

Edit: oh, and do you maybe still have vsync disabled in-game?

Last edited by seth (2022-01-02 08:47:53)

Offline

#14 2022-01-02 18:20:56

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

seth wrote:

Passed the environment where?
The glxinfo situation makes me wonder whether games™ - steam? - just clear the environment.
What if you export it to picom/glx?
What for games  like https://archlinux.org/packages/community/x86_64/warsow/ or https://archlinux.org/packages/communit … etuxracer/ ? (There're more but warsow is already > 400MB and the others aren't smaller)

Edit: oh, and do you maybe still have vsync disabled in-game?

I tested with Factorio and glxgears like so:

__GL_SYNC_DISPLAY_DEVICE=DP-2 ~/dev/factorio/1/bin/x64/factorio
__GL_SYNC_DISPLAY_DEVICE=DP-2 glxgears

This specific instance of Factorio is one I use for mod development, and is not tied to steam. However, when I'm actually playing the game, I play it through steam. The results are the same in either situation. Breath of the Wild is running in the CEMU emulator via Wine, which does not use Steam.

Exporting it to picom removes the tearing, but re-introduces the stuttering. The stuttering isn't quite as bad as it was with ForceCompositionPipeline, but it's still maddening.

I have tried every step so far with vsync enabled and disabled in Factorio. Until now, enabling vsync has actually made the problem worse, but when exporting SYNC_DISPLAY_DEVICE to picom, vsync makes it somewhat better.

Edit: I downloaded Warsow and enabled vsync in-game, and there was no stuttering or tearing. I moved around and flipped the camera until the game randomly crashed and didn't notice anything. Interesting...

Last edited by raiguard (2022-01-02 18:26:01)


Don't forget, you're here forever.

Offline

#15 2022-01-02 20:43:52

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 73,150

Re: Constant stuttering in all programs and on all screens

__GL_SYNC_TO_VBLANK=1 __GL_SYNC_DISPLAY_DEVICE=DP-2 ~/dev/factorio/1/bin/x64/factorio

Stutter in everything (glxgears) or only "factorio" as well?

One aspect to be aware of is that w/ the compositor (or the composition pipeline) you can end up w/ double-syncs, ie. the client (glxgears, game) waits for the vblank signal, swaps, the compositor picks up the change and waits for the next vblank signal to pass it to the scanout buffer. "Ideally" that gets you one frame lag, but might be prone to interval misses - since the client isn't bound to the actual output intervals but to the input of the compositor, it's output might trail through the compositors interval (10ms before the next time the compositor call glSwap, 7ms before… 4ms before, 1ms before … 2ms too late - you skipped a frame) and the compositor might unredirect some but not all "fullscreen" windows (in particular not those that don't have the proper NETWM state, https://specifications.freedesktop.org/ … 0001767488 ) what ***may*** explain variances in the stutter…esness of clients.

Offline

#16 2022-01-05 03:41:30

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

seth wrote:
__GL_SYNC_TO_VBLANK=1 __GL_SYNC_DISPLAY_DEVICE=DP-2 ~/dev/factorio/1/bin/x64/factorio

Stutter in everything (glxgears) or only "factorio" as well?

Assuming you were talking about this:

Exporting it to picom removes the tearing, but re-introduces the stuttering. The stuttering isn't quite as bad as it was with ForceCompositionPipeline, but it's still maddening.

I was talking about everywhere, not just Factorio.

Running Factorio with the suggested settings doesn't make a difference.

A few new data points:
- Disabling picom and running Minecraft performs flawlessly. Zero stuttering or tearing to be found. I enabled the in-game frame graph and it's a perfect vsync. However, everything else (firefox, OS windows, etc) tear like crazy. I am passing no arguments to Minecraft, just running it normally.
- Breath of the Wild is stuttering all the time with and without picom and composition pipline settings, and is likely unrelated to the stutter we're working on here. I need to tweak CEMU to fix that. Given that it's a Wii U eumulator running on top of Wine, I'm surprised it works at all.


Don't forget, you're here forever.

Offline

#17 2022-01-11 01:13:28

raiguard
Member
Registered: 2021-12-29
Posts: 11

Re: Constant stuttering in all programs and on all screens

I'm going to restart this from scratch, because it got a bit messy in the previous posts. I'm going to ignore the video games and focus purely on glxgears, vsynctester.com, and youtube.

Tests

My dotfiles can be found here. Let me know if there are any other configuration files I should add to the repo.

(I tried a bbcode table but it didn't work)

ffcp = Force Full Composition Pipeline

+------+-------+----------------+-----------------+------------+
| ffcp | picom | glxgears       | vsynctester.com | youtube    |
+------+-------+----------------+-----------------+------------+
| no   | no    | perfect        | tearing         | tearing    |
+------+-------+----------------+-----------------+------------+
| no   | yes   | stuttering     | stuttering      | tearing    |
+------+-------+----------------+-----------------+------------+
| yes  | no    | bad stuttering | perfect         | stuttering |
+------+-------+----------------+-----------------+------------+
| yes  | yes   | bad stuttering | bad stuttering  | stuttering |
+------+-------+----------------+-----------------+------------+

Last edited by raiguard (2022-01-11 01:15:13)


Don't forget, you're here forever.

Offline

Board footer

Powered by FluxBB