chjj / compton

A compositor for X11.
Other
2.25k stars 501 forks source link

GLX Vsync/Stutter/Lag - Bug with Nvidia's 'Allow Flipping' Setting #304

Open PhilipWitte opened 9 years ago

PhilipWitte commented 9 years ago

I just started using Compton on my Xfce system (Manjaro Linux, Kernel 4.1, Nvidia 352.41, GTX 960) and was struggling to get consistently smooth, tear-free desktop. I've spent hours playing with Compton settings because the settings didn't seem to work the same after restarting my system (where Compton was started via Xfce Startup/Session manager) compared to starting Compton from the terminal manually.

First, my system works best with --backend glx --vsync opengl (opengl-swc has noticeable more 'lag' when dragging around windows). However, using --vsync opengl would cause windows above any OpenGL window (such as Chrome, Krita, Blender, etc) to stutter horribly.. but only sometimes (opengl-swc doesn't have this problem, but again, it has more lag in general). The odd thing wass, after adjusting Compton & Nvidia settings for awhile I would eventually hit this "sweet spot" where --vsync opengl would not cause any stuttering at all (regardless of any open OpenGL windows) and everything on the system works butter smooth everywhere. When it's working right, Compton runs absolutely great (no lag, no stutter, no tearing).

After scratching my head over this and trying about every combination Compton/Nvidia settings allow, I finally figured out what was causing the inconsistent behaviour.. It seems that Nvidia's "Allow Flipping" messes things up when I first boot into the system.

I can consistently hit the "sweet spot" (where everything runs butter smooth without any lag, stutter, or tearing, even for windows above other OpenGL windows) by disabling Allow Flipping --> re-enabling it --> then starting Compton (via terminal). I only need to do this process once after I reboot my system and never have to disable/enable Allow Flipping or restart Compton after that (even after resuming from suspend/lock).

So I'm not sure this a Compton bug, an Nvidia Settings bug, or an Xorg Settings bug. But either way I thought I'd report here in case this issue has been bugging others as well. Also, if anyone knows a fix for this or has any info about possible Nvidia/X11 settings I should look for I would really appreciate it. Until then, I'm looking for ways to disable/enable Nvidia's Allow Flipping via CLI to add the Xfce Session command before starting Compton so I don't have to do this manually every time I reboot.

PhilipWitte commented 9 years ago

Update:

Actually it looks like there is tearing with --vsync openg and the Allow Flipping workaround.. but only at the top ~20px of my screen.. so I'm not sure if I simply didn't notice it before or if it's related to the new Nvidia 255 drivers. Something also to note is that Chrome videos in full-screen are tearing now.. and I'm sure I tested those before and they where not tearing.. so I'm not sure that's related to a Chrome update or Nvidia one.

tdryer commented 9 years ago

Have you tried omitting the --vsync option entirely? With the glx backend and vsync enabled in the Nvidia driver, I don't need it at all.

If you're having tearing issues with Chrome, check that hardware acceleration is working in chrome://gpu. I was getting awful tearing after upgrading to the latest version of Chrome until I realized that it was now blacklisting my GPU for some reason and disabled the blacklist.

nocnokneo commented 8 years ago

I'm experiencing the same issue on Ubuntu 15.10 using GNOME and nvidia-352-352.63-0ubuntu1. Landed here when searching around for a solution. Thought you may be interested as this is another data point that points at either NVIDIA or Xorg as the source of the bug. I had the same issue with Ubuntu 15.04.

nocnokneo commented 8 years ago

@PhilipWitte Does the TripleBuffer solution as described here work for you? http://www.iwillfolo.com/finally-nvidia-tearing-issue-fix-found/

PhilipWitte commented 8 years ago

@nocnokneo I no longer use Compton. I've found that KDE's KWin doesn't have tearing when Triple Buffering is properly enabled in the Xorg settings, and it has less input lag then Compton & Compiz in my experience. Though it uses a lot more video memory, which is probably how it gets tear-free on X11..

Full featured Wayland compositors and drivers can't come soon enough.

Brottweiler commented 6 years ago

Trying to work out how to use compton to remove tearing but keep desktop responsive. Disableing allow flipping seems to make stuff tear again, but it does not make everything smooth as you said originally. When playing a video (or game probably) moving windows, and animations in general, are really laggy and stuttery and delayed...