Bug 308332 - When compositing is enabled, videos are tearing in mplayer
Summary: When compositing is enabled, videos are tearing in mplayer
Status: RESOLVED DUPLICATE of bug 307965
Alias: None
Product: kwin
Classification: Plasma
Component: scene-opengl (show other bugs)
Version: 4.9.2
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: KWin default assignee
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-13 16:42 UTC by Ralf Jung
Modified: 2012-10-13 20:20 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ralf Jung 2012-10-13 16:42:20 UTC
When watching a video in mplayer or VLC using the GL backend (mplayer -vo gl, corresponding configuration in VLC), KWin compositing introduces tearing:

If I disable compositing, mplayer shows a perfectly tear-free video even in fullscreen. VLC is almost as good, tearing creeps in every once in a while but quickly disappears again.

After enabling compositing, I have permanent tearing in both of them. It's hardly noticeable in the default mplayer window size (which is about a quarter of my screen), but clearly visible when using full-screen (1920x1200 pixels).

Reproducible: Always

Steps to Reproduce:
1. Enable compositing
2. Run "mplayer -vo gl teartest.mp4"
3. Hit "F" (for full-screen mode)
Actual Results:  
Tearing is clearly visible.

Expected Results:  
No tearing should be visible.

* I am using teartest.mp4 from http://ompldr.org/iYXBldg-hide which makes it very easy to see even slight tearing
* I am using Debian testing and a self-compiled KDE 4.9.2
* The graphics card is the HD 3000 from a Core i5-2450M
* Mesa is at version 8.0.1, the Intel Xorg driver at 2.19, the kernel at 3.6
* Tearing is also occasionally visible in games using OpenGL, but that's much harder to see or reproduce
Comment 1 Ralf Jung 2012-10-13 16:53:08 UTC
I forgot to mention:
* "Use VSync" is enabled
* "Suspend Desktop effects for full-screen windows" is disabled
Comment 2 Thomas Lübking 2012-10-13 17:06:48 UTC
most likely bug #307965 ?

does the "upper part" condition hold or does the tearing shift all over thh screen?
Comment 3 Thomas Lübking 2012-10-13 18:35:50 UTC
This patch might avoid tearing IN FULLSCREEN WINDOWS ONLY
The more feedback we can get on it, the more likely it'll get into the next release.

https://git.reviewboard.kde.org/r/106833/
Comment 4 Ralf Jung 2012-10-13 20:03:13 UTC
Indeed the tearing appears only if I leave the VLC/mplayer window in the upper part of the screen - as if the vblank and screen repaint would get slightly, but not entirely out of sync.

I'll apply the patch onto my kde-master installation (after verifying I can reproduce the issue there), but it'll take a time until it's all compiled and up-to-date again.

Do I understand the explanations in the patch correct in that there is no good way to avoid tearing for non-fullscreen repaints?
Comment 5 Thomas Lübking 2012-10-13 20:20:12 UTC
(In reply to comment #4)
> Do I understand the explanations in the patch correct in that there is no
> good way to avoid tearing for non-fullscreen repaints?

- Either glWaitVideoSync is "broken" (for nvidia and now intel) and syncs to the end of the retrace and not the start
- Or that is the intended behavior (making it worthless)
- Or there's actually the technical limitation that the subbuffer copy cannot be performed during the retrace
- Or it's sth. entirely different =)

I had hoped it's broken glWaitVideoSync in the nvidia blob, but, well - seems that's not the case.


Pending idea is to copy the undamaged parts of the frontbuffer into the backbuffer before doing the actual update on the backbuffer, so we can then perform a (fast) swap during the retrace.

*** This bug has been marked as a duplicate of bug 307965 ***