HeadlinesBriefing favicon HeadlinesBriefing.com

Building a GPU Driver for M4 Mac in One Month

Hacker News •
×

Niklas and I built a fully OpenGL ES 3.0 compliant GPU driver for the M4 Mac Mini and MacBook Neo in about a month, a process that normally takes years. The driver runs Chrome and Firefox with WebGL and Minecraft at 200fps. It involved reverse engineering the AGX GPU's firmware ABI and user-space components in a clean room manner.

Previously, I built a hypervisor to reverse engineer macOS. Our goal was to implement conformant OpenGL (and soon Vulkan) drivers. We reverse engineered the M4, A18 Pro, and M5 user space, built a custom IR/shader compiler, command stream builder, and a full Linux kernel driver. We only used hardware traces and our own shaders, treating Apple blobs as opaque.

The kernel driver talks to GPU firmware running RTKit, not directly to hardware. The firmware ABI was the most annoying part, with shared structs interleaving firmware and host fields. Asahi Lina figured this out for M1/M2 over grueling 12-hour days.

The code is not ready for end users, but we aim to get it to them soon.