Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-6983] Disable hardware acceleration for bad GPUs #8427

Merged
merged 2 commits into from
Mar 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/desktop/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
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";

Check warning on line 48 in apps/desktop/src/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/main.ts#L48

Added line #L48 was not covered by tests

export class Main {
logService: ElectronLogMainService;
Expand Down Expand Up @@ -321,6 +322,19 @@
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");

Check warning on line 328 in apps/desktop/src/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/main.ts#L328

Added line #L328 was not covered by tests
const badGpu = gpuInfo?.auxAttributes?.amdSwitchable ?? false;
const isImac = gpuInfo?.machineModelName == "iMac";

if (isImac && badGpu) {
this.logService.warning(

Check warning on line 333 in apps/desktop/src/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/main.ts#L333

Added line #L333 was not covered by tests
"Bad GPU detected, hardware acceleration is disabled for compatibility",
);
app.disableHardwareAcceleration();

Check warning on line 336 in apps/desktop/src/main.ts

View check run for this annotation

Codecov / codecov/patch

apps/desktop/src/main.ts#L336

Added line #L336 was not covered by tests
}
}
}
}
Loading