Closed trinaldi closed 9 years ago
Tearing is an inherent issue of X11. X11 draws instantly and synchronously, so one doesn't have a way to determine when drawing will occur regarding to vertical synchronization. Sometimes upgrading client applications, X server, or drivers introduce delays or eliminates them. And drawing that happened in the middle of screen refresh moves to the pause time. That's how tearing disappears. If for similar reason, drawing moves from pause period to the time of active screen refresh, you start to see tearing.
There is only way to help mitigate tearing possible for X11 apps: draw to back buffer and then present it instantly with something like XCopyArea. One can also actively wait for vsync, but that additional care is not applicable for middleware such as libvdpau-va-gl
. Assume you are running it with Flash movies, and there are 60 of them on the page simultaneously. As they all run in one thread, waiting for vsync will add 1/60 s delay for each of them, combining to 1 second for each frame. That one thread is browser main thread, so browser will become extremely laggy too.
I suggest to use composition managers like compton
instead. Composition manager will be the only who waits for vsync, and that's acceptable. As always, there is no working-for-all solution, and even with compton
you'll have to experiment to find settings which are good for you. Start with
$ compton --backend xrender --vsync opengl
Thanks for your explanation, it makes perfect sense. I've tried tweaking some vsync settings before, none of them was successful, unfortunately. I'll think about compton
, with 0.2.1 I have no problems with tearing so I fear that changing things that are working might ruin them, eventually. So, I'll might try it.
The only reason I opened the 'issue' was the fact that the newer versions are somewhat related to the tearing. I figured i might be some new feature or changes that would cause it.
Thanks again, Rinat.
I have some updates.
I'm using GNOME as my DE, so Mutter is the acting composition manager. Before trying compton
, I've been googling around for Tearing issue and found a workaround - it seems. It is working flawlessly with FF + YouTube's HTML5 Player, I haven't experienced any tearing so far.
The workaround is getting into Looking Glass (GNOME's integrated debugger and inspector tool/interactive JavaScript prompt):
That removed the tearing issues I had with Youtube and Firefox.
You can create a shortcut for Looking Glass:
Settings -> Keyboard -> Shortcuts
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Main.lookingGlass.toggle();'
I believe you can create a direct shortcut with the command:
gdbus call --session --dest org.gnome.Shell --object-path /org/gnome/Shell --method org.gnome.Shell.Eval 'Meta.disable_unredirect_for_screen(global.screen);'
As I said, it seems to be working. To be fair, I don't think this is related to libvdpau-va-gl
at all, I just thought I should give you a heads up for helping me understand the way X11 work its way around drawing the screen :)
It might help people having tearing issues with Flash (I'm using freshplayerplugin and the same issue is gone).
Thanks for the updates. That looks interesting.
Hi, Rinat.
I've been scratching my head on this one: Any version above 0.2.1 creates video tearing on both mplayer and Flash. I don't know which commit/change makes this happen.
I don't know what kind of info you need, I'm gonna post what I think it's relevant: Ubuntu 15.04;
vdpauinfo
header:vainfo
header:mesa-vdpau-drivers 10.5.2-0ubuntu1
vdpau-va-driver 0.7.4-3
libvdpau1 0.9-1
If you need some other info, please tell me!
Thanks for your work.