[MPlayer-dev-eng] [PATCH] try to enable XV_SYNC_TO_VBLANK

Reimar Döffinger Reimar.Doeffinger at stud.uni-karlsruhe.de
Mon Jun 27 00:34:27 CEST 2005


Hi,
the attached patch tries to enable XV_SYNC_TO_VBLANK, thus allowing
mutiple non-tearing xv outputs at once at least on nVidia cards (and
even on different displays!).
It only makes a difference for the "emulated" adapters (called "Video Textures"
or "Video Blitters", they don't support things like changing brightness,
contrast etc, but with this patch they are at least usable without
setting this flag by hand...).
Alexander: Maybe this also fixes your problem with TV-Out? *g*

Greetings,
Reimar Döffinger
-------------- next part --------------
Index: libvo/vo_xv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_xv.c,v
retrieving revision 1.166
diff -u -r1.166 vo_xv.c
--- libvo/vo_xv.c	21 May 2005 17:31:44 -0000	1.166
+++ libvo/vo_xv.c	26 Jun 2005 22:30:40 -0000
@@ -917,6 +917,7 @@
     {
       return -1; // bail out, colorkey setup failed
     }
+    vo_xv_enable_vsync();
 
     fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats);
 
Index: libvo/x11_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/x11_common.c,v
retrieving revision 1.193
diff -u -r1.193 x11_common.c
--- libvo/x11_common.c	20 Jun 2005 23:07:35 -0000	1.193
+++ libvo/x11_common.c	26 Jun 2005 22:30:48 -0000
@@ -2284,6 +2284,19 @@
 
   return xv_atom;
 }
+
+/**
+ * \brief Try to enable vsync for xv.
+ * \return Returns -1 if not available, 0 on failure and 1 on success.
+ */
+int vo_xv_enable_vsync()
+{
+  Atom xv_atom = xv_intern_atom_if_exists("XV_SYNC_TO_VBLANK");
+  if (xv_atom == None)
+    return -1;
+  return XvSetPortAttribute(mDisplay, xv_port, xv_atom, 1) == Success;
+}
+
 /**
  * \brief Print information about the colorkey method and source.
  *


More information about the MPlayer-dev-eng mailing list