diff options
author | wm4 <wm4@nowhere> | 2015-05-01 18:25:29 +0200 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-05-07 10:41:57 +0900 |
commit | 488b5e3ac3986d20cd6184668252cce70bb23760 (patch) | |
tree | 0616e2ae07a793c3152e5ee2da5e46188cf2b056 /video/out/gl_common.h | |
parent | afb97c517d8041df61092b14e55c445a69cdfcff (diff) | |
download | mpv-488b5e3ac3986d20cd6184668252cce70bb23760.tar.bz2 mpv-488b5e3ac3986d20cd6184668252cce70bb23760.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.
(cherry picked from commit e23e4c7c603fc1cd911621d0f833031be4a6f7c7)
Diffstat (limited to 'video/out/gl_common.h')
-rw-r--r-- | video/out/gl_common.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/video/out/gl_common.h b/video/out/gl_common.h index 8a133784c7..1c908cfa2b 100644 --- a/video/out/gl_common.h +++ b/video/out/gl_common.h @@ -118,6 +118,11 @@ typedef struct MPGLContext { // If false, OpenGL renderers should not draw anything. bool (*is_active)(struct MPGLContext *); + // Optional callback on the beginning of a frame. The frame will be finished + // with swapGlBuffers(). Like is_active, this returns false if use of the + // OpenGL context should be avoided. + bool (*start_frame)(struct MPGLContext *); + // For free use by the backend. void *priv; } MPGLContext; |