hn.today

Building a Linux GPU Driver for the M4 Mac Mini in One Month

codyho.dev149 points89 comments
Screenshot of Building a Linux GPU Driver for the M4 Mac Mini in One Month

A team built a fully OpenGL ES 3.0-compliant GPU driver for the M4 Mac Mini and MacBook Neo in roughly a month, producing enough functionality to run WebGL in Chrome and Firefox and to render Minecraft at roughly 200 fps. The work involved clean-room reverse engineering of Apple’s AGX GPU: live probing via a custom hypervisor to capture hardware traces, reconstructing the complex RTKit firmware ABI, and implementing a complete user-space stack (custom IR/shader compiler, command stream builder) plus a Linux kernel driver that talks to the firmware rather than the hardware directly. All development avoided inspecting Apple binaries; traces and reproducible experiments were published so others can verify provenance.

Technically, the A18 Pro firmware ABI proved significantly more complicated than M1/M2 (about 1.5× more structs, twice the pointers, and a more involved submission model), which forced careful capture/replay strategies. Major hurdles were dynamic firmware state after boot, huge compute traces (initially 336 MB) solved by booting single-user and running a minimal Metal compute capture, and finicky partial renders caused by tiled vertex buffer overflow requiring save/resume support. Large-language models (Codex, Claude) accelerated repetitive RE and prototyping, using the hypervisor for systematic debugging, but human guidance was essential. The driver isn’t yet consumer-ready, but the implementation and experiments are available for verification and further development.

Read on codyho.dev89 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Security

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.