LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 03-03-2017, 10:47 AM   #1
Psy-Q
Member
 
Registered: Jun 2015
Distribution: Debian
Posts: 37

Rep: Reputation: 4
Stuttering in Linux that's not present in Win 10 -- what more could I try?


I've been working on this for a couple of weeks now. In video players and in games, I will always get stutter on Debian. It's not noticeable during desktop use.

I even despaired enough to try to install Win 10 on the same hardware to see if it's my graphics card, but lo and behold, everything is smooth as butter on Win 10. Some people say this is because Nvidia offloads a lot more of the syncing stuff to the compositor on Windows, but I'm not convinced.

Symptoms:
There is stuttering in videos, full-screen or not, as well as in games, full-screen or not. Also during scrolling webpages. I always test with this video:

https://www.youtube.com/watch?v=cuXsupMuik4

It's made for detecting tearing, but once you have solved tearing via ForceCompositionPipeline or with a compositor, the same video is also good at revealing stutter. The bars jump a few frames (sometimes even backwards!) every few seconds.

Extremely high-framerate games like Half-Life 2 or Left 4 Dead 2 don't show much stutter, but when you hover around the 70 - 80 fps mark there is pronounced stutter, e.g. in Divinity or Victor Vran.


Equipment:
  • Intel Core i5-3570K, 3.4 GHz
  • 16 GB RAM
  • MSI GTX 1060 6G Gaming
  • (Same problem with MSI GTX 960)
  • Debian stretch, Kernel 4.9
  • Nvidia driver 375.39

What I've tried:
  1. Disabling "sync to vblank" in Nvidia OpenGL preferences
  2. Disabling "sync to vblank" in XFCE compositor preferences
  3. Using Compton with --vsync opengl-swc
  4. Making sure that the screen is driven at 60 Hz and not something like 59.995 Hz
  5. xorg.conf: ForceCompositionPipeline on or off
  6. xorg.conf: ForceFullCompositionPipeline on or off
  7. xorg.conf: TripleBuffer on or off
  8. Trying a laptop with Intel graphics to see if it has the same problem. It does.
  9. Booting said Intel graphics laptop into Fedora 25 so that I get Wayland instead of Xorg. Same problem. Said laptop in Windows 10 has no stutter.
  10. New: Using a realtime kernel (4.9.0-rt) as suggested by wpeckham
  11. New: Optimizing the system more as suggested by wpeckham. I disabled unnecessary services (GNOME services, Avahi, libvirtd services, gvfs)
  12. New: Installing Ubuntu 16.10 on a separate drive. It uses Nvidia driver 367.57 and everything is buttery smooth there. No tearing, no stutter. I have to figure out what Ubuntu does different than Debian.
  13. New: Installing XFCE on Ubuntu 16.10. There is stutter now. So Unity and XFCE differ in important ways. Tried with and without compositor.
  14. New 2017-03-05: Trying Ubuntu 16.10 on Intel revealed that there is stutter, too. So only Nvidia + Unity + Ubuntu 16.10 is a smooth combination.

Improvements so far:
  • YouTube videos don't stutter much in Chrome now (but still do in Firefox). I'd prefer Firefox, but since I watch YouTube through mpv it doesn't matter.
  • mpv at least in fullscreen is almost stutter-free
  • Games are nearly stutter-free (tested with Transistor and Hand of Fate, I'm happy for suggestions of other games to try)

Not quite as smooth as with Unity and Ubuntu 16.10, but almost. Meanwhile on the Windows 10 side, the video is even smooth when played inside a browser. And I don't mean Edge (I think Edge has some tight-knit integration with Microsoft's codecs on Windows), just Firefox will do fine.


How to achieve these improvements

This is for XFCE 4.12:
  • Delete or move /etc/X11/xorg.conf. Even the one written by Nvidia's own nvidia-settings caused problems.

In XFCE:
  • Enable Settings -> Windows Manager Tweaks -> Compositor -> Enable display compositing
  • Disable Settings -> Windows Manager Tweaks -> Compositor -> Synchronize drawing to the vertical blank

In nvidia-settings:
  • X Server Display Configuration -> Click Advanced: Enable "Force Composition Pipeline"
  • X Screen 0 -> OpenGL Settings: Enable "Sync to Vblank" and "Allow Flipping"

If you want to more easily enable Force Composition Pipeline, try this:

Code:
nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceCompositionPipeline = On }"
Since we're not saving to xorg.conf, we can't save this as the default. It seems Xorg forgets this setting every time it starts.

Last edited by Psy-Q; 03-06-2017 at 12:28 AM. Reason: New info about stutter on XFCE on Ubuntu
 
Old 03-03-2017, 03:08 PM   #2
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,613

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Some thoughts:
1. the driver and compositor may not be communicating efficiently. If that is the case, software updates may resolve it in time but I have no useful ideas for attacking it sooner at this time. I hope someone else does.

2. There may be an interrupt return delay in one or more of the event driver driver interfaces. This is rare, but can cause several kinds of stuttering. This can be addressed by installing the newest RT kernel available. (RT is a kernel using the Real Time patch set. This results in a kernel that is slightly slower, but under which event returns are far more reliable.) If the stuttering is kernel based, this may totally resolve the issue.

3. Your system may not be efficiently configured for optimal use with those game applications. Look at your CPU, queue, and memory statistics both before and during the stutter events. (use free, top, and uptime for initial numbers, vmstat and iostat may help more once you know where to look)

It would be useful to know more about your swap space, memory allocation, file systems format, and i/o buffers.
Are you using the opensource drivers, or the wrapped Microsoft drivers for those cards? From your description it LOOKS like the MS driver wrapped, but I am guessing.

Does the sound stutter when the video stutters, or are the two not in sync?

You have done an excellent job of describing what you have tried and your hardware, and that is refreshing. Thank you!

Last edited by wpeckham; 03-03-2017 at 03:09 PM.
 
Old 03-03-2017, 03:47 PM   #3
Psy-Q
Member
 
Registered: Jun 2015
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 4
Thanks for the suggestions and thoughts

I meanwhile tested some more and found out that some games work better than others, and that video is the worst part.

Quote:
Originally Posted by wpeckham View Post
Some thoughts:
1. the driver and compositor may not be communicating efficiently. If that is the case, software updates may resolve it in time but I have no useful ideas for attacking it sooner at this time. I hope someone else does.
I'll be tracking both Compton and the XFCE compositor closely in that case.

Quote:
Originally Posted by wpeckham View Post
2. There may be an interrupt return delay in one or more of the event driver driver interfaces.
Hmm! I will try an RT kernel over the weekend, this is a good suggestion.

Quote:
Originally Posted by wpeckham View Post
3. Your system may not be efficiently configured for optimal use with those game applications. Look at your CPU, queue, and memory statistics both before and during the stutter events. (use free, top, and uptime for initial numbers, vmstat and iostat may help more once you know where to look)
I found a game that runs almost without stutter, Hand of Fate. It seems to be hardly taxing for the hardware, though. I'll have to try again with rather heavy stuff like Shadow of Mordor.


Quote:
Originally Posted by wpeckham View Post
It would be useful to know more about your swap space, memory allocation, file systems format, and i/o buffers.
Are you using the opensource drivers, or the wrapped Microsoft drivers for those cards? From your description it LOOKS like the MS driver wrapped, but I am guessing.
There's 16 GB of RAM and no swap at all (the system is on an SSD, so I wanted to prevent too many writes). I can try to add a swap file (as opposed to a partition) but I'm not seeing it run out of RAM. With Mad Max running I still have 8 GB free, though I might try an even bigger game.

The drivers are just the "normal" Nvidia drivers, installed through Debian from the non-free repository. I did just get an update to 375.39 tonight (will update the main post to reflect this), but it makes no difference for video playing. Games might be a tiny bit smoother, perhaps, hard to tell.

Quote:
Originally Posted by wpeckham View Post
Does the sound stutter when the video stutters, or are the two not in sync?
No, the sound never stutters. It's just that sometimes I get the feeling of the sytem lurching a bit and then catching up with itself, as if some frames were running too fast and then the next few ones come in too slowly. The way the video looks is like that too: sometimes the bars run backwards for a bunch of frames, which makes me guess that it's something to do with buffering (images from later in the buffer are shown earlier?)

I never had to fiddle with the buffer settings on Windows, but I know the default pre-rendered frames for Nvidia is 3 in the Windows driver. I had to set that to 1 once when I played some virtual pinball games on Windows, so the flippers wouldn't be delayed by a few frames. I know I'm sounding picky, but that's what it's like in pinball I couldn't find a maximum pre-rendered frames setting for the Linux driver, though.


Quote:
Originally Posted by wpeckham View Post
You have done an excellent job of describing what you have tried and your hardware, and that is refreshing. Thank you!
Oh, thanks a lot I may have missed some of the things I've tried, but I've tried to make sense of this for quite some time and went down a lot of blind alleys, so I guess I just collected a lot of things that way. I'll collect more and I'll try to also figure this out on Intel cards in case it benefits someone. Also, I ought to hunt down a 60 fps video camera somewhere so I can film what I mean, makes it easier to describe.
 
Old 03-04-2017, 03:56 AM   #4
Psy-Q
Member
 
Registered: Jun 2015
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 4
I tried Ubuntu 16.10 on a separate drive and for some reason everything works just fine out of the box there. Very little stuttering, no tearing. It's also the only time I've seen Firefox on Linux not stutter with my test video. Chrome plays it silky smooth like on Windows 10. There certainly isn't the feeling of "lurching back and forth" that I got on Debian.

I want to figure out what's different between Debian and Ubuntu. Ubuntu doesn't even seem to have anything specific set in xorg.conf and yet it all just works -- this is pretty impressive. I have yet to try a 3D game to see how that fares.

Last edited by Psy-Q; 03-04-2017 at 03:57 AM.
 
Old 03-04-2017, 06:58 AM   #5
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,613

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Quote:
No, the sound never stutters. It's just that sometimes I get the feeling of the sytem lurching a bit and then catching up with itself, as if some frames were running too fast and then the next few ones come in too slowly. The way the video looks is like that too: sometimes the bars run backwards for a bunch of frames, which makes me guess that it's something to do with buffering (images from later in the buffer are shown earlier?)
This tells me that it is less likely that it is an general event interrupt. This looks like something restricted to the video system and drivers. I prefer the non-proprietary drivers best, but the proprietary Windows drivers may be superior for the requirements of those specific games.

The RT kernel may still offer improvement, but there may be a specific driver fix (to the proprietary driver) that would be superior. It may be specific to the desktop (XWindows and Window Manager) software. I find it interesting that Ubuntu 16 did better. Researching the Drivers, Xwindows, and Desktop versions and setting for comparison might be educational. The Ubuntu people do fold in proprietary bits that they have licensed, but I am not sure that is the important factor here.

It is good to know that you have a fix that will support those games on your hardware: run Ubuntu or something derived from it that supports your iron the same way.
 
Old 03-04-2017, 02:25 PM   #6
Psy-Q
Member
 
Registered: Jun 2015
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by wpeckham View Post
It is good to know that you have a fix that will support those games on your hardware: run Ubuntu or something derived from it that supports your iron the same way.
I'm just not quite happy that I can't figure out why it works this well on Ubuntu. But I guess there are too many moving parts to figure this out: Ubuntu uses a different kernel, different Nvidia driver version, different desktop environment, different xorg.conf.

I'll be trying XFCE on Ubuntu next, to see if Unity makes the difference. Edit: Tried it. In XFCE there is a little tearing as well as pronounced stutter, just as bad as on Debian. It seems there is something in Unity that Canonical does right that everyone else gets wrong. ForceCompositionPipeline did not help much, neither did ForceFullCompositionPipeline.

I'm very content with Debian and wouldn't want to switch unless absolutely necessary, but on the other hand the stutter drives me mad and it's buttery and fantastic on Ubuntu with Unity. I don't really consider it "solved" because it involves completely changing distros, but if anyone else gets frustrated, maybe they find this thread and give Unity a try. For me I think the benefits might outweigh the drawbacks in time.

Last edited by Psy-Q; 03-04-2017 at 03:03 PM.
 
Old 03-04-2017, 04:11 PM   #7
Ratamahatta
Member
 
Registered: Feb 2012
Location: Germany
Distribution: siduction
Posts: 134

Rep: Reputation: 17
Talking about time: Have you tried a more cutting edge distribution of Debian like testing or unstable? - Newer Drivers and other software; similar to what Ubuntu may offer but still real Debian.
I've had more Quirks with Ubuntu 12, 14 and 16 than with Aptosid or Siduction. During the same timespan. (Ubuntu just don't manage to properly test the development tools or server versions of their distribution)
 
Old 03-05-2017, 01:38 AM   #8
Psy-Q
Member
 
Registered: Jun 2015
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by Ratamahatta View Post
Talking about time: Have you tried a more cutting edge distribution of Debian like testing or unstable? - Newer Drivers and other software; similar to what Ubuntu may offer but still real Debian.
Yes, I am running Debian stretch (what's currently testing and will become Debian 9). The kernel is even newer than what Ubuntu 16.10 has (4.8 vs. Debian's 4.9), but the Nvidia driver seems older (367.57 vs. Debian's 375.39). It probably isn't the graphics driver because Intel graphics have the same problem.

I was sort of relieved that XFCE on Ubuntu 16.10 also has the stuttering problems. It's just Unity where it works fine. So perhaps those who say that Windows is only smooth because it has a better compositor and relies less on Nvidia to do things are right -- if Unity's compositor is better than XFCE's and Compton, this could be proof.

Quote:
Originally Posted by Ratamahatta
I've had more Quirks with Ubuntu 12, 14 and 16 than with Aptosid or Siduction. During the same timespan. (Ubuntu just don't manage to properly test the development tools or server versions of their distribution)
Hrm. Thanks for the heads-up. I'll have to ponder this for a long while, then. I haven't had any major issues with Debian other than this one in the last ~10 years, so figuring it out would be much better than giving up and changing distro for me. But at least I know it's not my hardware and it's probably not Linux (as in the kernel) itself, at least not kernel 4.8.
 
Old 03-05-2017, 08:49 PM   #9
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,613

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
You may want to check into DEBIAN TESTING (or even Debian Unstable/SID) based spinoffs like VSIDO and SPARKY. I believe SPARKY even has a game specific version. Avoid the ones with XFCE based DE, as you have somewhat confirmed that XFCE has the problem.

I love Debian, but there are a lot of Debian people who love doing different parts or combinations a bit differently. Some of them are flat BRILLIANT, and you may find exactly what you need among them.
 
Old 03-06-2017, 12:18 AM   #10
Psy-Q
Member
 
Registered: Jun 2015
Distribution: Debian
Posts: 37

Original Poster
Rep: Reputation: 4
Quote:
Originally Posted by wpeckham View Post
You may want to check into DEBIAN TESTING (or even Debian Unstable/SID) based spinoffs like VSIDO and SPARKY. I believe SPARKY even has a game specific version. Avoid the ones with XFCE based DE, as you have somewhat confirmed that XFCE has the problem.
That is the confusion: The problem is in GNOME 3.22, XFCE 4.12, Plasma 5.8. It might also be in LxQt, LXDE, Openbox and i3, I just haven't tested any of those (yet) Sparky's GameOver edition seems to prefer LXDE, so I'll give that a try next.

I've managed to get it almost good enough in XFCE 4.12 on Debian testing now, but it's still not as good as with Unity. It's better than with GNOME and Plasma, though. In games especially it's fine now, video players not quite as nice. Gonna update the main post in a second.


Quote:
Originally Posted by wpeckham View Post
I love Debian, but there are a lot of Debian people who love doing different parts or combinations a bit differently. Some of them are flat BRILLIANT, and you may find exactly what you need among them.
I'll definitely take a look there, thanks. I'm always wary trying smaller spinoffs because sometimes they simply disappear, lag behind or introduce problems that their mother distro wouldn't have had. It's not an easy feat to keep tracking some original distro in your own fork and I think some of these teams underestimate the effort required. Even Mint takes some time to absorb the flow of things happening in Debian for their LMDE.

But I'll see what exactly makes Sparky different since that seems very up to date.

If Valve keeps up their effort with SteamOS, maybe in a few years this is a non-issue :P
 
Old 04-10-2017, 03:27 PM   #11
Sarithis
LQ Newbie
 
Registered: Apr 2017
Posts: 1

Rep: Reputation: Disabled
I have the EXACT same problem. My platform:
ArchLinux 4.10.8-1-ARCH
Intel 4770k 4.0 GHz
Nvidia GTX 770
16 GB 1600 MHz
wine-staging 2.1 and wine-staging 2.4 (I tried both)
nvidia 378.13 drivers and nvidia 352.79 (I tried both)
compton (compositor) and i3-window manager

I can see stuttering in the video you linked in the original post. It also happens in games which support Linux natively (Steam - Rust).
Without the following:
Code:
- xorg.conf:
      ...
      Option "TripleBuffer" "True"
      Option "Coolbits" "13"
      Option "RegistryDwords" "PowerMizerEnable=0x1; PerfLevelSrc=0x2222; PowerMizerDefaultAC=0x1"
      Option "RegistryDwords" "OGL_MaxFramesAllowed=0x4; EnableBrightnessControl=1"
      ...
      Option "metamodes" "nvidia-auto-select +0+0 {ForceCompositionPipeline=On, ForceFullCompositionPipeline=On}"
      ...
- Nvidia-settings: Sync to VBlank, Allow Flipping, Use Conformant Texture Clamping
all youtube videos and games would be tearing (not stuttering).

Last edited by Sarithis; 04-10-2017 at 03:30 PM.
 
Old 04-11-2017, 01:55 AM   #12
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Sarithis, please start a new thread for your problem.
 
Old 03-17-2020, 04:06 PM   #13
dloghis
LQ Newbie
 
Registered: Sep 2012
Posts: 3

Rep: Reputation: Disabled
Fix it

Hello,
I have Linux Mint 18.1 Serena
RAM 16G , Intel i7 and using onboard HDMI in a Gigabyte motherboard
My Firefox was stuttering and thought that this is unacceptable with 16G RAM!!
After i tried buffering etc in Firefox i have Enter the BIOS and change the RAM for Video
From 64MB and MAX 256MB changed to 256MB and MAX=MAX and the problem disappeared !

I hope it helps
 
Old 03-18-2020, 01:47 AM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Sarithis dloghis, please start a new thread for your problem.
 
Old 03-18-2020, 07:15 AM   #15
wpeckham
LQ Guru
 
Registered: Apr 2010
Location: Continental USA
Distribution: Debian, Ubuntu, RedHat, DSL, Puppy, CentOS, Knoppix, Mint-DE, Sparky, VSIDO, tinycore, Q4OS,Manjaro
Posts: 5,613

Rep: Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695Reputation: 2695
Quote:
Originally Posted by ondoho View Post
Sarithis dloghis, please start a new thread for your problem.
Just to note, dloghis did not offer a new problem, but a possible solution. That does fit this thread.
 
  


Reply

Tags
intel, nvidia, opengl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Sound Blaster X-Fi stuttering on Linux Mint KDE 14 Agetian Linux - Hardware 0 05-07-2013 01:44 PM
ndiswrapper shows 'driver present, hardware present' but no wlan0 0x12d3 Linux - Wireless Networking 2 05-11-2007 07:43 PM
...'stuttering' in Linux, Shuttle XPC setup, HDD related? Bencrest Linux - Hardware 1 03-12-2006 12:39 AM
RedHat 9/Win XP: Problem in sharing XP network drive (Called name not present) holeinone72 Linux - Networking 2 06-19-2005 01:28 PM
ndiswrapper - driver present:harware present but no connection esteeven Linux - Wireless Networking 2 12-26-2004 04:06 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 08:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration