Skip to content

Commit

Permalink
vo_opengl: disable glFlush() by default, and add an option to enable it
Browse files Browse the repository at this point in the history
It seems this can cause issues with certain platforms, so better to
disable it by default. The original reason for this isn't overly
justified, and display-sync mode should get rid of the need for it
anyway.

The new option is meant for testing, and will probably be removed if
nobody comes up and reports that enabling the option actually improves
anything.
  • Loading branch information
wm4 committed Oct 5, 2016
1 parent 387f501 commit 6789f9b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions DOCS/man/options.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4591,6 +4591,11 @@ 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>``
Call ``glFlush()`` after rendering a frame and before attempting to display
it (default: no). Can fix stuttering in some causes, in other cases probably
causes it. For testing - could be removed any time.

Miscellaneous
-------------

Expand Down
4 changes: 3 additions & 1 deletion video/out/opengl/video.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ 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),

{0}
},
Expand Down Expand Up @@ -2848,7 +2849,8 @@ void gl_video_render_frame(struct gl_video *p, struct vo_frame *frame, int fbo)
// 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).
gl->Flush();
if (p->opts.early_flush)
gl->Flush();

p->frames_rendered++;

Expand Down
2 changes: 2 additions & 0 deletions video/out/opengl/video.h
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ struct gl_video_opts {
float unsharp;
int tex_pad_x, tex_pad_y;
struct mp_icc_opts *icc_opts;
int early_flush;
int use_overlay;
};

extern const struct m_sub_options gl_video_conf;
Expand Down

0 comments on commit 6789f9b

Please sign in to comment.