Collabora has been working on the Panfrost open source GPU driver for Arm Mali Bifrost and Midgard GPU for several years, and has even gained official support from Arm.
But apparently this media does not include the documentation for the Mali-G78 GPU and other recent Arm Valhall Mali GPUs, as the company recently reverse-engineered the Mali-G78 for about a month before releasing the update. Valhall instruction set documentation (PDF).
Other results of reverse engineering include a Description of the XML architecture which can be parsed by programs, as well as a Valhall assembler and disassembler which were used as a reverse engineering aid.
Besides the Mali-G78 “Borr” GPU, the work will be useful for other Valhall GPUs, notably Mali-G77 “TryM”, Mali-G57 “Natt-A / B”, Mali-G68 “Ottr” and Mali-G78AE “Borr -AE” for automotive and industrial applications.
Alyssa Rosenzweig explains the work of Collabora based on the international edition of the Samsung Galaxy S21 phone powered by the Samsung Exynos 2100 system on chip with a Mali-G78 MP14 GPU. She noted that reverse-engineering work on Android is more difficult than with Linux, but it’s the only option right now.
The team managed to identify each layer with an envelope library that empties each shader executed to reverse engineer the new instruction set and develop a disassembler. They got help from some public information, including a article an Anandtech which revealed some useful information about Valhall:
- Chain based, like Bifrost, but with 16 threads per chain instead of Bifrost 4/8.
- Isomorphic to Bifrost at the instruction level (“operational equivalence”).
- Encoded regularly.
- Flat, without Bifrost clause and tuple packaging.
- 16 KB instruction cache, containing 2048 instructions
Getting the instruction set documentation, along with the assembler and disassembler, is the first step in getting Panfrost to support Valhall GPUs. Alyssa also notes that Mali G78 makes changes beyond the instruction set with particularly different data structures to reduce the overhead of the Vulkan driver, but luckily many data structures can simply be adapted from Bifrost requiring little. changes to the Mesa driver. She also invites people / companies designing a Linux compatible device with Valhall GPU to get in touch with Collabora to help them get an open source Linux driver.
To verify Collabora’s message for the full story.
Jean-Luc started CNX Software in 2010 part-time, before stepping down as head of software engineering and starting writing daily news and reviews full-time later in 2011.