summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-01-20 14:02:17 +0100
committerwm4 <wm4@nowhere>2017-01-20 14:03:34 +0100
commitfd203ff16a97b97acf428f8ab53d8b31eb8fae99 (patch)
treeaf6bd1f5591c627d3f523a7787b5e251178df568
parentd890e0731c0a0c002c32e8be89130e178059d3ba (diff)
downloadmpv-fd203ff16a97b97acf428f8ab53d8b31eb8fae99.tar.bz2
mpv-fd203ff16a97b97acf428f8ab53d8b31eb8fae99.tar.xz
options: refacactor how --opengl-dwmflush is declared
Same deal as previous commit, except this time we just readd it as lone global option, and read it directly.
-rw-r--r--options/options.c5
-rw-r--r--options/options.h2
-rw-r--r--video/out/opengl/context.h3
-rw-r--r--video/out/opengl/context_w32.c14
-rw-r--r--video/out/vo_opengl.c5
5 files changed, 17 insertions, 12 deletions
diff --git a/options/options.c b/options/options.c
index af13d1e434..cb2848e05b 100644
--- a/options/options.c
+++ b/options/options.c
@@ -697,6 +697,11 @@ const m_option_t mp_opts[] = {
OPT_SUBSTRUCT("", angle_opts, angle_conf, 0),
#endif
+#if HAVE_GL_WIN32
+ OPT_CHOICE("opengl-dwmflush", wingl_dwm_flush, 0,
+ ({"no", -1}, {"auto", 0}, {"windowed", 1}, {"yes", 2})),
+#endif
+
#if HAVE_ENCODING
OPT_SUBSTRUCT("", encode_opts, encode_config, 0),
#endif
diff --git a/options/options.h b/options/options.h
index 842781cb4b..d668832fea 100644
--- a/options/options.h
+++ b/options/options.h
@@ -319,6 +319,8 @@ typedef struct MPOpts {
char *ipc_path;
char *input_file;
+ int wingl_dwm_flush;
+
struct gl_video_opts *gl_video_opts;
struct angle_opts *angle_opts;
struct dvd_opts *dvd_opts;
diff --git a/video/out/opengl/context.h b/video/out/opengl/context.h
index 119bba0ba6..0a02bd2867 100644
--- a/video/out/opengl/context.h
+++ b/video/out/opengl/context.h
@@ -83,9 +83,6 @@ typedef struct MPGLContext {
const char *native_display_type;
void *native_display;
- // Windows-specific hack. See vo_opengl dwmflush suboption.
- int dwm_flush_opt;
-
// Flip the rendered image vertically. This is useful for dxinterop.
bool flip_v;
diff --git a/video/out/opengl/context_w32.c b/video/out/opengl/context_w32.c
index 3a0118e420..4c477642db 100644
--- a/video/out/opengl/context_w32.c
+++ b/video/out/opengl/context_w32.c
@@ -18,6 +18,8 @@
#include <assert.h>
#include <windows.h>
#include <dwmapi.h>
+
+#include "options/m_config.h"
#include "video/out/w32_common.h"
#include "video/out/win32/exclusive_hack.h"
#include "context.h"
@@ -301,10 +303,14 @@ static void w32_swap_buffers(MPGLContext *ctx)
// default if we don't DwmFLush
int new_swapinterval = w32_ctx->opt_swapinterval;
- if (ctx->dwm_flush_opt >= 0) {
- if ((ctx->dwm_flush_opt == 1 && !ctx->vo->opts->fullscreen) ||
- (ctx->dwm_flush_opt == 2) ||
- (ctx->dwm_flush_opt == 0 && compositor_active(ctx)))
+ int dwm_flush_opt;
+ mp_read_option_raw(ctx->global, "opengl-dwmflush", &m_option_type_choice,
+ &dwm_flush_opt);
+
+ if (dwm_flush_opt >= 0) {
+ if ((dwm_flush_opt == 1 && !ctx->vo->opts->fullscreen) ||
+ (dwm_flush_opt == 2) ||
+ (dwm_flush_opt == 0 && compositor_active(ctx)))
{
if (DwmFlush() == S_OK)
new_swapinterval = 0;
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 72e889931e..4917a251c6 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -54,7 +54,6 @@ struct vo_opengl_opts {
int use_gl_debug;
int allow_sw;
int swap_interval;
- int dwm_flush;
int vsync_fences;
char *backend;
int es;
@@ -387,8 +386,6 @@ static int preinit(struct vo *vo)
goto err_out;
p->gl = p->glctx->gl;
- p->glctx->dwm_flush_opt = p->opts.dwm_flush;
-
if (p->gl->SwapInterval) {
p->gl->SwapInterval(p->opts.swap_interval);
} else {
@@ -438,8 +435,6 @@ const struct vo_driver video_out_opengl = {
OPT_FLAG("opengl-glfinish", opts.use_glFinish, 0),
OPT_FLAG("opengl-waitvsync", opts.waitvsync, 0),
OPT_INT("opengl-swapinterval", opts.swap_interval, 0),
- OPT_CHOICE("opengl-dwmflush", opts.dwm_flush, 0,
- ({"no", -1}, {"auto", 0}, {"windowed", 1}, {"yes", 2})),
OPT_FLAG("opengl-debug", opts.use_gl_debug, 0),
OPT_STRING_VALIDATE("opengl-backend", opts.backend, 0,
mpgl_validate_backend_opt),