summaryrefslogtreecommitdiffstats
path: root/video/out/gl_common.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-05-13 22:00:34 +0200
committerwm4 <wm4@nowhere>2015-05-13 22:00:34 +0200
commitd89eb74cb757ab3bc864a7cd7fc05e3c96104ac9 (patch)
tree74aaf9e064dfdaab375615c485a6fabfdc1f125c /video/out/gl_common.c
parent7e21f6fd0049e14e384758237fcfe3ef03d93d1f (diff)
downloadmpv-d89eb74cb757ab3bc864a7cd7fc05e3c96104ac9.tar.bz2
mpv-d89eb74cb757ab3bc864a7cd7fc05e3c96104ac9.tar.xz
cocoa: redo synchronization
Before this change, Cocoa state was accessed from both the VO and the Cocoa main thread. This was probably not a good idea. There was some locking as well as implicit synchronization using the dispatch mechanism, but it wasn't watertight. Change this completely. Now Cocoa things are always accessed from the main thread only. The old mutex falls away, as well as the vo_cocoa_set_current_context() function, which implicitly used the lock to coordinate VO accesses. With the new code, the VO thread generally has to wait for the main thread, while the main thread never waits for the VO and rarely accesses it. Fortunately, this is rather straight forward, and most of this is achieved by making vo_cocoa_control() run on the main thread. The logic of the code does generally not change. Some aspects are trickier. Apparently we can't access the NSOpenGLContext from the VO thread, because this object is not thread- safe. We use some CGLContextObj functions instead, such as for making the context current and swapping the buffers.
Diffstat (limited to 'video/out/gl_common.c')
0 files changed, 0 insertions, 0 deletions