From f70639d792b5e28591dd13914153af75ca1a63e1 Mon Sep 17 00:00:00 2001 From: Oscar Hinton Date: Fri, 22 Mar 2024 14:31:36 +0100 Subject: [PATCH] [PM-6983] Disable hardware acceleration for bad GPUs (#8427) * Disable hardware acceleration on mac app store when amd switchable is true * Only apply fix on iMacs --- apps/desktop/src/main.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index e0d4dbfb03..bae1cc0c06 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -45,6 +45,7 @@ import { ElectronStateService } from "./platform/services/electron-state.service import { ElectronStorageService } from "./platform/services/electron-storage.service"; import { I18nMainService } from "./platform/services/i18n.main.service"; import { ElectronMainMessagingService } from "./services/electron-main-messaging.service"; +import { isMacAppStore } from "./utils"; export class Main { logService: ElectronLogMainService; @@ -322,6 +323,19 @@ export class Main { if (!hardwareAcceleration) { this.logService.warning("Hardware acceleration is disabled"); app.disableHardwareAcceleration(); + } else if (isMacAppStore()) { + // We disable hardware acceleration on Mac App Store builds for iMacs with amd switchable GPUs due to: + // https://github.com/electron/electron/issues/41346 + const gpuInfo: any = await app.getGPUInfo("basic"); + const badGpu = gpuInfo?.auxAttributes?.amdSwitchable ?? false; + const isImac = gpuInfo?.machineModelName == "iMac"; + + if (isImac && badGpu) { + this.logService.warning( + "Bad GPU detected, hardware acceleration is disabled for compatibility", + ); + app.disableHardwareAcceleration(); + } } } }