Mali binary driver

Jump to navigation Jump to search

The sun4i and sun5i use a Mali400MP1 and sun7i uses Mali400MP2 (dual-core GPU). We have support available for several versions of the mali binary driver stack, even though our kernel tends to come with the R3P0 version. We support fbdev and X11 as windowing systems.

Mali and UMP kernel drivers

First get a working display driver.


The default config for the kernel should have the Mali kernel drivers as modules. You should be able to load it by simply running

modprobe mali

A cleaner solution is to have the module autoloaded at boot, by adding the following to /etc/modules:


If you use a properly set up Xserver, then the necessary modules will be automatically loaded when X starts.

Device permission

The default permissions of /dev/ump and /dev/mali make these unusable for normal users. Add a file to /etc/udev/rules.d/, perhaps called 50-mali.rules, with the following content:

KERNEL=="mali", MODE="0660", GROUP="video"
KERNEL=="ump", MODE="0660", GROUP="video"

This should give a user belonging to the group video the right permissions to use the mali successfully.

Installing the UMP (Unified Memory Provider) userspace library

From a package

There are some packages available which fully install libUMP for you.

From source


libUMP only depends on libc and the ump kernel module.


apt-get install git build-essential autoconf libtool


yum install gcc autoconf libtool git

Clone the repo

git clone
cd libump


Building on Debian/Ubuntu

If you are on debian or ubuntu, you should build the package.

apt-get install debhelper dh-autoreconf fakeroot pkg-config

Then build the packages, after descending into the git tree:

dpkg-buildpackage -b

When that finishes, install the main package:

dpkg -i ../libump_*.deb

Building on other distributions

autoreconf -i
./configure --prefix=/usr
make install

Installing the Mali userspace driver


Building Tools

You will need to have the basic building tools installed:


apt-get install git build-essential autoconf automake


yum install gcc autoconf libtool git

X11 development files (optional)

If you wish to install the X11 version of the mali binaries, then you also need to install this:


apt-get install xutils-dev


yum install xorg-x11-server-devel

Clone the repo

git clone --recursive
cd sunxi-mali


Before you follow the instructions in this section, make sure that you have loaded the mali module, so that the kernel driver version can be autodetected.

Now you can descend into sunxi-mali, and you can let it detect your environment:

make config

It will state the detected environment, like so:

rm -f
make[1]: Entering directory `/home/libv/sunxi/sunxi-mali'
make -f Makefile.config
ABI="armhf" (Detected)
VERSION="r3p0" (Detected)
EGL_TYPE="x11" (Detected)
make[2]: Entering directory `/home/libv/sunxi/sunxi-mali'
echo "MALI_VERSION ?= r3p0" >
echo "MALI_LIBS_ABI ?= armhf" >>
echo "MALI_EGL_TYPE ?= x11" >>
make[2]: Leaving directory `/home/libv/sunxi/sunxi-mali'
make[1]: Leaving directory `/home/libv/sunxi/sunxi-mali'

In case it complains about missing, follow the instructions in the libdri2 (r3p0 X11 only) section and try again.


The sunxi-mali build system checks whether the selected library has all of its dependencies resolved. You might need to resolve these dependencies through your package manager.

libdri2 (r3p0 X11 only)

Some distributions have libdri2 compiled into the X11 binary, instead of having it as a separate library and package. If that is the case, you need to compile libdri2 manually.

You may need to install the following dependencies on Debian. On Fedora, the package xorg-x11-server-devel should be enough.

apt-get install libx11-dev libxext-dev libdrm-dev x11proto-dri2-dev libxfixes-dev

To build the library:

git clone
cd libdri2
./configure --prefix=/usr
make install


By following will install the GLES/EGL binaries into /usr/lib/, and EGL/GLES headers to /usr/include/:

make install

Setting up the windowing system


If you are using the framebuffer/fbdev version of the binaries, then your setup work is done.

You might want to change the fbdev device used by setting the FRAMEBUFFER environment variable.


If you want a GLES capable Xserver, then you will need to install the fbturbo driver according to our Xorg page.

Verifying the EGL/GLES driver stack

From the mali-sunxi repository, you can run:

make test

In case it complains about "/usr/bin/ld: /tmp/ccD8ofcr.o: undefined reference to symbol 'XNextEvent'", you probably need to add the linker option "-lX11" to the test/Makefile and try again.

After it successfully builds, run:


And you should be able to see a smoothed triangle, either written out to the top left corner of the framebuffer, or in an X window. The console will tell you which renderer is being used:

GL Vendor: "ARM"
GL Renderer: "Mali-400 MP"
GL Version: "OpenGL ES 2.0"

Double check with:



Common pitfalls

Mesa libraries are still in the way

If you are seeing one of this, it means Mesa is still used instead of Mali:

libEGL warning: failed to create a pipe screen for Mali DRI2
libEGL warning: DRI2: failed to open Mali DRI2 (search paths /usr/lib/arm-linux-gnueabihf/dri)
libEGL warning: failed to create a pipe screen for lima
libEGL warning: DRI2: failed to open lima (search paths /usr/lib/arm-linux-gnueabihf/dri:${ORIGIN}/dri:/usr/lib/dri)

Then the current best advice is to move the mesa-egl aside:

mv /usr/lib/arm-linux-gnueabihf/mesa-egl/ /usr/lib/arm-linux-gnueabihf/.mesa-egl/

If not present, look for, and their symlink in /usr/lib (and subdir); then, make them point to

ln -s /usr/lib/ /usr/lib/

Awkward, but at least gets you something workable.

Or for some cases, this can be tried:

mkdir /usr/lib/arm-linux-gnueabihf/mesa-egl-BACKUP
mv /usr/lib/arm-linux-gnueabihf/libEGL* /usr/lib/arm-linux-gnueabihf/libGLES* /usr/lib/arm-linux-gnueabihf/mesa-egl-BACKUP

See also