summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/video.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-10-21 17:23:26 +0200
committerwm4 <wm4@nowhere>2016-10-21 17:23:26 +0200
commit202f6953980a76e534a6e99136305407cb66e200 (patch)
tree76ada27db51b8d201e5f1a031a86258ea9ccddc8 /video/out/opengl/video.c
parentf64de3ea6659e6fe459700d1d03917990eb9d84a (diff)
downloadmpv-202f6953980a76e534a6e99136305407cb66e200.tar.bz2
mpv-202f6953980a76e534a6e99136305407cb66e200.tar.xz
vo_opengl: partially re-enable glFlush() calls
It turns out the glFlush() call really helps in some cases, though only in audio timing mode (where we render, then wait for a while, then display the frame). Add a --opengl-early-flush=auto mode, which does exactly that. It's unclear whether this is fine on OSX (strange things going on there), but it should be. See #3670.
Diffstat (limited to 'video/out/opengl/video.c')
-rw-r--r--video/out/opengl/video.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 9461153615..dadfe705ff 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -322,6 +322,7 @@ static const struct gl_video_opts gl_video_opts_def = {
.target_brightness = 250,
.hdr_tone_mapping = TONE_MAPPING_HABLE,
.tone_mapping_param = NAN,
+ .early_flush = -1,
};
static int validate_scaler_opt(struct mp_log *log, const m_option_t *opt,
@@ -412,7 +413,8 @@ const struct m_sub_options gl_video_conf = {
OPT_INTRANGE("opengl-tex-pad-x", tex_pad_x, 0, 0, 4096),
OPT_INTRANGE("opengl-tex-pad-y", tex_pad_y, 0, 0, 4096),
OPT_SUBSTRUCT("", icc_opts, mp_icc_conf, 0),
- OPT_FLAG("opengl-early-flush", early_flush, 0),
+ OPT_CHOICE("opengl-early-flush", early_flush, 0,
+ ({"no", 0}, {"yes", 1}, {"auto", -1})),
{0}
},
@@ -2849,8 +2851,11 @@ done:
// The playloop calls this last before waiting some time until it decides
// to call flip_page(). Tell OpenGL to start execution of the GPU commands
// while we sleep (this happens asynchronously).
- if (p->opts.early_flush)
+ if ((p->opts.early_flush == -1 && !frame->display_synced) ||
+ p->opts.early_flush == 1)
+ {
gl->Flush();
+ }
p->frames_rendered++;