mirror of https://github.com/mpv-player/mpv
cocoa-cb: render on main queue instead of dedicated queue
initially we drew on a dedicated render queue to circumvent certain bottlenecks on the main queue, like concurrent events that could lead to late drawing. though due to the way cocoa works we need to draw an the main queue otherwise we get undefined behaviour that could lead to crashes. Fixes #10276
This commit is contained in:
parent
7758f6f50e
commit
15c48f3dc1
|
@ -82,8 +82,6 @@ class GLLayer: CAOpenGLLayer {
|
||||||
enum Draw: Int { case normal = 1, atomic, atomicEnd }
|
enum Draw: Int { case normal = 1, atomic, atomicEnd }
|
||||||
var draw: Draw = .normal
|
var draw: Draw = .normal
|
||||||
|
|
||||||
let queue: DispatchQueue = DispatchQueue(label: "io.mpv.queue.draw")
|
|
||||||
|
|
||||||
var needsICCUpdate: Bool = false {
|
var needsICCUpdate: Bool = false {
|
||||||
didSet {
|
didSet {
|
||||||
if needsICCUpdate == true {
|
if needsICCUpdate == true {
|
||||||
|
@ -239,7 +237,7 @@ class GLLayer: CAOpenGLLayer {
|
||||||
|
|
||||||
func update(force: Bool = false) {
|
func update(force: Bool = false) {
|
||||||
if force { forceDraw = true }
|
if force { forceDraw = true }
|
||||||
queue.async {
|
DispatchQueue.main.async {
|
||||||
if self.forceDraw || !self.inLiveResize {
|
if self.forceDraw || !self.inLiveResize {
|
||||||
self.needsFlip = true
|
self.needsFlip = true
|
||||||
self.display()
|
self.display()
|
||||||
|
|
Loading…
Reference in New Issue