summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-10-30 20:26:51 +0100
committerwm4 <wm4@nowhere>2015-10-30 20:26:51 +0100
commit2b6241a09a136db26834e75aeb3730f00894ee54 (patch)
tree52b6401c2140d52c6d162fa8d458458ea965767b /video/out/opengl/common.c
parent93f748e77f1aeaeac3035552ed49aa33645bdfb0 (diff)
downloadmpv-2b6241a09a136db26834e75aeb3730f00894ee54.tar.bz2
mpv-2b6241a09a136db26834e75aeb3730f00894ee54.tar.xz
vo_opengl: add vsync-fences option
Yet another relatively useless option that tries to make OpenGL's sync behavior somewhat sane. The results are not too encouraging. With a value of 1, vsync jitter is gone on nVidia, but there are frame drops (less than with glfinish). With 2, I get the usual vsync jitter _and_ frame drops. There's still some hope that it might prevent too deep queuing with some GPUs, I guess. The timeout for the wait call is 1 second. The value is pretty arbitrary; it should just not be too high to freeze the process (if the GPU is un-nice), and not too low to trigger the timeout in normal cases, even if the GPU load is very high. So I guess 1 second is ok as a timeout. The idea to use fences this way to control the queue depth was stolen from RetroArch: https://github.com/libretro/RetroArch/blob/df01279cf318e7ec90ace039d60515296e3de908/gfx/drivers/gl.c#L1856
Diffstat (limited to 'video/out/opengl/common.c')
-rw-r--r--video/out/opengl/common.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/video/out/opengl/common.c b/video/out/opengl/common.c
index f045184373..fae969ee2a 100644
--- a/video/out/opengl/common.c
+++ b/video/out/opengl/common.c
@@ -230,6 +230,16 @@ static const struct gl_functions gl_functions[] = {
.extension = "GL_ARB_texture_rg",
.provides = MPGL_CAP_TEX_RG,
},
+ {
+ .ver_core = 320,
+ .extension = "GL_ARB_sync",
+ .functions = (const struct gl_function[]) {
+ DEF_FN(FenceSync),
+ DEF_FN(ClientWaitSync),
+ DEF_FN(DeleteSync),
+ {0}
+ },
+ },
// Swap control, always an OS specific extension
// The OSX code loads this manually.
{