From c15307244fc54315c18c69c4ce5234803165f304 Mon Sep 17 00:00:00 2001 From: der richter Date: Mon, 26 Feb 2024 22:48:05 +0100 Subject: [PATCH] mac: remove unnecessary metal layer colour space update this logic was copied from the cocoa-cb opengl backend, since it was assumed both layers work similar. apparently they don't and a nil value on the metal layer means use the display colour profile, while on the opengl layer it means undefined behaviour. this also fixes a problem with the target-colorspace-hint option, since moltenvk needs to set this colour space itself for a proper hint. both mechanism would compete to set the colour space. --- video/out/mac_common.swift | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/video/out/mac_common.swift b/video/out/mac_common.swift index dd8d80ceea..211c535811 100644 --- a/video/out/mac_common.swift +++ b/video/out/mac_common.swift @@ -24,8 +24,6 @@ class MacCommon: Common { var swapTime: UInt64 = 0 let swapLock: NSCondition = NSCondition() - var needsICCUpdate: Bool = false - @objc init(_ vo: UnsafeMutablePointer) { let newlog = mp_log_new(vo, vo.pointee.log, "mac") super.init(newlog) @@ -65,7 +63,7 @@ class MacCommon: Common { } windowDidResize() - needsICCUpdate = true + updateICCProfile() } return true @@ -93,11 +91,6 @@ class MacCommon: Common { swapTime = 0 swapLock.unlock() } - - if needsICCUpdate { - needsICCUpdate = false - updateICCProfile() - } } func updateRenderSize(_ size: NSSize) { @@ -146,13 +139,7 @@ class MacCommon: Common { flagEvents(VO_EVENT_AMBIENT_LIGHTING_CHANGED) } - @objc override func updateICCProfile() { - guard let colorSpace = window?.screen?.colorSpace else { - log.sendWarning("Couldn't update ICC Profile, no color space available") - return - } - - layer?.colorspace = colorSpace.cgColorSpace + override func updateICCProfile() { flagEvents(VO_EVENT_ICC_PROFILE_CHANGED) } @@ -166,7 +153,7 @@ class MacCommon: Common { } override func windowDidChangeScreenProfile() { - needsICCUpdate = true + updateICCProfile() } override func windowDidChangeBackingProperties() {