[MPlayer-dev-eng] N fps and N Hz screen refresh rate (the vblank problem)

Pallai Roland pallair at magex.hu
Tue Dec 30 19:23:41 CET 2008


Hi,


Preface: it's not about tearing, my sync-to-vblank on XV is OK. :)

A long-time headache for me that movies played from my HTPC (on LCD
TV) suffers some jittery. Now I've got some time for this problem,
thanks for the boring Xmas.
I came to realize that my problem is the refresh rate, that was 60Hz
by default. It's good only for porn. :) I believed that the problem is
solved when I set the refresh rate identical to video framerate, but
in every 1-2 minutes the video jittered very badly for 10-15 seconds.
The result of this experiment is this mail.

The first step to play videos without jittering is to set identical
(or multiple) refresh rate to the movie's fps. The multiple refresh
rate is bad for the "pixel plus", "motion flow" engines (every
manufacturer calls it different) of modern TVs. My Samsung M87 LCD TV
accepts refresh rate 24/25/50/60hz on HDMI, optimal to drive it at
24/25hz when I watch movies, as a Blueray player box does.

The problem if the refresh rate identical to video framerate and the
(m)player ignores the vblank intervals and puts the frames on the
brink of vblanks, then the result is a badly jittering video for some
seconds, until the timing of video frames drifts away. It depends on
luck, that a frame will be overwritten within a vblank or the player
misses a vblank to put a video frame. Let me draw it, my english is
sucks to express myself in text:  :)

first line: vblanks
second line: update_video
|1111111111|22222222222|3333333333|4444444444|5555555555|6666666666|
| ^        |^          |^        ^|         ^|          |^
                         jitter!                jitter!

my mplayer patch does the following things:
1., reads the vblank informations from a regular file in
adjust_sync_and_print_status(). file written by my drmsync.c that
sucks the vblank timing from kernel's DRM.
2., notifies the user on OSD if a vblank has double update or a vblank missed.
3., tries to keep update_video in the first half of vblanks (the cpu
latency -late frames- tolerated better in this way)

My patch avoids from brink of vblanks when fps and hz identical, so no
jitter in the situation above:

first line: vblanks
second line: update_video
|1111111111|22222222222|3333333333|4444444444|5555555555|6666666666|
| ^        |^          |   ^      |  ^       |   ^      | ^
          speed up video!
           (a little bit)

The skip of a vblank is unavoidable sometimes (we've to keep audio in
sync, unfortunately), but it's a little impact and rare.


This patch is just a demonstration. It worksforme, my problem has
gone, but it's an ugly hack. Is there another solution for this
problem? Is a workaround? Is a plan to fix this issue in the mainline?


ps.: Xine does ugly jittering in the whole movie when I tried play N
fps at N hz. Maybe there's serious video frame timing issue.
ps.: MythTV cares about vblank,
http://www.cuymedia.net/mythtv-trunk/vsync_8cpp-source.html


--
dap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: drmsync.c
Type: text/x-csrc
Size: 2891 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081230/167c69db/attachment.c>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mplayer-2008-08-18-vblank-dap1.diff
Type: text/x-patch
Size: 6954 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/mplayer-dev-eng/attachments/20081230/167c69db/attachment.bin>


More information about the MPlayer-dev-eng mailing list