diff options
author | wm4 <wm4@nowhere> | 2015-05-01 18:25:29 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-05-01 18:26:58 +0200 |
commit | e23e4c7c603fc1cd911621d0f833031be4a6f7c7 (patch) | |
tree | 571a8e11f3cefeb90c72fb9279ea7e52d0f53fc9 /video/out/gl_cocoa.c | |
parent | ffcad1a72b9a3bf5a7ac5ddcbfa71ec19b6faf9b (diff) | |
download | mpv-e23e4c7c603fc1cd911621d0f833031be4a6f7c7.tar.bz2 mpv-e23e4c7c603fc1cd911621d0f833031be4a6f7c7.tar.xz |
cocoa: don't accidentally drop initial screen drawing
With --idle --force-window, or when started from the bundle, the cocoa
code dropped the first frame. This resulted in a black frame on start
sometimes.
The reason was that the live resizing/redrawing code was invoked, which
simply set skip_swap_buffer to false, blocking redrawing whatever was
going to be rendered next. Normally this is done so that the following
works:
1. vo_opengl draw a frame, releases GL lock
2. live resizing kicks in, redraw the frame
3. vo_opengl wants to call SwapBuffers, drawing a stale buffer
overwritten by the live resizing code
This is solved by setting skip_swap_buffer in 2., and querying it in 3.
Fix this by resetting the skip_swap_buffer at a known good point: when
vo_opengl starts drawing a new frame.
The start_frame function returns bool, so that it can be merged with
is_active in a following commit.
Diffstat (limited to 'video/out/gl_cocoa.c')
-rw-r--r-- | video/out/gl_cocoa.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/video/out/gl_cocoa.c b/video/out/gl_cocoa.c index fd12ef4621..014bf38204 100644 --- a/video/out/gl_cocoa.c +++ b/video/out/gl_cocoa.c @@ -153,6 +153,11 @@ static void releaseGlContext_cocoa(MPGLContext *ctx) CGLReleaseContext(p->ctx); } +static bool start_frame_cocoa(MPGLContext *ctx) +{ + return vo_cocoa_start_frame(ctx->vo); +} + static void swapGlBuffers_cocoa(MPGLContext *ctx) { vo_cocoa_swap_buffers(ctx->vo); @@ -169,6 +174,7 @@ void mpgl_set_backend_cocoa(MPGLContext *ctx) ctx->config_window = config_window_cocoa; ctx->releaseGlContext = releaseGlContext_cocoa; ctx->swapGlBuffers = swapGlBuffers_cocoa; + ctx->start_frame = start_frame_cocoa; ctx->vo_init = vo_cocoa_init; ctx->register_resize_callback = vo_cocoa_register_resize_callback; ctx->vo_uninit = vo_cocoa_uninit; |