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.


Solution 1:

Simple guide to solve this annoying problem :)

  1. Create file:

    /etc/profile.d/Tearing.sh
    
  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.

(https://www.kubuntuforums.net/showthread.php?63946-No-vertical-sync-with-NVIDIA&highlight=tearing)

Solution 2:

The source of problem was (of course) faulty nvidia drivers. The solution is simple. Add environmental variables:

export __GL_YIELD="USLEEP"
export __GL_THREADED_OPTIMIZATIONS=1

somewhere before X starts. System-wide /etc/profile/ works fine.

Solution 3:

I have tried all the tricks and nothing solved on Ubuntu 15.04 (along with xorg-edgers and nvidia-355) , until I came on nvidia archlinux page.

Test with:

nvidia-settings --assign CurrentMetaMode="nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"

In order to make the change permanent, you need to add the following line to the "Screen" section of your Xorg configuration file, for example in /etc/X11/xorg.conf.d/20-nvidia.conf

Option  "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"

Solution 4:

I had it nailed...

So - first of all be sure to check if the problem persists after you switch the Desktop Effects off (Alt+Shift+F10). I can guarantee that the problem might already be gone.

Go to System Settings and open Desktop Effects:

  • Scaling Method to something else than set currently <-- actual fix

I know the options might not be named exactly as above. Sorry about that, but I am using the Polish version of Kubuntu.

The steps above fixed the problem for me. But only after a fresh install. :)

EDIT: In the current 14.04 Kubuntu version the problem is connected with the Scaling Method. Changing it to anything else than currently selected, helps to resolve the problem TEMPORARILY.