WindowServer is eating lots of CPU, can't work out why

Solution 1:

I have DELL UP3216Q external monitor. I had the same problem with "surface is not detached, CoreDisplay is detached" errors being spammed when I run log stream --predicate '(process == "WindowServer")' --debug. I'm using the external monitor with the Mac lid closed.

The errors stopped when I changed System Preferences > Displays > Display scaling settings so that scaling is not maximum on the external monitor. If I change the scaling back to maximum (more space) the errors start again on logging mode.

WindowServer CPU use was reduced slightly, but it is still around 30 %. Atleast the fan stopped spinning so fast.

Solution 2:

Answering my own question with what I've learned:

  • HiDPI resolutions eliminate the error message from the logs. SetResX has a HiDPI resolution for my monitor's native res - using that looks the same as the "more space" scaling, but without the errors. This reduces CPU use and heat a bit.

  • As dumb as it sounds, "clamshell mode" (ie, shutting the lid) helps quite a bit. I guess it helps not having to render the built-in screen

WindowServer is still using quite a bit more CPU than I'd like, but those two things have reduced it a fair bit.

Other things that I've seen others have success with but haven't been able to confirm myself: Using charging ports on the right rather than left reduces heat, and tweaking refresh rates by as little as 0.1Hz has dramatically reduces energy usage for some people.

EDIT: Clamshell mode seems to let me use the monitor's native res without using SetResX without causing the errors. I think this is down to having the machine render standard and HiDPI resolutions at the same time.

Solution 3:

Try https://chromeisbad.com/. In my case Google Chrome was the issue and uninstalling it (and, most important, Keystone) solved all my problems.

Solution 4:

I, too, have run into consistently high WindowServer CPU usage since upgrading to Big Sur (a few weeks ago).

After upgrading to Big Sur I ran into generally sluggish window management / movement, and macOS feeling like it was "very tired", and have looked for answers for some time. Today things got really slow, with missed keystrokes while typing into iTerm, and WindowServer CPU usage running at 95% consistently. Reboots "solved" the problem for a while, but always after a short time things got slow again.

Then I found this article and the link to "Chrome is Bad". I followed the instructions (in Chrome is Bad) to remove Chrome and Keystone to the letter, rebooted, and switched to Brave.

The difference is literally night and day. Switching between apps / windows is now, once again, snappy. No more dropped keystrokes in iTerm and other apps. Moving windows from the internal display to my external (4K Dell) monitor is smooth as butter, where before it would become jerky as windows moved onto the external display.

I am still struggling to believe that Chrome / Keystone are the culprits—since neither shows high CPU when the problems show themselves—but I am (very) happy with the result.

In short, it will take a great deal for me to switch back to Chrome now, especially since all of my Chrome extensions work flawlessly in Brave.