Ubuntu – Have tearing (no Vsync) in movies (Nvidia proprietary driver)


This is more of KDE than Ubuntu question, but…
I have visible tearing on screen. KDE composition, flash video in Firefox, and simple games like kpat are vsynced, but in steam games and in movies there is a distinct constant tearing. If I turn off vsync everywhere, the tearing is double as noticeable, so it is not just GPU ignoring the settings.
What bugs me most it that I'm having the same problem on many different setups. Does everybody have this problem and nobody cares?
My setup

  • Kubuntu (last few versions) or OpenSuse or Gentoo.
  • KDE 4.12 – 4.13
  • Nvidia GTX 260, 570, TITAN, different driver versions.
  • I watch movies in SMplayer with mplayer2 backend. VLC has the same problem.

What did I try (and it didn't help)

  • Switching on and off in different configurations the Vsync settings in nvidia-settings and KDE Desktop effects.
  • Switching Mplayer output and direct rendering settings.
  • Turning off Adaptive power mode in nvidia-settings.
  • Turning off compositing
  • Changing monitor Hz
  • Running mplayer from CLI
  • Performing rituals and sacrifices

What did work (but is not and acceptable solution)

  • Disabling KDE, and running Mplayer in pure X session
  • Switching to nouveau AND turning off composition AND opening video in fullscreen – without any part it is still tearing.

Please advice.

UPDATE 1 I found out that if I go to Desktop Effects — Advanced and change there anything valuable (OpenGL version, scaling algorythm) and push Apply, the tearing is gone until reboot. However, no setting solves this once and for all. After reboot I have to go and change something again.I guess it is enough to blame this on a bug, not my mistakes, so I will file out bug report.

Best Answer

Simple guide to solve this annoying problem :)

  1. Create file:

  2. Insert this code:

    export __GL_YIELD="USLEEP"
  3. Then make it executable with:

    chmod +x /etc/profile.d/Tearing.sh
  4. Once that's done, reboot or press ctrl + alt + F2, login and run sudo service lightdm restart Or restart what ever your display manager is.

The GL_YIELD worked for me, and now vertical sync appears to be working as it should.


Related Question