Created
September 24, 2013 15:18
-
-
Save richardgv/6686313 to your computer and use it in GitHub Desktop.
chjj/compton #7: Patch to add SGI_video_sync to mpv
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -x '*~' -x '.*.sw?' -ru mpv-0.1.7.orig/video/out/gl_common.c mpv-0.1.7/video/out/gl_common.c | |
--- mpv-0.1.7.orig/video/out/gl_common.c 2013-09-24 22:58:11.829840182 +0800 | |
+++ mpv-0.1.7/video/out/gl_common.c 2013-09-24 23:05:09.749834728 +0800 | |
@@ -362,6 +362,15 @@ | |
{0} | |
}, | |
}, | |
+ // SGI_video_sync | |
+ { | |
+ .extension = "SGI_video_sync", | |
+ .functions = (struct gl_function[]) { | |
+ DEF_FN_NAMES(GetVideoSync, "glXGetVideoSyncSGI"), | |
+ DEF_FN_NAMES(WaitVideoSync, "glXWaitVideoSyncSGI"), | |
+ {0} | |
+ }, | |
+ }, | |
// GL legacy functions in GL 1.x - 2.x, removed from GL 3.x | |
{ | |
.ver_core = MPGL_VER(1, 1), | |
diff -x '*~' -x '.*.sw?' -ru mpv-0.1.7.orig/video/out/gl_common.h mpv-0.1.7/video/out/gl_common.h | |
--- mpv-0.1.7.orig/video/out/gl_common.h 2013-09-24 22:58:11.829840182 +0800 | |
+++ mpv-0.1.7/video/out/gl_common.h 2013-09-24 23:06:39.699833554 +0800 | |
@@ -259,6 +259,8 @@ | |
void (GLAPIENTRY *ProgramEnvParameter4f)(GLenum, GLuint, GLfloat, GLfloat, | |
GLfloat, GLfloat); | |
int (GLAPIENTRY *SwapInterval)(int); | |
+ int (GLAPIENTRY *WaitVideoSync) (int, int, unsigned *); | |
+ int (GLAPIENTRY *GetVideoSync) (unsigned *); | |
void (GLAPIENTRY *TexImage3D)(GLenum, GLint, GLenum, GLsizei, GLsizei, | |
GLsizei, GLint, GLenum, GLenum, | |
const GLvoid *); | |
diff -x '*~' -x '.*.sw?' -ru mpv-0.1.7.orig/video/out/gl_x11.c mpv-0.1.7/video/out/gl_x11.c | |
--- mpv-0.1.7.orig/video/out/gl_x11.c 2013-09-24 22:58:11.829840182 +0800 | |
+++ mpv-0.1.7/video/out/gl_x11.c 2013-09-24 23:10:57.179830194 +0800 | |
@@ -298,6 +298,11 @@ | |
static void swapGlBuffers_x11(MPGLContext *ctx) | |
{ | |
+ if (ctx->gl->GetVideoSync && ctx->gl->WaitVideoSync) { | |
+ unsigned vblank_count = 0; | |
+ ctx->gl->GetVideoSync(&vblank_count); | |
+ ctx->gl->WaitVideoSync(2, (vblank_count + 1) % 2, &vblank_count); | |
+ } | |
glXSwapBuffers(ctx->vo->x11->display, ctx->vo->x11->window); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment