diff options
author | Jari Vetoniemi <mailroxas@gmail.com> | 2015-03-22 02:32:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-03-23 21:53:32 +0100 |
commit | 3a6ade7a848f5213525430d9049e96e642638fc8 (patch) | |
tree | f0341a228f43f67883b82bf9ebbbd03fefd6388a /video/out/vo_opengl.c | |
parent | c10fb4ce9fcd3dbbf69741eb8499c4cfabbf5412 (diff) | |
download | mpv-3a6ade7a848f5213525430d9049e96e642638fc8.tar.bz2 mpv-3a6ade7a848f5213525430d9049e96e642638fc8.tar.xz |
vo_opengl: do not block on wayland
When not receiving frame callbacks, we should not draw anything to avoid
blocking the OpenGL renderer. We do this by extending gl context api, by
introducing new optional function 'is_active', that indicates whether
OpenGL renderers should draw or not.
This fixes issue #249.
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r-- | video/out/vo_opengl.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c index 84381e42d1..25e25a2e9d 100644 --- a/video/out/vo_opengl.c +++ b/video/out/vo_opengl.c @@ -122,6 +122,9 @@ static void flip_page(struct vo *vo) struct gl_priv *p = vo->priv; GL *gl = p->gl; + if (p->glctx->is_active && !p->glctx->is_active(p->glctx)) + return; + mpgl_lock(p->glctx); p->glctx->swapGlBuffers(p->glctx); @@ -160,6 +163,12 @@ static void draw_image_timed(struct vo *vo, mp_image_t *mpi, struct gl_priv *p = vo->priv; GL *gl = p->gl; + if (p->glctx->is_active && !p->glctx->is_active(p->glctx)) { + if (mpi) + gl_video_skip_image(p->renderer, mpi); + return; + } + if (p->vo_flipped) mp_image_vflip(mpi); @@ -376,6 +385,9 @@ static int control(struct vo *vo, uint32_t request, void *data) request_hwdec_api(p, data); return true; case VOCTRL_REDRAW_FRAME: + if (p->glctx->is_active && !p->glctx->is_active(p->glctx)) + return true; + mpgl_lock(p->glctx); gl_video_render_frame(p->renderer, 0, NULL); mpgl_unlock(p->glctx); |