[MPlayer-DOCS] [PATCH] DOCS/tech/tearing.txt

Oded Shimon ods15 at ods15.dyndns.org
Mon Mar 7 15:44:21 CET 2005


Simple document explaining all about what/why/how tearing is...
I re-read again now, it seems to me all correct and good. Anyone spot anything 
incorrect or misleading in it?

- ods15
-------------- next part --------------
______________________________________
What is Tearing and why does it happen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Tearing happens in some vo's, most noticeably vo_fbdev or
anything that uses fb for output (ggi:fbdev, sdl:fbcon...). Tearing also 
happens in vo_x11, in some vo_svga drivers, and possibly in vo_vesa.

Tearing is when half the image is a certain frame, and the other half
is a different frame. The break is horizontal, and most noticeable in 
action and fast motion scenes.

To understand why tearing happens, first we need to understand how the 
monitor and the video card work. Best shown with an example:

Image A is the image being shown. K is black areas. The monitor looks 
like this:


KKKKKKKK              AAAAAAAA              KKKKKKKK              KKKKKKKK
KKKKKKKK   becomes    KKKKKKKK   becomes    AAAAAAAA   becomes    KKKKKKKK
KKKKKKKK     =>       KKKKKKKK     =>       KKKKKKKK     =>       AAAAAAAA
KKKKKKKK              KKKKKKKK              KKKKKKKK              KKKKKKKK 


And so on. This means in fact that the monitor is mostly black, only 
showing a line at a time. Our eye puts together all the single lines 
because they get "burned" into our eye long enough. The amount of 
time this entire process takes depends on the refresh rate. If the 
refresh rate is 60Hz for ex., this will take 1/60 sec. This entire 
process is organized and done by the video card.

What happens with tearing is that halfway through this process, the 
image changes - a very likely event. Because of this, the monitor 
displays the first half the first image, and the next half it shows the 
new image, thinking it's all the same image. The mistake will be 
"corrected" in the very next refresh, as then the entire screen will be 
the new image - too slow. Our eye already caught the mistake. With 
extremely high refresh rates (150hz+), tearing is practically 
unnoticeable.

The way to prevent tearing is by using double buffering and a special 
command to the video card. The command tells it: in one buffer is image 
A, in the other buffer is image B, when you are done displaying image A, 
switch to image B.

Framebuffer is capable of doing this, and it will be implemented in 
MPlayer-G2. Unfortunately most fb drivers do not implement it.


More information about the MPlayer-DOCS mailing list