How To Guide Getting Freedreno Turnip (Mesa Vulkan Driver) on a Poco F3

Search This thread


Senior Member
Feb 21, 2022


  • Screenshot_20220225-211358.png
    267.8 KB · Views: 30


Senior Member
Jan 26, 2017


Senior Member
Feb 21, 2022
After you've installed the fbpatch apk you have to go to advanced>extract turnip driver. Then on /data/data/xyz.aethersx2.custom/drivers you'll find which then you should patch,rename and flash. You can copy the file from termux, just do su first.
i mean how can i do this in termux sir?can you help me


Senior Member
May 1, 2021
Can anyone check if Egg Ns uses Turnip ?
I tried replacing Vulkan files of v611 provides by egg with Turnip Vulkan so file.
This is zip which fakes that is v611 in download Ns folder and then zips.


    3.5 MB · Views: 19

Top Liked Posts

  • There are no posts matching your filters.
  • 12
    Bellow follows a compilation and magisk packaging guide for the Turnip driver, if you just want an optimized build for magisk and don't care to compile get it from This build is built as release with LTO enabled. Just make sure that on /vendor/lib64/hw you have a file called ,if the name is different then you have to patch it with patchelf and rename it as stated bellow.

    In this guide I'm going to teach you how to compile the mesa's Turnip vulkan driver of the Freedreno project for any smartphone with a Snapdragon SOC on a PC. If you want to compile on your phone (guest) check the second post.
    You are going to need Linux in order to follow this guide and recommended is a distro with latest packages, for example Arch Linux (including derivatives like EndeavourOS, Manjaro, Garuda, Calamarch, etc.), while this may also work on WSL/WSL2 I haven't tested it and you are on your own for this.
    You are also going to need a mobile phone that’s rooted with the latest magisk and magisk manager.

    Before starting you need to satisfy some dependencies:
    • git to clone the mesa repository
    • patchelf to patch the binary with the name your phone expects
    • meson which is mesa’s build system
    To get all these on Arch you can use the below command:
    sudo pacman -Syu git patchelf meson

    You also need NDK since you are compiling native code for Android. There are two ways to get this:
    • From the SDK Manager on Android Studio Beta or Canary (Stable Android Studio doesn’t have the latest NDK) by going to More Actions>SDK Manager>SDK Tools on the welcome screen or Tools>SDK Manager>SDK Tools if a project is open and download the latest one. If you already have it and it shows a – sign you need to click it again to become a tick since you already have it but it is an older version. After you get the NDK you can close Android Studio.
    • Manually from Make sure to get the latest NDK for Linux at the bottom of the page.

    Now you need to find the absolute path of the NDK, which will be referred to as NDKDIR from now on.
    If you got the NDK from Android Studio, then there should be a folder called Android on your home folder with a folder called Sdk inside it, get in. Click the ndk folder then get inside the folder of the biggest version (25.0.8141415 at the time of writing this) and copy the path. In my case the path is

    If you downloaded the NDK manually then you need to extract it somewhere. For example I created a folder called Turnip in the root of my home folder and extracted it there. The latest NDK is at the time of writing this so my NDKDIR is

    Inside your NDKDIR create a folder called pkgconfig and another folder for dependencies which I will call deps.

    Next you must create a meson cross file. To do this create a file called android-aarch64 at ~/.local/share/meson/cross/ (~ means your home folder). If you don’t see any folders starting with a dot you need to press ctrl+h, if the path doesn’t exist create it.
    On that file paste the following and using your text editor automatically find and replace all instances of NDKDIR with your NDKDIR from above.
    ar = 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-ar'
    c = ['ccache', 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang']
    cpp = ['ccache', 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android31-clang++', '-fno-exceptions', '-fno-unwind-tables', '-fno-asynchronous-unwind-tables', '-static-libstdc++']
    c_ld = 'lld'
    cpp_ld = 'lld'
    strip = 'NDKDIR/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android-strip'
    # Android doesn't come with a pkg-config, but we need one for meson to be happy not
    # finding all the optional deps it looks for.  Use system pkg-config pointing at a
    # directory we get to populate with any .pc files we want to add for Android
    pkgconfig = ['env', 'PKG_CONFIG_LIBDIR=NDKDIR/pkgconfig', '/usr/bin/pkg-config']
    system = 'linux'
    cpu_family = 'aarch64'
    cpu = 'armv8'
    endian = 'little'

    Now you need to download a binary of libdrm compiled for Arm64. It’s available at, just click the Download button on the right. Open the .tar.xz archive using your archive manager. Inside there’s a folder called usr that contains three other folders. You must extract the include and lib folders on the deps folder you created. After you do so, close your archive manager. The lib folder has a folder called pkgconfig, from that folder copy the file libdrm.pc to the pkgconfig folder that you created before deps.

    Edit the libdrm pc file after you transfer it and change its first line so that it points to deps. For example in my case it's

    And last, you need a clone of the MESA repository. To clone the repo you need to use the terminal so open a terminal at the folder you want the mesa folder to be downloaded onto or cd there otherwise the mesa folder will be placed at the root of your home folder. To clone you use the bellow command:
    git clone
    and cd inside by doing
    cd mesa
    Then generate the build files using
    meson build-android-aarch64 --cross-file android-aarch64 -Dbuildtype=release -Dplatforms=android -Dplatform-sdk-version=31 -Dandroid-stub=true -Dgallium-drivers= -Dvulkan-drivers=freedreno -Dfreedreno-kgsl=true -Db_lto=true
    And compile with
    ninja -C build-android-aarch64
    When this is done you can find our compiled driver binary at build-android-aarch64/src/freedreno/vulkan/ inside the mesa folder named

    Now you must find the name of the binary that our phone has. The easiest way to do this is to open a terminal emulator on your phone like termux or do adb shell and run
    ls /system/vendor/lib64/hw|grep vulkan
    In my case the driver is called

    Now open a terminal on the folder where and use patchelf to patch it with the name of the driver on your phone, for example in my case I’d do
    patchelf --set-soname
    and then rename to the name the driver on your phone has.

    You now need to create a magisk package containing Turnip. Simply download my existing package from and replace /system/vendor/lib64/hw/ with the Turnip binary you compiled, patched and renamed. Now you can flash it on Magisk and reboot your phone. If you have other Magisk packages that are Vulkan drivers please disable them before rebooting. If you want compile again at a later time cd inside the mesa repo you had cloned and do a git pull before running meson and compiling. You may also have to delete the build-android-aarch64 folder.
    hello, I was trying to follow ur instructions, Im stuck at
    ninja -C build-android-aarch64

    The error is:

    ld.lld: error: /home/user/Android/Sdk/ndk-bundle/deps/lib/ is incompatible with aarch64linux
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    ninja: build stopped: subcommand failed.

    I'm using ubuntu, not arch linux
    I got the same error.

    The link in the post for the libdrm was for arm

    The link for arm64 libdrm was:

    I replaced the lib and include files again, and it successfully compiled.

    I did the patchelf commands

    I replaced the vulkan file in the vendor partition

    It did not work when I rebooted, so I changed the permissions of the freedreno vulkan driver to 644.

    When I rebooted, the freedreno vulkan driver was now working.

    The file "aarch64-linux-android-ar" in the new versions of the ndk bundles was renamed to "llvm-ar". I was able to compile using a newer version of ndk instead of the deprecated one.

    Hello, can any of you help me? Could you please compile turnip drivers but add these commits. They fix the crash with switch emulators (skyline and egg ns) after a certain time.
    Done, i replace files from first link (merge request link)
    Some of you wanted to compile Turnip on Termux so here's a tutorial.

    You are going to need an arm64 phone and Termux from If you have Termux from PlayStore delete it since it no longer works and it uses a different signature so it can't be updated either.
    Once you install Termux go to your phone's app settings and give it storage permissions manually then launch it.

    You must run some pkg commands, answer Y if it asks you to.
    First update the repositories and upgrade the packages using
    pkg update
    Next you must install some dependencies
    pkg install binutils bison flex git ninja patchelf python wget zip
    The pip version Termux provides isn't always the latest so it must be updated too using
    /data/data/com.termux/files/usr/bin/python3 -m pip install --upgrade pip
    You will use pip3 to install the rest of the dependencies
    pip3 install mako meson
    Since you aren't cross compiling you need to create the path that hosts the native file
    mkdir -p ~/.local/share/meson/native
    and then download the native file for meson using
    This file is made for android-ndk-r23b so if a new version gets released use nano to edit it and replace all occurencies of android-ndk-r23b.
    You need to download the latest Termux-NDK
    (at the moment of writing this the latest is android-ndk-r23b if that changes obviously replace the commands of the guide with the new name and the url bellow)
    then extract it
    and remove the archive since it isn't needed anymore
    Then you need to download libdrm for arm64 from the alarm project's repositories. Simply go to, hold the Download button and copy the url. At the moment the latest one is the one below so change the commands depending on the latest version.
    Then you need to extract it
    tar -xf libdrm-2.4.109-1-aarch64.pkg.tar.xz -C android-ndk-r23b
    You then delete the archive since it's no longer of use
    rm libdrm-2.4.109-1-aarch64.pkg.tar.xz
    Now you must change the prefix of the libdrm pc file to point to our local pkgconfig
    sed -i 's#prefix=#&/data/data/com.termux/files/home/android-ndk-r23b#g' ~/android-ndk-r23b/usr/lib/pkgconfig/libdrm.pc
    You may now clone the mesa repository
    git clone
    and get inside it
    cd ~/mesa
    Configure the build environment using the meson command below
    meson build-android-aarch64 --native-file mesa -Dbuildtype=release -Dplatforms=android -Dplatform-sdk-version=31 -Dandroid-stub=true -Dgallium-drivers= -Dvulkan-drivers=freedreno -Dfreedreno-kgsl=true -Dcpp_rtti=false -Db_lto=true
    and then compile
    ninja -C build-android-aarch64
    Linking might take some time but once it's finished go back to Termux' home directory using
    cd ~
    Now download the template for the Magisk Driver package
    and extract it
    unzip -d mesa_lto
    then cd inside
    cd mesa_lto
    and copy the blob you compiled
    cp ~/mesa/build-android-aarch64/src/freedreno/vulkan/ ./system/vendor/lib64/hw/
    If you are building for another phone you have to run termux on that other phone and get the name of the vulkan library using
    ls /system/vendor/lib64/hw/|grep vulkan
    and then run patchelf and rename the blob.
    If not, you can just run these commands that will fetch the name of your phone's library and perform elf name patching
    patchelf --set-soname $(ls /system/vendor/lib64/hw/|grep vulkan) system/vendor/lib64/hw/
    and renaming
    mv system/vendor/lib64/hw/  system/vendor/lib64/hw/$(ls /system/vendor/lib64/hw/|grep vulkan)
    Finally zip the package
    zip -r ../ *
    and go back to Termux' home directory
    cd ..
    Delete the extracted folder, it's not needed anymore
    rm -rf mesa_lto
    Push the Magisk package to your phone's home folder
    cp /storage/emulated/0
    Close Termux
    Flash with Magisk and reboot.

    If you have other Magisk driver packages, disable them.
    If you want to compile again you don't have to reclone, just cd into the mesa directory and do
    git pull
    You may also have to delete the build-android-aarch64 folder.
    Can you give magisk module for latest mesa vulkan drivers ?
    @samantas5855 @astronomy2021
    Here it is complied yesterday .