From 1ade0bd279bfff6544712ed42afd84f7de2e9a56 Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 21 Mar 2024 17:18:31 +0100 Subject: [PATCH 1/2] Disable hardware acceleration on mac app store when amd switchable is true --- apps/desktop/src/main.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index 75f9e22a87e..a8b395cda7e 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; @@ -321,6 +322,18 @@ 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 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; + + if (badGpu) { + this.logService.warning( + "Bad GPU detected, hardware acceleration is disabled for compatibility", + ); + app.disableHardwareAcceleration(); + } } } } From b1185fae18c9e0488e0eea3388ad46b310415a9a Mon Sep 17 00:00:00 2001 From: Hinton Date: Thu, 21 Mar 2024 17:23:33 +0100 Subject: [PATCH 2/2] Only apply fix on iMacs --- apps/desktop/src/main.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/desktop/src/main.ts b/apps/desktop/src/main.ts index a8b395cda7e..7ca7f3976fc 100644 --- a/apps/desktop/src/main.ts +++ b/apps/desktop/src/main.ts @@ -323,12 +323,13 @@ export class Main { this.logService.warning("Hardware acceleration is disabled"); app.disableHardwareAcceleration(); } else if (isMacAppStore()) { - // We disable hardware acceleration on Mac App Store builds with amd switchable GPUs due to: + // 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 (badGpu) { + if (isImac && badGpu) { this.logService.warning( "Bad GPU detected, hardware acceleration is disabled for compatibility", );