summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-01-23 20:56:11 +0100
committerwm4 <wm4@nowhere>2015-01-23 20:56:25 +0100
commita0a40eb2872d137898e6f96b8d46490f2e63071f (patch)
tree2e665b1ce92a6984c5498e8faaa38e0d6b2d7e92
parentd76dbbd41427a12f03dac7ccc99d8c864b228d6b (diff)
downloadmpv-a0a40eb2872d137898e6f96b8d46490f2e63071f.tar.bz2
mpv-a0a40eb2872d137898e6f96b8d46490f2e63071f.tar.xz
vo: fix disabling/enabling smoothmotion at runtime
vo.c queried the VO at initialization whether it wants to be updated on every display frame, or every video frame. If the smoothmotion option was changed at runtime, the rendering mode in vo.c wasn't updated. Just let vo_opengl set the mode directly. Abuse the existing vo_set_flip_queue_offset() function for this. Also add a comment suggesting the use of --display-fps to the manpage, which doesn't have anything to do with the rest of this commit, but is important to make smoothmotion run well.
-rw-r--r--DOCS/man/vo.rst3
-rw-r--r--video/out/vo.c10
-rw-r--r--video/out/vo.h4
-rw-r--r--video/out/vo_opengl.c6
-rw-r--r--video/out/vo_vdpau.c2
5 files changed, 13 insertions, 12 deletions
diff --git a/DOCS/man/vo.rst b/DOCS/man/vo.rst
index f177bd4fde..4a02b7cfa8 100644
--- a/DOCS/man/vo.rst
+++ b/DOCS/man/vo.rst
@@ -585,6 +585,9 @@ Available video output drivers are:
vsync behavior can lead to bad results. If the framerate is close to or
over the display refresh rate, results can be bad as well.
+ .. note:: On systems other than Linux, you currently must set the
+ ``--display-fps`` option, or the results will be bad.
+
``smoothmotion-threshold=<0.0-1.0>``
Mix threshold at which interpolation is skipped (default: 0.0 – never
skip).
diff --git a/video/out/vo.c b/video/out/vo.c
index afc963e8fd..36bd2a9c2e 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -711,7 +711,6 @@ static void *vo_thread(void *ptr)
mpthread_set_name("vo");
int r = vo->driver->preinit(vo) ? -1 : 0;
- vo->driver->control(vo, VOCTRL_GET_VSYNC_TIMED, &in->vsync_timed);
mp_rendezvous(vo, r); // init barrier
if (r < 0)
return NULL;
@@ -879,13 +878,16 @@ const char *vo_get_window_title(struct vo *vo)
return vo->in->window_title;
}
-// flip_page[_timed] will be called this many microseconds too early.
+// flip_page[_timed] will be called offset_us microseconds too early.
// (For vo_vdpau, which does its own timing.)
-void vo_set_flip_queue_offset(struct vo *vo, int64_t us)
+// Setting vsync_timed to true redraws as fast as possible.
+// (For vo_opengl smoothmotion.)
+void vo_set_flip_queue_params(struct vo *vo, int64_t offset_us, bool vsync_timed)
{
struct vo_internal *in = vo->in;
pthread_mutex_lock(&in->lock);
- in->flip_queue_offset = us;
+ in->flip_queue_offset = offset_us;
+ in->vsync_timed = vsync_timed;
pthread_mutex_unlock(&in->lock);
}
diff --git a/video/out/vo.h b/video/out/vo.h
index 33a2513c1f..281152352d 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -106,8 +106,6 @@ enum mp_voctrl {
VOCTRL_GET_RECENT_FLIP_TIME, // int64_t* (using mp_time_us())
VOCTRL_GET_PREF_DEINT, // int*
-
- VOCTRL_GET_VSYNC_TIMED, // bool*
};
// VOCTRL_SET_EQUALIZER
@@ -338,7 +336,7 @@ void vo_query_formats(struct vo *vo, uint8_t *list);
void vo_event(struct vo *vo, int event);
int vo_query_and_reset_events(struct vo *vo, int events);
-void vo_set_flip_queue_offset(struct vo *vo, int64_t us);
+void vo_set_flip_queue_params(struct vo *vo, int64_t offset_us, bool vsync_timed);
int64_t vo_get_vsync_interval(struct vo *vo);
void vo_wakeup(struct vo *vo);
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index d3f1e7da7d..6a2a48fb47 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -303,7 +303,7 @@ static bool reparse_cmdline(struct gl_priv *p, char *args)
if (r >= 0) {
mpgl_lock(p->glctx);
gl_video_set_options(p->renderer, opts->renderer_opts);
- resize(p);
+ vo_set_flip_queue_params(p->vo, 0, opts->renderer_opts->smoothmotion);
mpgl_unlock(p->glctx);
}
@@ -375,9 +375,6 @@ static int control(struct vo *vo, uint32_t request, void *data)
char *arg = data;
return reparse_cmdline(p, arg);
}
- case VOCTRL_GET_VSYNC_TIMED:
- *(bool *)data = p->renderer_opts->smoothmotion;
- return VO_TRUE;
case VOCTRL_RESET:
mpgl_lock(p->glctx);
gl_video_reset(p->renderer);
@@ -443,6 +440,7 @@ static int preinit(struct vo *vo)
gl_video_set_output_depth(p->renderer, p->glctx->depth_r, p->glctx->depth_g,
p->glctx->depth_b);
gl_video_set_options(p->renderer, p->renderer_opts);
+ vo_set_flip_queue_params(vo, 0, p->renderer_opts->smoothmotion);
p->cms = gl_lcms_init(p, vo->log, vo->global);
if (!p->cms)
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index b001ea759d..7b98b84243 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -251,7 +251,7 @@ static void resize(struct vo *vo)
vc->flip_offset_us = vo->opts->fullscreen ?
1000LL * vc->flip_offset_fs :
1000LL * vc->flip_offset_window;
- vo_set_flip_queue_offset(vo, vc->flip_offset_us);
+ vo_set_flip_queue_params(vo, vc->flip_offset_us, false);
if (vc->output_surface_width < vo->dwidth
|| vc->output_surface_height < vo->dheight) {