summaryrefslogtreecommitdiffstats
path: root/video/out/vo.c
diff options
context:
space:
mode:
authordudemanguy <random342@airmail.cc>2019-10-07 07:48:34 -0500
committerDudemanguy911 <random342@airmail.cc>2019-10-10 17:41:19 +0000
commite0895e097bcf15cdabc93f340dae24a88b0dc89c (patch)
tree8347cd700d146f7c1d2484af0e85e3df9389fc2c /video/out/vo.c
parent6002e2705f5e77de4a22fc24e94734dd3500feb7 (diff)
downloadmpv-e0895e097bcf15cdabc93f340dae24a88b0dc89c.tar.bz2
mpv-e0895e097bcf15cdabc93f340dae24a88b0dc89c.tar.xz
Revert "vo: add support for externally driven renderloop and make wayland use it"
The externally driven renderloop was originally added for the wayland context (to make display sync somewhat work), but it has a lot of issues with mpv's internal structure. A different approach should be used. This reverts commit a743fef837bcab206b1e576db7e7a64b02890449.
Diffstat (limited to 'video/out/vo.c')
-rw-r--r--video/out/vo.c54
1 files changed, 3 insertions, 51 deletions
diff --git a/video/out/vo.c b/video/out/vo.c
index e5b4198f76..53db20d3b4 100644
--- a/video/out/vo.c
+++ b/video/out/vo.c
@@ -128,8 +128,6 @@ struct vo_internal {
int64_t nominal_vsync_interval;
- bool external_renderloop_drive;
-
int64_t vsync_interval;
int64_t *vsync_samples;
int num_vsync_samples;
@@ -820,12 +818,11 @@ static void wait_until(struct vo *vo, int64_t target)
pthread_mutex_unlock(&in->lock);
}
-bool vo_render_frame_external(struct vo *vo)
+static bool render_frame(struct vo *vo)
{
struct vo_internal *in = vo->in;
struct vo_frame *frame = NULL;
bool got_frame = false;
- bool flipped = false;
update_display_fps(vo);
@@ -887,7 +884,6 @@ bool vo_render_frame_external(struct vo *vo)
if (in->dropped_frame) {
in->drop_count += 1;
} else {
- flipped = true;
in->rendering = true;
in->hasframe_rendered = true;
int64_t prev_drop_count = vo->in->drop_count;
@@ -949,8 +945,6 @@ bool vo_render_frame_external(struct vo *vo)
done:
talloc_free(frame);
pthread_mutex_unlock(&in->lock);
- if (in->external_renderloop_drive)
- return flipped;
return got_frame || (in->frame_queued && in->frame_queued->display_synced);
}
@@ -993,44 +987,6 @@ static void do_redraw(struct vo *vo)
talloc_free(frame);
}
-static void drop_unrendered_frame(struct vo *vo)
-{
- struct vo_internal *in = vo->in;
-
- pthread_mutex_lock(&in->lock);
-
- if (!in->frame_queued)
- goto end;
-
- if ((in->frame_queued->pts + in->frame_queued->duration) > mp_time_us())
- goto end;
-
- MP_VERBOSE(vo, "Dropping unrendered frame (pts %"PRId64")\n", in->frame_queued->pts);
-
- talloc_free(in->frame_queued);
- in->frame_queued = NULL;
- in->hasframe = false;
- pthread_cond_broadcast(&in->wakeup);
- wakeup_core(vo);
-
-end:
- pthread_mutex_unlock(&in->lock);
-}
-
-void vo_enable_external_renderloop(struct vo *vo)
-{
- struct vo_internal *in = vo->in;
- MP_VERBOSE(vo, "Enabling event driven renderloop!\n");
- in->external_renderloop_drive = true;
-}
-
-void vo_disable_external_renderloop(struct vo *vo)
-{
- struct vo_internal *in = vo->in;
- MP_VERBOSE(vo, "Disabling event driven renderloop!\n");
- in->external_renderloop_drive = false;
-}
-
static struct mp_image *get_image_vo(void *ctx, int imgfmt, int w, int h,
int stride_align)
{
@@ -1065,11 +1021,7 @@ static void *vo_thread(void *ptr)
if (in->terminate)
break;
vo->driver->control(vo, VOCTRL_CHECK_EVENTS, NULL);
- bool working = false;
- if (!in->external_renderloop_drive || !in->hasframe_rendered)
- working = vo_render_frame_external(vo);
- else
- drop_unrendered_frame(vo);
+ bool working = render_frame(vo);
int64_t now = mp_time_us();
int64_t wait_until = now + (working ? 0 : (int64_t)1e9);
@@ -1082,7 +1034,7 @@ static void *vo_thread(void *ptr)
wakeup_core(vo);
}
}
- if (vo->want_redraw) {
+ if (vo->want_redraw && !in->want_redraw) {
vo->want_redraw = false;
in->want_redraw = true;
wakeup_core(vo);