summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-11-12 22:40:02 +0100
committerwm4 <wm4@nowhere>2015-11-12 22:44:05 +0100
commitb726fefe5dce46ac0bf0b7d09155ba1a0760dca9 (patch)
tree17a6c90e71e50e3365cd33f190c3ce313bbcfcbc /video
parent49a41bf4df85a7af2ef151841f0c6541bf8e7d96 (diff)
downloadmpv-b726fefe5dce46ac0bf0b7d09155ba1a0760dca9.tar.bz2
mpv-b726fefe5dce46ac0bf0b7d09155ba1a0760dca9.tar.xz
vo_opengl_cb: do not block on flipping when redrawing
Gives slightly better behavior when used with Qt. (Which tends not to flip buffers when the window is not visible.)
Diffstat (limited to 'video')
-rw-r--r--video/out/vo_opengl_cb.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/video/out/vo_opengl_cb.c b/video/out/vo_opengl_cb.c
index a78b6a7fb7..687b9e3528 100644
--- a/video/out/vo_opengl_cb.c
+++ b/video/out/vo_opengl_cb.c
@@ -70,6 +70,7 @@ struct mpv_opengl_cb_context {
struct vo_frame *next_frame; // next frame to draw
int64_t present_count; // incremented when next frame can be shown
int64_t expected_flip_count; // next vsync event for next_frame
+ bool redrawing; // next_frame was a redraw request
int64_t flip_count;
struct vo_frame *cur_frame;
struct mp_image_params img_params;
@@ -350,6 +351,7 @@ static void draw_frame(struct vo *vo, struct vo_frame *frame)
assert(!p->ctx->next_frame);
p->ctx->next_frame = vo_frame_ref(frame);
p->ctx->expected_flip_count = p->ctx->flip_count + 1;
+ p->ctx->redrawing = frame ? frame->redraw : false;
update(p);
pthread_mutex_unlock(&p->ctx->lock);
}
@@ -373,6 +375,9 @@ static void flip_page(struct vo *vo)
p->ctx->present_count += 1;
pthread_cond_signal(&p->ctx->wakeup);
+ if (p->ctx->redrawing)
+ goto done; // do not block for redrawing
+
// Wait until frame was presented
while (p->ctx->expected_flip_count > p->ctx->flip_count) {
// mpv_opengl_cb_report_flip() is declared as optional API.