苹果M1 GPU解剖,终结。
Dissecting the Apple M1 GPU, the end

原始链接: https://rosenzweig.io/blog/asahi-gpu-part-n.html

## 反向工程苹果M1 GPU:一个成功案例 为了将Linux支持带到苹果的M1芯片,一位开发者从2020年末Asahi Linux发布之初,开始了对定制GPU为期多年的反向工程之旅。项目从一个简单的三角形开始,迅速发展成为一个功能齐全的开源图形堆栈。 在与Asahi Linux团队的共同努力下,该开发者创建了OpenGL和Vulkan驱动程序,实现了与行业标准的完全兼容,甚至超越了苹果的专有驱动程序。这包括解决复杂的特性,如几何着色器模拟。其结果是一个强大的系统,能够通过Proton运行3D游戏,为运行Linux的M1 Mac带来令人惊讶的游戏体验。 随着关键里程碑的达成——符合标准的OpenGL 4.6、Vulkan 1.4和OpenCL 3.0,该项目现在被认为是一个巨大的成功,驱动程序已完全集成到Mesa中。在“赢得”这项挑战后,该开发者现在正转向新的事业,将持续维护和未来开发交到Asahi Linux社区的可靠手中。

一个 Hacker News 的讨论围绕着一位开发者(被认为是女性,可能跨性别)在 Asahi Linux 项目中完成一项为期五年的工作:解构并启用 Apple M1 GPU。用户们对她的工作表示极大的赞赏,承认最初对该项目可行性存在怀疑。 这位开发者已经转到 Intel 担任新职位,专注于开源图形驱动程序,引发了人们对她下一步计划的猜测。一些评论员认为她离开 Asahi Linux 是积极的,认为有才华的人不应该需要逆向工程那些不愿提供文档的公司硬件。总体而言,情绪是压倒性的支持和庆祝这一重大技术成就。 开发者项目报告的链接 ([https://rosenzweig.io/](https://rosenzweig.io/)) 也被分享了。
相关文章

原文
Rosenzweig – Dissecting the Apple M1 GPU, the end

26 Aug 2025

In 2020, Apple released the M1 with a custom GPU. We got to work reverse-engineering the hardware and porting Linux. Today, you can run Linux on a range of M1 and M2 Macs, with almost all hardware working: wireless, audio, and full graphics acceleration.

Our story begins in December 2020, when Hector Martin kicked off Asahi Linux. I was working for Collabora working on Panfrost, the open source Mesa3D driver for Arm Mali GPUs. Hector put out a public call for guidance from upstream open source maintainers, and I bit. I just intended to give some quick pointers. Instead, I bought myself a Christmas present and got to work. In between my university coursework and Collabora work, I poked at the shader instruction set.

One thing led to another. Within a few weeks, I drew a triangle.

In 3D graphics, once you can draw a triangle, you can do anything.

Pretty soon, I started work on a shader compiler. After my final exams that semester, I took a few days off from Collabora to bring up an OpenGL driver capable of spinning gears with my new compiler.

Over the next year, I kept reverse-engineering and improving the driver until it could run 3D games on macOS.

Meanwhile, Asahi Lina wrote a kernel driver for the Apple GPU. My userspace OpenGL driver ran on macOS, leaving her kernel driver as the missing piece for an open source graphics stack. In December 2022, we shipped graphics acceleration in Asahi Linux.

In January 2023, I started my final semester in my Computer Science program at the University of Toronto. For years I juggled my courses with my part-time job and my hobby driver. I faced the same question as my peers: what will I do after graduation?

Maybe Panfrost? I started reverse-engineering of the Mali Midgard GPU back in 2017, when I was still in high school. That led to an internship at Collabora in 2019 once I graduated, turning into my job throughout four years of university. During that time, Panfrost grew from a kid’s pet project based on blackbox reverse-engineering, to a professional driver engineered by a team with Arm’s backing and hardware documentation. I did what I set out to do, and the project succeeded beyond my dreams. It was time to move on.

What did I want to do next?

  • Finish what I started with the M1. Ship a great driver.
  • Bring full, conformant OpenGL drivers to the M1. Apple’s drivers are not conformant, but we should strive for the industry standard.
  • Bring full, conformant Vulkan to Apple platforms, disproving the myth that Vulkan isn’t suitable for Apple hardware.
  • Bring Proton gaming to Asahi Linux. Thanks to Valve’s work for the Steam Deck, Windows games can run better on Linux than even on Windows. Why not reap those benefits on the M1?

Panfrost was my challenge until we “won”. My next challenge? Gaming on Linux on M1.

Once I finished my coursework, I started full-time on gaming on Linux. Within a month, we shipped OpenGL 3.1 on Asahi Linux. A few weeks later, we passed official conformance for OpenGL ES 3.1. That put us at feature parity with Panfrost. I wanted to go further.

OpenGL (ES) 3.2 requires geometry shaders, a legacy feature not supported by either Arm or Apple hardware. The proprietary OpenGL drivers emulate geometry shaders with compute, but there was no open source prior art to borrow. Even though multiple Mesa drivers need geometry/tessellation emulation, nobody did the work to get there.

My early progress on OpenGL was fast thanks to the mature common code in Mesa. It was time to pay it forward. Over the rest of the year, I implemented geometry/tessellation shader emulation. And also the rest of the owl. In January 2024, I passed conformance for the full OpenGL 4.6 specification, finishing up OpenGL.

Vulkan wasn’t too bad, either. I polished the OpenGL driver for a few months, but once I started typing a Vulkan driver, I passed 1.3 conformance in a few weeks.

What remained was wiring up the geometry/tessellation emulation to my shiny new Vulkan driver, since those are required for Direct3D. Et voilà, Proton games.

Along the way, Karol Herbst passed OpenCL 3.0 conformance on the M1, running my compiler atop his “rusticl” frontend.

Meanwhile, when the Vulkan 1.4 specification was published, we were ready and shipped a conformant implementation on the same day.

After that, I implemented sparse texture support, unlocking Direct3D 12 via Proton.

…Now what?

  • Ship a great driver? Check.

  • Conformant OpenGL 4.6, OpenGL ES 3.2, and OpenCL 3.0? Check.

  • Conformant Vulkan 1.4? Check.

  • Proton gaming? Check.

That’s a wrap.

We’ve succeeded beyond my dreams. The challenges I chased, I have tackled. The drivers are fully upstream in Mesa. Performance isn’t too bad. With the Vulkan on Apple myth busted, conformant Vulkan is now coming to macOS via LunarG’s KosmicKrisp project building on my work.

Satisfied, I am now stepping away from the Apple ecosystem. My friends in the Asahi Linux orbit will carry the torch from here. As for me?

Onto the next challenge!

Back to home

联系我们 contact @ memedata.com