Ubuntu – How to stop video tearing? (Nvidia prop driver, non-compositing window manager)

macbooknvidiatearing

I have that problem which seemingly afflicts many using the proprietary Nvidia driver:

Video tearing: fine horizontal lines (usually near the top of my display) when there is a lot of panning or action in the video.

(Note: switching back to the default nouveau driver is not an option, as its seemingly nonexistent power-management drains my battery several times faster)

I've tried Totem, Parole, and VLC, and tearing occurs with all of them. The best result has been to use X11 output in VLC, but there is still tearing with relatively moderate action.

Hardware: MacBook Air 3,2 — which has an Nvidia GeForce 320M.

There are two common fixes for tearing with Nvidia prop drivers:

  1. Turn off compositing, since Nvidia proprietary drivers don't usually play nice with compositing window managers on Linux (Compiz is an exception I'm aware of). But I use an extremely lightweight window manager (Awesome window manager) which is not even capable of compositing (or any cool effects). I also have this problem in Xfce, where I have compositing disabled.

  2. Enabling sync to VBlank. To enable this, I set the option in nvidia-settings and then autostart it as nvidia-settings -l with my other autostart programs. This seems to work, because when I run glxgears, I get:

    $ glxgears
     Running synchronized to the vertical refresh.  The framerate should be
    approximately the same as the monitor refresh rate.
    303 frames in 5.0 seconds = 60.500 FPS
    300 frames in 5.0 seconds = 59.992 FPS
    

    And when I check the refresh rate using nvidia-settings:

    $ nvidia-settings -q RefreshRate
    Attribute 'RefreshRate' (wampum:0.0; display device: DFP-2): 60.00 Hz.
    

    All this suggests sync to VBlank is enabled. As I understand it, this is precisely designed to stop tearing, and a lot of people's problem is even getting something like glxgears to output the correct info. I don't understand why it's not working for me.

xorg.conf: http://paste.ubuntu.com/992056/

Example of observed tearing:: video tearing

Best Answer

One thing to try that may work. Open nvidia-settings and go to the powermizer section. Choose "Maximum Performance" in the drop-down, and you should see your powermizer level jump to the fastest speed.

Once you've done that, try the video.

In the past, I've found that vsync doesn't work when the nvidia card is on the slowest powermizer setting.

Related Question