AAA Linux Gaming on ARM64 Mac Hardware, Now a Reality
Things are moving fast for Asahi Linux, the Linux distribution for ARM64-based Macs, and just last month there was a long post from Rosenzweig about the fact that AAA gaming is now at reach on the M1 ARM64 hardware from Apple.
Games are typically x86 Windows binaries that use DirectX for rendering. On the Steam Deck and other x86 based hardware, Proton handles the translation of X86 Windows calls to X86 Linux userspace calls, and the conversion of DirectX calls to Vulkan for the graphics API.
Things are also progressing on the ARM space to make the same kind of translation work across processor architectures. To make this possible on ARM, you need another piece: FEX, or Box64. Since Valve is backing FEX, and the Asahi development, Asahi uses FEX instead of Box64.
There’s one issue when you move to ARM64 architecture on the Mac hardware: page size. The x86 Linux builds expect 4K sized pages, but Apple hardware relies on 16K pages.
Page Sizes ?
What’s page sizes anyway? In computing, the term “page size” refers to the amount of memory (RAM) that an operating system can access as a contiguous block or unit of storage. It’s also known as the “memory page size”. In simple terms, each process is divided into fixed-size blocks called pages.
The most common page sizes are:
- 4 KB (4096 bytes): This was the original and widely used page size in early operating systems.
- 8 KB (8192 bytes) or more: Some modern systems use larger page sizes to improve performance, especially on 64-bit architectures.
When a process accesses memory that is not already loaded into RAM (i.e., it’s paged out), the system needs to retrieve the required pages from disk storage and swap them in. The size of these pages affects how efficiently this swapping occurs.
In Linux, the kernel uses a technique called “paging” or “swapping” to manage memory. So in practice, a larger page size means fewer pages are needed to cover the same amount of physical RAM, reducing overhead and increasing performance.
In modern Linux systems, the default page size is typically 4 KB, which is used by most applications. But you can’t just use any page size you want. The kernel must ensure that both user-space code and data are aligned to match the page size.
Linux can’t mix page sizes between processes. This would cause insufficient alignment of page allocations, and break the running application. The trick here on the Mac ARM64 architecture is to virtualize another ARM Linux kernel with a different page size. So the Asahi project relies on muvm to handle the page size conversion seamlessly. This way, the hardware talks to the kernel using 16k, and the client side applications converse with 4k page sizes as they would expect.
Vulkan drivers
On the Mac, there’s no discrete GPU hardware, so you can’t rely on AMD or Nvidia drivers to handle the Vulkan graphics support. The M1 integrates an Apple’s eight-core GPU, split into 16 execution units, which each contain 8 arithmetic logic units (ALUs). In total, the M1 GPU contains up to 128 EUs and 1024 ALUs, which is said to have a max floating point (FP32) performance of 2.6 TFLOPs.
The M1 Pro has an even better hardware, with a 16-core GPU, and the M1 Max takes things to the top with a 32-core GPU. The M1 Max GPU can in theory deliver 10.4 TFLOPs. And so on with the M1 Ultra, that has a 48 or 64 core GPY and up to 21 TFLOPs of performance with FP32. Since then the M2 and M3 versions of the M-series were also released, and bring further improvement in performance and energy consumption to the architecture.
Rosenzweig has developed a Vulkan Driver, HoneyKrisp in April 2024 to support the Apple Hardware found in M1 chips. It is a fully conformant Vulkan 1.3 driver, and what’s really cool is that it was not written completely from scratch but re-used the foundation of NVK made to create a fully open Nvidia driver. Following that driver release, DXVK support was also added, including additional work for tessellation and geometry shaders, which are not properly supported by the M1 hardware.
DirectX11 games therefore work out of the box, with very decent performance. DirectX12 is not fully supported as of now, as some of the more advanced features like sparse texturing (textures that do not fit completely in memory because they are just too large) are not baked in yet.
Results
You can see below a short video compiling some short clips of games running on the Mac hardware using the above stack:
These clips are just short extracts from Andrew Sai’s video, so check it out if you want a longer version with more games covered.
Why does it matter?
The landscape of GPUs available for ARM is changing very quickly. This year Qualcomm released their X Elite chip that has DirectX12 support out of the box. The GPU support on Linux is also in progress, as indicated in Phoronix. It’s supposed to be able to deliver 4.6 TFLOPs, which is definitely weaker than the M1 and following variants, but much more capable than anything seen on ARM hardware outside of Apple until now.
Ultimately this brings us closer to true freedom to play games on virtually any architecture in the mid-term. This also has implications for a future edition of the Steam Deck, potentially running on an ARM64 chip instead of the usual x86 architecture. The fact that Valve is sponsoring the work on Asahi Linux is certainly not innocent. Valve may be playing the long game to keep their options open in case ARM64 end up overtaking x86 in the future in terms of performance and energy consumption, especially for portable devices with integrated GPUs like the X elite. Maybe 1 to 2 years down the road, we will have something that is good enough to run AAA games well enough and also have a very long battery life.
More Resources
Apple M-series laptops are fairly expensive on the higher end (M1 pro, M2 pro, etc…), so whether this is an option for you in the end depends mostly on your risk tolerance (to deal with imperfections and the lack of maturity of the hardware support, while things are constantly improving) and the size of your wallet.
If you want to know more on this topic:
- Recent presentation that goes in more details by Alyssa Rosenzweig
- Asahi Linux Fedora explains what you can expect from this distribution
- The AsahiLinux Reddit community if you are looking for help or simply want to be aware of the latest news
- SnapDragon X Elite on Linux - a recent video explaining the state of an Ubuntu install on this kind of hardware. It’s still early days, very rough.