[MPlayer-cvslog] CVS: main/libvo gl_common.c, 1.14, 1.15 gl_common.h, 1.11, 1.12 vo_gl.c, 1.86, 1.87

Reimar Döffinger CVS syncmail at mplayerhq.hu
Fri Aug 19 11:31:04 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main/libvo
In directory mail:/var2/tmp/cvs-serv17587/libvo

Modified Files:
	gl_common.c gl_common.h vo_gl.c 
Log Message:
automatic vsync enabling for vo_gl.


Index: gl_common.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- gl_common.c	16 Aug 2005 17:57:53 -0000	1.14
+++ gl_common.c	19 Aug 2005 09:31:02 -0000	1.15
@@ -22,6 +22,7 @@
 void (APIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
 void (APIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
                                        GLfloat, GLfloat);
+int (*SwapInterval)(int);
 
 /**
  * \brief adjusts the GL_UNPACK_ALGNMENT to fit the stride.
@@ -259,6 +260,17 @@
     ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fARB");
   if (!ProgramEnvParameter4f)
     ProgramEnvParameter4f = getProcAddress("glProgramEnvParameter4fNV");
+  SwapInterval = getProcAddress("glXSwapInterval");
+  if (!SwapInterval)
+    SwapInterval = getProcAddress("glXSwapIntervalEXT");
+  if (!SwapInterval)
+    SwapInterval = getProcAddress("glXSwapIntervalSGI");
+  if (!SwapInterval)
+    SwapInterval = getProcAddress("wglSwapInterval");
+  if (!SwapInterval)
+    SwapInterval = getProcAddress("wglSwapIntervalEXT");
+  if (!SwapInterval)
+    SwapInterval = getProcAddress("wglSwapIntervalSGI");
 }
 
 /**

Index: gl_common.h
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/gl_common.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- gl_common.h	16 Aug 2005 19:07:07 -0000	1.11
+++ gl_common.h	19 Aug 2005 09:31:02 -0000	1.12
@@ -108,5 +108,6 @@
 extern void (APIENTRY *ProgramString)(GLenum, GLenum, GLsizei, const GLvoid *);
 extern void (APIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat,
                                               GLfloat, GLfloat);
+extern int (*SwapInterval)(int);
 
 #endif

Index: vo_gl.c
===================================================================
RCS file: /cvsroot/mplayer/main/libvo/vo_gl.c,v
retrieving revision 1.86
retrieving revision 1.87
diff -u -r1.86 -r1.87
--- vo_gl.c	16 Aug 2005 23:24:52 -0000	1.86
+++ vo_gl.c	19 Aug 2005 09:31:02 -0000	1.87
@@ -62,6 +62,7 @@
 static uint32_t image_height;
 static int many_fmts;
 static int use_glFinish;
+static int swap_interval;
 static GLenum gl_target;
 static GLenum gl_texfmt;
 static GLenum gl_format;
@@ -149,6 +150,8 @@
 
   glClearColor( 0.0f,0.0f,0.0f,0.0f );
   glClear( GL_COLOR_BUFFER_BIT );
+  if (SwapInterval)
+    SwapInterval(swap_interval);
   gl_buffer = 0;
   gl_buffersize = 0;
   err_shown = 0;
@@ -519,6 +522,7 @@
   {"slice-height", OPT_ARG_INT,  &slice_height, (opt_test_f)int_non_neg},
   {"rectangle",    OPT_ARG_INT,  &use_rectangle,(opt_test_f)int_non_neg},
   {"glfinish",     OPT_ARG_BOOL, &use_glFinish, NULL},
+  {"swapinterval", OPT_ARG_INT,  &swap_interval,NULL},
   {NULL}
 };
 
@@ -531,6 +535,7 @@
     use_aspect = 1;
     use_rectangle = 0;
     use_glFinish = 0;
+    swap_interval = 1;
     slice_height = 4;
     if (subopt_parse(arg, subopts) != 0) {
       mp_msg(MSGT_VO, MSGL_FATAL,
@@ -551,6 +556,10 @@
               "    2: use texture_non_power_of_two\n"
               "  glfinish\n"
               "    Call glFinish() before swapping buffers\n"
+              "  swapinterval=<n>\n"
+              "    Interval in displayed frames between to buffer swaps.\n"
+              "    1 is equivalent to enable VSYNC, 0 to disable VSYNC.\n"
+              "    Requires GLX_SGI_swap_control support to work.\n"
               "\n" );
       return -1;
     }




More information about the MPlayer-cvslog mailing list