Collabora has been working on Panfrost open-source GPU driver for Arm Mali Bifrost and Midgard GPU for several years, and even getting official support from Arm.
But apparently, that support does not include documentation for Mali-G78 GPU and other recent Arm Valhall Mali GPUs, as the company recently reverse-engineered Mali-G78 for about a month before releasing the documentation on the Valhall instruction set (PDF).
Besides Mali-G78 “Borr” GPU, the work will be useful for other Valhall GPUs include Mali-G77 “TryM’, Mali-G57 “Natt-A/B”, Mali-G68 “Ottr”, and Mali-G78AE “Borr-AE” for automotive & industrial applications.
Alyssa Rosenzweig explains Collabora’s work that was based on the International edition of the Samsung Galaxy S21 phone powered by Samsung Exynos 2100 system-on-chip with a Mali-G78 MP14 GPU. She noted reverse-engineering work on Android, is harder than with Linux, but that’s the only option at this time.
The team managed to identify each layer with a wrapper library that dumps every shader executed to reverse-engineer the new instruction set and develop a disassembler. They did get help from some public information notably an article an Anandtech that revealed useful information about Valhall:
- Warp-based, like Bifrost, but with 16 threads per warp instead of Bifrost’s 4/8.
- Isomorphic to Bifrost on the instruction level (“operational equivalence”).
- Regularly encoded.
- Flat, lacking Bifrost’s clause and tuple packaging.
- 16KB instruction cache, holding 2048 instructions
Getting the instruction set documentation, as well as assembler and disassembler, are the first step into getting Panfrost to support Valhall GPUs. Alyssa also notes that Mali G78 does bring changes beyond the instruction set with notably different data structures to reduce the Vulkan driver overhead, but luckily many data structures can just be adapted from Bifrost requiring few changes to the Mesa driver. She also invites people/companies designing a Linux-friendly device with Valhall GPU to get into touch with Collabora to help getting an open-source Linux driver..
Check out Collabora’s post for the complete story.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.