From 2b6241a09a136db26834e75aeb3730f00894ee54 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 30 Oct 2015 20:26:51 +0100 Subject: 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 --- video/out/opengl/common.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'video/out/opengl/common.h') diff --git a/video/out/opengl/common.h b/video/out/opengl/common.h index 35d303e96c..3f5ab0ebde 100644 --- a/video/out/opengl/common.h +++ b/video/out/opengl/common.h @@ -244,6 +244,10 @@ struct GL { void (GLAPIENTRY *UniformMatrix3fv)(GLint, GLsizei, GLboolean, const GLfloat *); + GLsync (GLAPIENTRY *FenceSync)(GLenum, GLbitfield); + GLenum (GLAPIENTRY *ClientWaitSync)(GLsync, GLbitfield, GLuint64); + void (GLAPIENTRY *DeleteSync)(GLsync sync); + void (GLAPIENTRY *VDPAUInitNV)(const GLvoid *, const GLvoid *); void (GLAPIENTRY *VDPAUFiniNV)(void); GLvdpauSurfaceNV (GLAPIENTRY *VDPAURegisterOutputSurfaceNV) -- cgit v1.2.3