Progress was made in persuading 3D graphics to work in Linux on Apple’s M1 over the weekend – in the form of a blue rabbit.
Alyssa Rosenzweig, who is leading development of the Panfrost and Asahi Linux graphics drivers, showed off her continuing work in a succession of tweets involving Glmark2, an OpenGL ES 2.0 graphics performance benchmark tool for GNU/Linux, successfully rendering the bunny in 3D detail..
Woo, got it!!!
if you don’t dance when you fix your bugs, I don’t know what you’re doing programming~ pic.twitter.com/g6RLyytfuw
— Alyssa Rosenzweig (@alyssarzg) May 9, 2022
It’s impressive considering the lack of official support from Apple. It’s therefore up to Rosenzweig and the community to reverse-engineer the hardware with the goal of creating drivers.
Rosenzweig opened up to The Register about the challenges involved.
“The GPU driver development is in the ‘reverse-engineering and experimentation’ phase,” she said. “For the time being, our primary goal is to understand the hardware so we can later build proper OpenGL, Vulkan, and OpenCL drivers.
“Reverse-engineering and driver development do feed into each other, so over the past year, I’ve been developing a simple OpenGL driver to validate hypotheses about the hardware. This initial driver supports functionality for basic graphics acceleration: desktops, web browsers, and simple 3D games.
“Supporting sophisticated workloads like AAA games requires significantly more time and effort.”
An early Alpha of Asahi Linux arrived in March and we were able to bring up a desktop on an M1 Mac with surprising ease.
The “customized remix of Arch Linux Arm” performed well, even on our relatively low-spec Mac Mini, but there were some notable omissions. Bluetooth didn’t work, Wi-Fi was temperamental, and sound was highly intermittent.
However, despite the visuals, there was a lack of GPU acceleration.
“Hardware graphics stacks divide neatly into a kernel driver and a userspace driver,” explained Rosenzweig. “The (Linux or macOS) kernel driver provides a safe abstraction for the hardware to the untrusted userspace. The userspace (Mesa or Metal) implements a graphics API (OpenGL, Vulkan, or Metal), translating high-level API calls to low-level hardware packets submitted to the kernel.
“Userspace requires the bulk of the work, as modern graphics APIs are massive and require a hardware-specific shader compiler.
“For graphics acceleration on Linux, we need both AGX kernel and userspace drivers. I’m focusing on the userspace driver, testing my work against the macOS kernel pending Linux kernel support.
“Other Asahi Linux developers are working on the kernel in parallel.”
There remains a while to go yet. “When our work converges,” said Rosenzweig, “we’ll get a working Linux graphics stack for the Apple M1.”
If fixing bugs to get Glmark2 showing signs of life merits some dancing, that working graphics stack will require a full-on penguin party. ®