1
0
mirror of https://github.com/bitwarden/browser.git synced 2024-11-25 12:15:18 +01:00

[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
This commit is contained in:
Oscar Hinton 2024-03-22 14:31:36 +01:00 committed by GitHub
parent ad588f15bf
commit f70639d792
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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();
}
}
}
}