Skip to content

fix(mac): disable unstable Skia Graphite renderer - #10457

Closed
OrcaWin wants to merge 1 commit into
mainfrom
rendering-issues
Closed

OrcaWin wants to merge 1 commit into
mainfrom
rendering-issues

Conversation

@OrcaWin

@OrcaWin OrcaWin commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • disable Skia Graphite on macOS to prevent stale or corrupted compositor tiles after idle and app switching
  • preserve hardware acceleration, GPU compositing, and terminal WebGL through the Ganesh fallback
  • cover the Darwin-only switch and unchanged Linux/Windows behavior

VS Code traced the same rendering corruption to Graphite recording failures and shipped this targeted workaround: microsoft/vscode#284162

Testing

  • pnpm exec vitest run --config config/vitest.config.ts src/main/startup/configure-process.test.ts
  • pnpm exec oxlint src/main/startup/configure-process.ts src/main/startup/configure-process.test.ts
  • pnpm run typecheck:node
  • pnpm run check:max-lines-ratchet
  • git diff --check

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Updates enableMainProcessGpuFeatures to append the disable-skia-graphite Electron command-line switch on macOS. Adds tests covering macOS, Linux, and Windows behavior, verifying that the switch is added only on macOS and that hardware acceleration remains enabled on all tested platforms.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description covers summary and testing, but omits required Screenshots, AI Review Report, Security Audit, and Notes sections. Add the missing template sections, including screenshots or "No visual change", an AI review report, a security audit, and notes.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the PR's main change: disabling Skia Graphite on macOS.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d53b17a8-53ba-4646-8231-4c01a047d88a

📥 Commits

Reviewing files that changed from the base of the PR and between e133d93 and 851f683.

📒 Files selected for processing (2)
  • src/main/startup/configure-process.test.ts
  • src/main/startup/configure-process.ts

Comment on lines +405 to +410
delete process.env.ORCA_E2E_USER_DATA_DIR
vi.mocked(app.disableHardwareAcceleration).mockClear()

for (const platform of ['darwin', 'linux', 'win32'] as const) {
setPlatform(platform)
vi.mocked(app.commandLine.appendSwitch).mockClear()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Restore process-global test state.

This test deletes ORCA_E2E_USER_DATA_DIR and leaves process.platform set to win32, so later tests can inherit a fake platform or altered E2E configuration. Capture the original values and restore them in finally/afterEach, including when an assertion fails.

Proposed cleanup
+    const originalPlatform = process.platform
+    const originalUserDataDir = process.env.ORCA_E2E_USER_DATA_DIR
+
+    try {
       delete process.env.ORCA_E2E_USER_DATA_DIR
       // existing loop and assertions
+    } finally {
+      setPlatform(originalPlatform)
+      if (originalUserDataDir === undefined) {
+        delete process.env.ORCA_E2E_USER_DATA_DIR
+      } else {
+        process.env.ORCA_E2E_USER_DATA_DIR = originalUserDataDir
+      }
+    }

Also applies to: 421-422

@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #10643 — same one-line fix, rebased onto current main (this branch was 50 commits behind), plus measured A/B evidence that the switch actually flips the backend (GraphiteDawnMetal → GaneshGL), and perf/security analysis showing no degradation.

Note for anyone looking at the red verify check here: that failure is pre-existing and unrelated to this change — it's the release-workflow contract test (package-electron-runtime-contract.test.mjs), which fails identically on pristine origin/main.

Leaving this open for @OrcaWin to close (original authorship) — happy to close it myself if preferred.

@nwparker

Copy link
Copy Markdown
Contributor

Superseded by #10643, which merged to main as 2e64677.

I took this over on a Mac, rebased onto current main, and added the empirical evidence this needed before shipping:

  • Mechanism proved, not just asserted — probed app.getGPUInfo('complete'): without the switch the backend is GraphiteDawnMetal / skia_graphite: enabled_on; with it, GaneshGL / disabled_off.
  • No perf regression — alternating A/B runs: raster within noise (9.2–9.6 ms median both ways), WebGL identical (~2000 iters/sec), frame pacing identical (60.1 fps, p99 17.6 ms), and Ganesh was ~10 MB lighter with no slower load.
  • No security regression — this selects a backend inside the existing GPU sandbox; categorically unlike --no-sandbox/--disable-gpu-sandbox. All GPU features stay enabled, and the switch is idempotent.
  • Hardware acceleration stays on — Ganesh is still fully GPU-accelerated. The macOS-only gate keeps Windows/Linux provably untouched.

Worth noting: VS Code shipped this identical switch for this identical bug (microsoft/vscode#288141, merged Jan 2026).

Thanks for the original diagnosis and patch — the darwin-only scoping came straight from here. Closing this one out in favour of the merged PR.

@nwparker

Copy link
Copy Markdown
Contributor

Superseded — this exact fix landed on main in #10643 (merged 2026-07-26).

main now carries the same disable-skia-graphite switch guarded by process.platform === 'darwin' inside enableMainProcessGpuFeatures(), plus the same disables Skia Graphite only on macOS without disabling hardware acceleration test from this PR. #10646 then added a follow-up test pinning the win32-only GPU-fallback invariant the macOS fix depends on.

Verified on origin/main @ d8af1d2:

src/main/startup/configure-process.ts:269:    app.commandLine.appendSwitch('disable-skia-graphite')
src/main/startup/configure-process.test.ts: 'disables Skia Graphite only on macOS...' present

The diff here is a subset of what shipped, so there is nothing left to merge. Thanks for the fix and the diagnosis — closing as already-landed, not as rejected.

@nwparker nwparker closed this Jul 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants