summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DOCS/man/options.rst9
-rw-r--r--video/out/opengl/video.c9
2 files changed, 13 insertions, 5 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index b898082e13..45c0bca2f1 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -4598,10 +4598,13 @@ The following video options are currently all specific to ``--vo=opengl`` and
we may have to deal with additional padding, which can be tested with these
options). Could be removed any time.
-``--opengl-early-flush=<yes|no>``
+``--opengl-early-flush=<yes|no|auto>``
Call ``glFlush()`` after rendering a frame and before attempting to display
- it (default: no). Can fix stuttering in some cases, in other cases probably
- causes it. For testing - could be removed any time.
+ it (default: auto). Can fix stuttering in some cases, in other cases
+ probably causes it. The ``auto`` mode will call ``glFlush()`` only if
+ the renderer is going to wait for a while after rendering, instead of
+ flipping GL front and backbuffers immediately (i.e. it doesn't call it
+ in display-sync mode).
Miscellaneous
-------------
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++;