This library makes it easier to use updated graphics drivers on your smartphone, without root

This library makes it easier to use updated graphics drivers on your smartphone, without root

Smartphone-oriented websites tend to focus only on the latest devices, but a large chunk of users choose not to upgrade their phones for one reason or another. Barring hardware failure, many of these devices may still have years of use ahead of them because, to their owners, they still work just fine. While custom ROMs can keep legacy smartphones alive for ages, it can be a nightmare for the modders to keep things like the camera and graphics drivers up to date without official manufacturer support.

Updating GPU drivers on Android

Unlike the smartphone ecosystem, updating the graphics driver on your PC is something you can always think about. This is possible because of the modular architecture of PC hardware drivers, which allows power users to tinker with closed source driver packages, or even opt for open-source drivers instead of OEM-provided binaries. In the case of Android, however, driver updates generally only come to your phone alongside larger OS updates.

XDA VIDEO OF THE DAY

Updatable GPU drivers can come in handy for fixing bugs, improving graphics performance, or adding new features from OpenGL or Vulkan APIs. Nowadays, smartphones are bigger and faster than ever, making them the perfect vehicle for gaming, hence porting the PC-esque driver design to them does make sense.

Matter of fact, in an effort to modularize Android via Project Treble, Google actually made it possible to wrap the graphics driver set for a particular platform as an app and update it through the Play Store. Since then, several mainstream Android OEMs collaborated with Google and major GPU vendors, including ARM and Qualcomm, to distribute updates for their phones’ GPU drivers independent of larger software releases.

Does the updatable graphics driver design reduce fragmentation?

Yes, to some extent. Nonetheless, a few worrying questions are still left unanswered. First of all, Google’s mechanism doesn’t provide an easy way to substitute the closed-source vendor driver with a third-party open-source offering. You can, of course, manually replace the driver package in the vendor partition of the target device, provided you have root access and somehow get your hands on the necessary files, but that’s not an ideal solution for many.

Next comes the stability-versus-enhancement paradox. Android maintains a hierarchical arrangement when it comes to loading the graphics driver. While one can switch between the factory-installed build and the newer updated release using Developer options => Graphics driver preferences on a per-app basis, it ultimately boils down to the OEM’s decision when to push the graphics driver update. As a result, an end-user can’t utilize bleeding-edge driver builds directly from the SoC maker, as OEMs are still responsible for rolling out the updates.

Android 12 Graphics driver preferences

Enter Adreno Tools

As mentioned earlier, updating GPU drivers is possible with root access, but nothing can beat a non-root method. Thanks to XDA Senior Member bylaws, we now have a genius solution named Adreno Tools that allows on-the-fly GPU driver modifications or replacements on Android — that too without root! The developer’s background of porting Android to the Nintendo Switch certainly played a crucial role in this venture, as the whole project has its origin in Skyline, an open-source, work-in-progress Nintendo Switch emulator for Android.

Fellow Skyline developer Mark “Pixelylon” pitched the idea of runtime drive replacement to bylaws, which eventually materialized into Adreno Tools. Being a rootless library, Adreno Tools can help any regular app to load custom GPU drivers, deal with BCn textures, and redirect file operations for further complex modifications on Qualcomm’s Adreno family of GPUs. It does so by hooking into system libraries and seamlessly swapping in the new driver. Notably, there is no support for Mali GPUs yet.

Since there is no limitation on the origin of the driver, enthusiasts can also load third-party drivers through Adreno Tools. This is particularly useful for those who want to try out Turnip — an open-source Vulkan driver for Qualcomm Adreno graphics hardware that falls under the Freedreno umbrella. For example, AetherSX2, the PlayStation 2 emulator for Android already utilizes Adreno Tools to give end-users the choice to opt for Turnip instead of the OEM driver for better performance.

Adreno Tools on GitHub

How do I benefit from this?

Keep in mind that the Adreno Tools project ships as a software library. It means you can’t find a pre-compiled APK file that magically enables the ability to use an external graphics driver stack throughout the system. Instead, a developer needs to incorporate the library into their project, so that their app can offer the facility of loading updated graphics driver files or a third-party alternative without root access. This is exactly how Skyline and AetherSX2 developers are utilizing Adreno Tools right now.

From an end-user perspective, Adreno Tools alone can’t solve all the limitations of Android’s GPU driver implementation. It is merely a tool for the developer community to bypass some of the biggest obstacles of graphics driver updates on Android devices — that’s it. You can only get the benefits of it through an app, but a system-wide manual driver update still requires root access.

What can I do if I have root?

If you’re a power user with a rooted device, then you can perform a system-wide forced installation of an updated graphics driver build on your device. To do so, you need to extract the driver BLOB (Binary Large OBject) files that contain pre-packaged software binaries for interacting with the GPU from an updated firmware package. You may use the firmware from a different device, but the driver must correspond to the same GPU family of the target device.

After extracting the required files, you can then pack them as a Magisk module and install it on the target smartphone to replace the existing vendor drivers in a systemless manner. Of course, the process is a bit more complicated than it sounds. You might need to take care of the interface incompatibilities between the legacy and the updated drivers, for which shimming would be necessary.

To “shim” is to “wedge (something) or fill up a space.” This is effectively what a developer does when writing a shim — they add additional codes to allow for the BLOB to interface with the platform they’re working with. Luckily for our readers, developer bylaws already wrote a shim to bridge the gap between different Adreno driver revisions, and you can find ready-to-use flashable OpenGL & Vulkan drivers for Adreno 500 and Adreno 600 family of GPUs on our forums.

Curious to know about the benefits of manually installing an updated graphics driver? Esper’s Mishaal Rahman shared an interesting comparison of the GPU performance in 3DMark from a Snapdragon 845-powered Google Pixel 3 XL running Android 12 with the stock driver versus a newer driver from the Snapdragon 8 Gen 1:

Quite fascinating, isn’t it? But don’t forget the trade-off between objectivity and relevance. While installing an updated GPU driver with root access has its perks, but it certainly has its pitfalls, too. It’s not meant for beginners, plus messing with the device may void the warranty. You need an unlocked bootloader to start with, which might not be feasible in all scenarios.

Conclusion

Given the alternatives for the Android GPU driver modding scene in the past, the Adreno Tools library is a fantastic step forward, especially for its rootless nature. We’re looking forward to seeing how the project grows and matures in the future. Be sure to give it a try and let us know what you think in the comments!


Source: Esper

About author

Skanda Hazarika
Skanda Hazarika

DIY enthusiast (i.e. salvager of old PC parts). An avid user of Android since the Eclair days, Skanda also likes to follow the recent development trends in the world of single-board computing.

We are reader supported. External links may earn us a commission.