changeset 15826:db966bdf6f5b

Try to set XV_SYNC_TO_VBLANK to enable vsync on non-overlay xv adapters.
author reimar
date Mon, 27 Jun 2005 10:05:39 +0000
parents 8549fc0fb5b1
children a51648fbf604
files libvo/vo_xv.c libvo/x11_common.c
diffstat 2 files changed, 14 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/libvo/vo_xv.c	Mon Jun 27 08:16:23 2005 +0000
+++ b/libvo/vo_xv.c	Mon Jun 27 10:05:39 2005 +0000
@@ -917,6 +917,7 @@
     {
       return -1; // bail out, colorkey setup failed
     }
+    vo_xv_enable_vsync();
 
     fo = XvListImageFormats(mDisplay, xv_port, (int *) &formats);
 
--- a/libvo/x11_common.c	Mon Jun 27 08:16:23 2005 +0000
+++ b/libvo/x11_common.c	Mon Jun 27 10:05:39 2005 +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.
  *