summaryrefslogtreecommitdiffstats
path: root/video/out/vo_opengl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-01 18:44:45 +0200
committerDiogo Franco (Kovensky) <diogomfranco@gmail.com>2015-05-07 10:42:10 +0900
commit8c3a92d6cb5293c0d058450cac0d1a1720411f47 (patch)
treebc933086133c552ad9f4edbe62902eab71041e15 /video/out/vo_opengl.c
parent488b5e3ac3986d20cd6184668252cce70bb23760 (diff)
downloadmpv-8c3a92d6cb5293c0d058450cac0d1a1720411f47.tar.bz2
mpv-8c3a92d6cb5293c0d058450cac0d1a1720411f47.tar.xz
vo_opengl: refactor wayland frame skipping
Currently, the wayland backend needs extra work to avoid drawing more often than the wayland frame callback allows. (This is not ideal, but will be fixed at a later time.) Unify this with the start_frame callback added for cocoa. Some details change for the better. For example, if a frame is dropped, and a redraw is done afterwards, the actually correct frame is redrawn, instead whatever was in the textures from before the dropped frame. (cherry picked from commit 0a7abbda6b555fb7746f737b52d0f00fb3e614db)
Diffstat (limited to 'video/out/vo_opengl.c')
-rw-r--r--video/out/vo_opengl.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/video/out/vo_opengl.c b/video/out/vo_opengl.c
index 43b2b9e04b..15b36e8238 100644
--- a/video/out/vo_opengl.c
+++ b/video/out/vo_opengl.c
@@ -78,6 +78,8 @@ struct gl_priv {
int vo_flipped;
+ bool frame_started;
+
int frames_rendered;
unsigned int prev_sgi_sync_count;
@@ -124,8 +126,11 @@ 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))
+ if (!p->frame_started) {
+ vo_increment_drop_count(vo, 1);
return;
+ }
+ p->frame_started = false;
mpgl_lock(p->glctx);
@@ -171,25 +176,20 @@ 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);
mpgl_lock(p->glctx);
if (mpi)
- gl_video_upload_image(p->renderer, mpi);
+ gl_video_set_image(p->renderer, mpi);
if (p->glctx->start_frame && !p->glctx->start_frame(p->glctx)) {
mpgl_unlock(p->glctx);
return;
}
+ p->frame_started = true;
gl_video_render_frame(p->renderer, 0, t);
// The playloop calls this last before waiting some time until it decides
@@ -394,11 +394,11 @@ 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);
+ if (!(p->glctx->start_frame && !p->glctx->start_frame(p->glctx))) {
+ p->frame_started = true;
+ gl_video_render_frame(p->renderer, 0, NULL);
+ }
mpgl_unlock(p->glctx);
return true;
case VOCTRL_SET_COMMAND_LINE: {