From faf0964746400db3e7f139d1b829ab41024e4ee5 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 23 Jul 2026 23:02:21 +0200 Subject: [PATCH] Detect fragile GL driver by Metal GPU family instead of device model --- Yattee/Services/Player/MPV/MPVClient.swift | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Yattee/Services/Player/MPV/MPVClient.swift b/Yattee/Services/Player/MPV/MPVClient.swift index 3fa99acd..fe72e5bf 100644 --- a/Yattee/Services/Player/MPV/MPVClient.swift +++ b/Yattee/Services/Player/MPV/MPVClient.swift @@ -7,6 +7,7 @@ import Foundation import Libmpv +import Metal #if os(macOS) import OpenGL.GL @@ -191,16 +192,14 @@ final class MPVClient: @unchecked Sendable { // MARK: - Device Detection #if os(tvOS) - /// Apple TV HD (AppleTV5,3, A8): its GL driver deadlocks on the float - /// texture uploads mpv's renderer defaults to (issue #956). + /// A8-class (PowerVR Series6XT) and older GPUs: their GL driver deadlocks on + /// the float texture uploads mpv's renderer defaults to (issue #956). + /// Keyed on the Metal GPU family rather than the device model so every device + /// with this GPU generation is covered, e.g. Apple TV HD (AppleTV5,3, A8). + /// If an A10-class device ever shows the same hang, bump the check to .apple4. static let hasFragileGLDriver: Bool = { - var systemInfo = utsname() - uname(&systemInfo) - let machine = withUnsafeBytes(of: systemInfo.machine) { rawPtr -> String in - guard let base = rawPtr.baseAddress else { return "" } - return String(cString: base.assumingMemoryBound(to: CChar.self)) - } - return machine == "AppleTV5,3" + guard let device = MTLCreateSystemDefaultDevice() else { return true } + return !device.supportsFamily(.apple3) // .apple2 = A8/A8X, .apple1 = A7 }() #endif