diff options
author | wm4 <wm4@nowhere> | 2020-05-09 22:32:28 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-05-09 22:32:28 +0200 |
commit | 0e3f8936062967a9dbea78c36d06b9d4e01cf698 (patch) | |
tree | 46cbcf769428023b7737bd498073d4fdc3fb3757 | |
parent | 2446f5f43b308b1af4a094fc1502142d9b14ea51 (diff) | |
download | mpv-0e3f8936062967a9dbea78c36d06b9d4e01cf698.tar.bz2 mpv-0e3f8936062967a9dbea78c36d06b9d4e01cf698.tar.xz |
vo: another minor wakeup reduction
The caller of render_frame() re-iterates without waiting if this
function returns true. That's normally meant for DS, where we draw
frames as fast as possible to let the driver perform waiting.
-rw-r--r-- | video/out/vo.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/video/out/vo.c b/video/out/vo.c index 1063309fe7..afc6ff770e 100644 --- a/video/out/vo.c +++ b/video/out/vo.c @@ -869,7 +869,7 @@ static bool render_frame(struct vo *vo) { struct vo_internal *in = vo->in; struct vo_frame *frame = NULL; - bool got_frame = false; + bool more_frames = false; update_display_fps(vo); @@ -994,9 +994,14 @@ static bool render_frame(struct vo *vo) in->request_redraw = false; } - pthread_cond_broadcast(&in->wakeup); // for vo_wait_frame() + if (in->current_frame && in->current_frame->num_vsyncs && + in->current_frame->display_synced) + more_frames = true; + + if (in->frame_queued && in->frame_queued->display_synced) + more_frames = true; - got_frame = true; + pthread_cond_broadcast(&in->wakeup); // for vo_wait_frame() done: talloc_free(frame); @@ -1006,7 +1011,7 @@ done: } pthread_mutex_unlock(&in->lock); - return got_frame || (in->frame_queued && in->frame_queued->display_synced); + return more_frames; } static void do_redraw(struct vo *vo) @@ -1083,7 +1088,7 @@ static void *vo_thread(void *ptr) break; stats_event(in->stats, "iterations"); vo->driver->control(vo, VOCTRL_CHECK_EVENTS, NULL); - bool working = render_frame(vo); + bool working = render_frame(vo)&&0; int64_t now = mp_time_us(); int64_t wait_until = now + (working ? 0 : (int64_t)1e9); |