On Sat, Nov 30, 2002 at 02:53:57AM +0200, Ville Syrj�l� wrote: > > flip_page()
OK, I have mplayer patched as such now:
Index: libvo/vo_dfbmga.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_dfbmga.c,v
retrieving revision 1.6
diff -u -r1.6 vo_dfbmga.c
--- libvo/vo_dfbmga.c 16 Nov 2002 03:02:23 -0000 1.6
+++ libvo/vo_dfbmga.c 4 Dec 2002 01:43:56 -0000
@@ -673,6 +673,12 @@
frame->Flip( frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : 0);
} else {
/* Flip CRTC2 */
+ if (vo_vsync) {
+ int field;
+ crtc2->GetCurrentOutputField( crtc2, &field );
+ if (field)
+ crtc2->WaitForSync( crtc2 );
+ }
c2frame->Flip( c2frame, NULL, vo_vsync ? DSFLIP_WAITFORSYNC : 0 );
if (!use_spic)
osd_current ^= 3;
I think this makes it worse. Motion is more juddery and I think I am
seeing at least to "flip-backs" (where during a scene change I think I
am seeing the previous scene and the current scene "toggle" twice --
current, next, current, next like).
> To guarantee that we display both fields and always in the same order.
Hmmm. Just so that I understand, the way MPlayer is working is that
it is building a full frame (both fields) and giving that to the
framebuffer. The hardware then displays one field from the frame
MPlayer stuffed in the framebuffer, then sends a vsync interrupt, then
displays the other field out of the same frame, then another vsync
interrupt happens. Am I right so far?
What is interesting, is I have a debug statement in the VSYNC ioctl in
matrox_base.c right before the process is put to sleep waiting for the
interrupt. I played an MPEG2 file and counted the debug I got:
Dec 3 20:25:09 pvr kernel: going to sleep, waitng for crtc2 VSYNC
Dec 3 20:25:40 pvr last message repeated 1507 times
Dec 3 20:26:41 pvr last message repeated 2983 times
Dec 3 20:27:42 pvr last message repeated 2997 times
Dec 3 20:28:43 pvr last message repeated 2956 times
Dec 3 20:29:44 pvr last message repeated 2985 times
Dec 3 20:30:45 pvr last message repeated 3009 times
Dec 3 20:31:46 pvr last message repeated 3009 times
Dec 3 20:32:47 pvr last message repeated 3057 times
Dec 3 20:33:48 pvr last message repeated 3027 times
Dec 3 20:34:49 pvr last message repeated 3030 times
Dec 3 20:35:50 pvr last message repeated 3082 times
Dec 3 20:36:51 pvr last message repeated 3080 times
Dec 3 20:37:52 pvr last message repeated 3005 times
That's a total of 37728 interrupts in (37:52 - 25:09) * 60 = 763
seconds. 37728 / 763 = 49.44 interrupts per/s.
These numbers assume that the logging is accurate and no messages got
dropped, but this is klog/syslog on the local host and it is not
printing a message to the log per debug message but rather a total of
messages every minute or so. I am not sure how reliably it can be
depended on.
> Otherwise we might display only one field for some frames and in a random
> order. I'm not sure why this is a problem though. One would think that
> with progressive data it shouldn't really matter how the fields are
> displayed.
As in out-of-order possibly? That would matter of course. It was
mentioned to me that A'rpi does not care about interlaced output
devices and therefore is not careful about outputting fields in their
correct order.
> And it really doesn't explain the tearing we sometimes see.
Indeed. That should not happen if the vsync interrupt is working and
all the associated plumbing is working too.
> But it seems to work for me... or it just hides the error :(
With the above MPlayer patch? You don't see "flip-backs" on
interlaced source material or bad judder on pans?
> That's what I thought. The CRTC2 address registers are double buffered and
> flipped at vblank automatically by the hardware. So it should be
> sufficient to write the registers and then wait for the interrupt which
> should arrive two lines after vblank start.
So when the vblank interrupt happens where is the "raster gun"? Is it
still at the end of the current field or is it drawing the next field?
Does the hardware shuffle the off-screen "buffer" (i.e. the next frame
to be displayed) into the on-screen buffer automatically, or is it a
round-robin pool (i.e. does the hardware draw out of both buffers
alternately) and the writer has to know which is being displayed
and which he can write into? This could explain tearing if the timing
is bad.
> By the time the interrupt
> arrives the hardware should have flipped the registers and we can continue
> drawing to the back buffer. Something apparently fails on some occasions
> and we see some nasty crap on the TV.
Yes.
b.
--
Brian J. Murrell
msg01122/pgp00000.pgp
Description: PGP signature
