Turnip+Zink in ExaGear

From Exagear International
Jump to navigation Jump to search

Turnip+Zink in ExaGear Windows Emulator is used as one of the methods to achieve full hardware acceleration for the new Adreno GPUs using xlib (an X Window System client function library written in C language). dri3 does not currently support hardware acceleration due to limitations of the ExaGear X server.

For a list of GPU Adreno that support Turnip+Zink drivers, see here.

The Turnip, Zink drivers are part of the Mesa driver, a free implementation of the Vulkan, OpenGL API.

This article shows instructions for compiling Mesa with Turnip+Zink and then installing the compiled libraries in ExaGear Windows Emulator.

ExaGear RPG/Strategies cannot use Turnip+Zink.

Install prebuilt libraries for ExaGear Turnip+Zink

In current (released from December 2021) (modified) caches, Turnip+Zink' is usually built in, they can be installed in the Start menu (in the folders Render, WineGL, etc.)

If a cache is used where Turnip+Zink is not included in the .obb, the easiest way to install is to use auto-installers created with WinRAR(SFX archives), (if using the original .obb, installation may be required additional libraries (dependencies)).

You can download the Turnip+Zink auto-installers here.

Build Mesa with Turnip+Zink for manual use in ExaGear (for modders)

Attention! Basic knowledge of GNU/Linux required.

This part of the article shows instructions for building the Turnip+Zink libraries manually, followed by installation and use in ExaGear.

To do this, you need to have a computer or laptop with i386 (not x86_64, because ExaGear Windows Emulator only supports translation to ARM 32-bit code) GNU/Linux operating system.

This manual will use Debian 12(sid) to build the latest version.

Install dependencies

First, open the /etc/apt/sources.list file with a text editor. Copy lines like deb http://ftp.ua.debian.org/debian/ bookworm main and paste them already with deb-src, e.g. deb-src http://ftp.ua.debian.org/debian/ bookworm main

If deb-src is already in your sources.list then you don't need to edit anything.

Save the changes and issue the command sudo apt update, after updating the packages, install the dependencies for the Mesa build: sudo apt build-dep mesa -y

Download Mesa3D and Zink-Mesa-Xlib

Because X Server ExaGear Windows Emulator only works correctly with xlib (the X Window System client function library written in C), and not with dri(Direct Rendering Infrastructure), then for Zink to work in ExaGear you need a patched version by user alexvorxx Mesa

Install git if not installed: sudo apt install git -y and clone the Mesa3D and Zink-Mesa-Xlib repositories:

  1. git clone https://github.com/mesa3d/mesa (any repository with mesa 22.
  2. git clone https://github.com/alexvorxx/Zink-Mesa-Xlib

For those using Debian 11(and below) or Ubuntu 18.04

If you are using Debian 11 and below, or Ubuntu 18.04, then before building mesa, you need to compile the latest versions of the programs listed below:

  1. https://gitlab.freedesktop.org/glvnd/libglvnd
  2. https://dri.freedesktop.org/libdrm
  3. https://gitlab.freedesktop.org/wayland/wayland
  4. https://gitlab.freedesktop.org/wayland/wayland-protocols

These repositories can also be cloned using git clone, build instructions are in the README.

For those using Ubuntu 18.04

Since the repositories in Ubuntu 18.04 use the old version of meson, you need to install it from pip3 using python3.6, to install it, enter the commands below in sequence:

  1. sudo apt-get install python3-pip
  2. pip3 install meson ninja

Build mesa

After building the necessary dependencies, go to the folder and build mesa:

meson build -D platforms=x11,wayland -D gallium-drivers=swrast,zink -D vulkan-drivers=freedreno -D dri3=enabled -D egl=enabled -D gles2=enabled -D glvnd=true -D glx=dri -D libunwind=disabled -D osmesa=true -D shared-glapi=enabled -D microsoft-clc=disabled -D valgrind=disabled --prefix /usr -D gles1=disabled -D freedreno-kgsl=true - Dbuildtype=release && sudo ninja -C build

If during compilation there will be an error about the missing file drm.h, drm_mode.h, copy these files to /usr/include:

  1. sudo cp /usr/include/libdrm/drm.h /usr/include
  2. sudo cp /usr/include/libdrm/drm_mode.h /usr/include

Build Zink-Mesa-Xlib

After installing mesa, go to the Zink-Mesa-Xlib folder, and build Mesa with Zink:

meson. build -Dgallium-va=false -Ddri-drivers= -Dgallium-drivers=virgl,zink,swrast -Ddri3=true -Dvulkan-drivers= -Dglx=xlib -Dplatforms=x11 -Dbuildtype=release && sudo ninja -C build install

After compilation, the compiled libraries need to be installed in ExaGear Windows Emulator

Installation in ExaGear


You need to create a folder usr, and create 3 more folders there (share, lib, include).


Copy the gbm.h file (located in ~/mesa/src/gbm/main) to the include folder.

Copy these directories to the usr/include folder: EGL, GL, GLES, GLES2, GLES3, KHR (located in ~/mesa/include)


In share folder create folder vulkan, glvnd, drirc.d, in folder vulkan create folder icd.d, in glvnd folder create folder egl_vendor.d.

In the vulkan/icd.d folder, copy the freedreno_icd.i686.json file (located in ~/mesa/build/src/freedreno/vulkan)

In glvnd/egl_vendor.d/ folder copy 50_mesa.json (located in ~/mesa/build/src/egl)

Copy the 00-mesa-defaults.conf file to the drirc.d folder (located in ~/mesa/src/util)


In the lib folder, create the i386-linux-gnu folder and copy the files there:

  1. libglapi.so, libglapi.so.0, libglapi.so.0.0.0 (located in ~/mesa/build/src/mapi/shared-glapi)
  2. libvulkan_freedreno.so (located in ~/mesa/build/src/freedreno/vulkan)
  3. libOSMesa.so.8.0.0, libOSMesa.so, libOSMesa.so.8 (found in ~/mesa/build/src/gallium/targets/osmesa)
  4. libGLX_mesa.so.0.0.0, libGLX_mesa.so, libGLX_mesa.so.0 (found in ~/mesa/build/src/glx/)
  5. libEGL_mesa.so.0.0.0, libEGL_mesa.so, libEGL_mesa.so.0 (located in ~/mesa/build/src/egl)
  6. libgbm.so, libgbm.so.1, libgbm.so.1.0.0 (located in ~/mesa/build/src/gbm/)

Also create pkgconfig and dri folders in the same lib folder. Copy the following files to the pkgconfig folder:

  1. osmesa.pc (located in ~/mesa/build/meson-private/)
  2. gbm.pc (located in ~/mesa/build/meson-private/)
  3. dri.pc (located in ~/mesa/build/meson-private/)

Copy these files to the dri folder:

  1. zink_dri.so (located in ~/mesa/build/src/gallium/targets/dri)
  2. libgallium_dri.so (located in ~/mesa/build/src/gallium/targets/dri)



From the folder Zink-Mesa-Xlib you need to copy the libGL.so.1.5.0 library (located in ~/mesa/build/src /gallium/targets/libgl-xlib/)

Validation in ExaGear

After copying all the files, you need to copy the usr folder to the Download folder of the phone, then run ExaGear Windows Emulator, and copy the copied folder to the Z: / drive with overwriting.

If the standard ExaGear cache is used (which is not recommended) then it must be modified by adding the vulkan-tools package. How to modify the cache and add packages to it is described in here. You also need to download terminal emulator for ExaGear.

Open a terminal and enter the command vulkaninfo (if you use the original ExaGear Windows Emulator cache and there is a missing libraries error, you need to download and install them additionally). After all the errors have been fixed and the vulkaninfo command has run successfully and the Vulkan API and GPU name extensions should be shown (or the TU error will be shown, in this case Vulkan will also work).

You also need to check OpenGL (type glxgears, should show gears). If gears are displayed, then Turnip+Zink is working. If you get an error that the command was not found, run the Wine ported to Windows wglgears in Wine.

If you get an error when starting glxgears instead of gears (wglgears will close), then you may have an unsupported GPU, you can see the list of GPUs that can work with Turnip+Zink here.


Original instruction by alexvorxx