Skip to content

Conversation

@avarayr
Copy link
Contributor

@avarayr avarayr commented Sep 25, 2025

Description of Change

fixes: #48311

  • stop overriding the private _cornerMask selector in ElectronNSWindow
  • remove the cornerMask plumbing that applied a custom mask image to vibrant views
  • rely on AppKit’s default shadow rendering, which fixes the WindowServer GPU spike on macOS 26 Tahoe when shadows are enabled

Rationale:

If AppKit uses method implementation identity to decide whether the window mask is static, then a subclass override (even if it calls super) will change that identity and force the compositor to treat the mask as dynamic.

Method-IMP sentinel check

AppKit asks: “is _cornerMask implemented by the standard theme frame?” via class_getMethodImplementation / method_getImplementation.
If yes → treat masks as canonical and use a shared cache keyed by class/selector;
if no → mark mask as custom and re-render per-window. → persistent high GPU load

Backwards-compat concerns:

I see no reason to override _cornerMask as the corner radius masking is already covered by NSVisualEffectView setMaskImage, rendering NO visual difference without _cornerMask override + vibrancy

Checklist

Release Notes

Notes: Fixed excessive WindowServer GPU usage on macOS Tahoe 26.

@welcome
Copy link

welcome bot commented Sep 25, 2025

💖 Thanks for opening this pull request! 💖

Semantic PR titles

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Commit signing

This repo enforces commit signatures for all incoming PRs.
To sign your commits, see GitHub's documentation on Telling Git about your signing key.

PR tips

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened recently label Sep 25, 2025
… GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
@deepak1556 deepak1556 added semver/patch backwards-compatible bug fixes target/37-x-y PR should also be added to the "37-x-y" branch. target/38-x-y PR should also be added to the "38-x-y" branch. target/39-x-y PR should also be added to the "39-x-y" branch. labels Sep 25, 2025
@jkleinsc
Copy link
Member

@avarayr can you rebase your PR to pull in the latest from main. That will pull in #48205 which will fix the CI failures.

@MarshallOfSound
Copy link
Member

Tested this and validated the bug from N years ago is no longer present in modern macOS versions (frameless vibrant windows not being rounded)

Copy link
Member

@VerteDinde VerteDinde left a comment

Choose a reason for hiding this comment

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

@avarayr Thanks so much for all of your time and effort digging into this issue - I'm sorry for the trouble, the Electron maintainers really appreciate you doing such a deep dive on this fairly complex issue and putting up this fix 🙇‍♀️

@nikwen
Copy link
Member

nikwen commented Sep 26, 2025

Thank you, @avarayr and @fredizzimo, for debugging this and finding a solution!

@VerteDinde VerteDinde merged commit 3a7c6dd into electron:main Sep 26, 2025
106 of 107 checks passed
@welcome
Copy link

welcome bot commented Sep 26, 2025

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk
Copy link

release-clerk bot commented Sep 26, 2025

Release Notes Persisted

Fixed excessive WindowServer GPU usage on macOS Tahoe 26.

trop bot added a commit that referenced this pull request Sep 26, 2025
…indowServer GPU load (#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.

Co-authored-by: avarayr <[email protected]>
trop bot added a commit that referenced this pull request Sep 26, 2025
…indowServer GPU load (#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.

Co-authored-by: avarayr <[email protected]>
trop bot added a commit that referenced this pull request Sep 26, 2025
…indowServer GPU load (#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.

Co-authored-by: avarayr <[email protected]>
@trop
Copy link
Contributor

trop bot commented Sep 26, 2025

I have automatically backported this PR to "38-x-y", please check out #48398

@trop trop bot added in-flight/38-x-y and removed target/38-x-y PR should also be added to the "38-x-y" branch. labels Sep 26, 2025
@nikwen
Copy link
Member

nikwen commented Oct 23, 2025

Was there a fiddle that reproduces the issue?

@tmm1 We do not know what triggers this issue on someone's machine. It only happens for a small percentage of users. (A small percentage of Mac users is still a large number, of course.) None of our maintainers have been able to reproduce it.

TheCommieAxolotl pushed a commit to TheCommieAxolotl/electron that referenced this pull request Nov 2, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
max-horvath added a commit to max-horvath/hyper that referenced this pull request Nov 13, 2025
Upgrades Electron from 34.5.1 to 38.6.0 to resolve excessive WindowServer
GPU usage on macOS 26 (Sequoia). This issue was caused by Electron's
override of the private _cornerMask API, which forced the compositor to
treat window masks as dynamic rather than static, resulting in persistent
high GPU load.

Changes:
- Upgrade electron: 34.5.1 → 38.6.0
- Upgrade electron-mksnapshot: 34.5.1 → 38.6.0
- Upgrade @electron/rebuild: ^3.7.1 → ^3.7.2
- Upgrade node-abi: ^3.67.0 → ^3.81.0 (required for Electron 38 support)

The fix was introduced in Electron 36.9.2, 37.6.0, 38.2.0, and all later
versions. We're upgrading to 38.6.0 as it's the latest stable version
compatible with Node 20.11.0.

Fixes: electron/electron#48376
nilayarya pushed a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
…indowServer GPU load (electron#48376)

fix: macOS stop overriding private cornerMask API to fix WindowServer GPU load spike

Electron fetched a custom `_cornerMask` for `ElectronNSWindow` to smooth
vibrancy corners. On macOS 15 (Tahoe) that private hook forces the window
shadow to be rendered from a fully transparent surface, causing the
WindowServer GPU load regression. Remove the `cornerMask` property and
the `_cornerMask` override so we stay on Apple’s default shadow path.
philip-peterson added a commit to quine-global/hyper that referenced this pull request Jan 4, 2026
* Fix macOS 26 GPU performance issue by upgrading to Electron 38

Upgrades Electron from 34.5.1 to 38.6.0 to resolve excessive WindowServer
GPU usage on macOS 26 (Sequoia). This issue was caused by Electron's
override of the private _cornerMask API, which forced the compositor to
treat window masks as dynamic rather than static, resulting in persistent
high GPU load.

Changes:
- Upgrade electron: 34.5.1 → 38.6.0
- Upgrade electron-mksnapshot: 34.5.1 → 38.6.0
- Upgrade @electron/rebuild: ^3.7.1 → ^3.7.2
- Upgrade node-abi: ^3.67.0 → ^3.81.0 (required for Electron 38 support)

The fix was introduced in Electron 36.9.2, 37.6.0, 38.2.0, and all later
versions. We're upgrading to 38.6.0 as it's the latest stable version
compatible with Node 20.11.0.

Fixes: electron/electron#48376

* Use optional chaining

Signed-off-by: Philip Peterson <[email protected]>

---------

Signed-off-by: Philip Peterson <[email protected]>
Co-authored-by: Philip Peterson <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged/36-x-y PR was merged to the "36-x-y" branch. merged/37-x-y PR was merged to the "37-x-y" branch. merged/38-x-y PR was merged to the "38-x-y" branch. merged/39-x-y PR was merged to the "39-x-y" branch. semver/patch backwards-compatible bug fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Electron-based apps cause a huge system-wide lag on macOS 26

10 participants