asmvik / asmvik/yabai

macOS 26.3: WindowManager + yabai dual-manager causing GPU btn_rst

Open
#2,811 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
29.6k
Forks
750
PR merge metrics
No merged PRs in 30d

Description

# macOS 26: WindowManager + yabai 双窗口管理器导致 GPU btn_rst

## 现象
- yabai v7.1.25 + macOS 26.3.1 (Tahoe) + Apple M3
- WindowServer 持续 40-55% CPU(正常值 <10%)
- 截图或大量窗口调整后屏幕冻结 1-3 秒
- 系统诊断确认:GPU 看门狗超时触发强制重置 (`btn_rst`)

## 根因分析
macOS 26 引入了 `WindowManager.app` (`com.apple.WindowManager`) 作为新的窗口策略中间层:

```
macOS 15 以前: App → yabai → WindowServer (单一权威——yabai 修改即最终状态)
macOS 26: App → yabai → WindowManager (策略层) → WindowServer (合成层)
```

**事件放大环:**
```
yabai 移动窗口 → WindowManager 检测到变化 → 可能发出"纠正"事件 →
yabai 检测到纠正 → 再移回去 → WindowManager 再检测 → 循环
→ 每帧走 GPU 合成管线 → 命令队列溢出 → 看门狗超时 → btn_rst
```

## 复现条件
- yabai BSP 布局管理 13 个窗口(12 个可 resize/move)
- `window_shadow = on` 时每次调整触发阴影重绘——GPU 成本从 ~0.1ms 暴涨到 ~2ms/窗口
- 截图操作推了一把已经饱和的 GPU 队列

## 降损措施(已验证)
```bash
yabai -m config window_shadow off # 最大单次改进
# 停用 Hammerspoon (8 个事件钩子——额外的事件源)
```
修复后 WindowServer 从 53.8% 降到 ~42%,无新 btn_rst 发生。

但 42% 仍远高于正常基线 (<10%)——怀疑 WindowManager 和 yabai 的"双主权"问题是剩余部分。

## 诊断证据
系统诊断报告确认了内核级 GPU 重置:
```
/Library/Logs/DiagnosticReports/forceReset-full-2026-07-20-184809.0002.diag
panic(cpu 1 caller 0xfffffe003981876c): btn_rst
OS version: 25D2128 (macOS 26.3.1)
Kernel: Darwin 25.3.0 ARM64_T8122 (Apple M3)
```

## 问题
1. yabai 是否有计划适配 macOS 26 的 WindowManager API?还是 macOS 这边需要等 26.4+ 的 WindowServer 修复?
2. `window_shadow=on` 在 macOS 26 上的 GPU 成本似乎显著高于之前版本——是否与新的 Metal 合成管线有关?
3. 有没有已知的 workaround 可以禁用或降低 WindowManager 的事件反馈?

## 环境
- macOS 26.3.1 · Apple M3 (Mac15,12) · 16GB
- yabai v7.1.25 · skhd (23 热键) · SIP Custom Configuration
- 窗口: 13 个 yabai 管理 · BSP 布局

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Contributor guide

No contributing guide indexed for this repository

Research direction

No source file or test is named. Start by reproducing the reported WindowServer and GPU-reset behavior with the stated macOS, yabai, window count, and shadow settings, then compare it with window_shadow disabled and Hammerspoon stopped. Done would require a confirmed cause and a reproducible workaround or compatibility change.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, macos
Domain
desktop, operating-systems, performance
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.