Mali binary driver

This page describes how to install and set up the binary userspace drivers that a fully working system for sunxi still requires.

= 3D driver =

The sun4i and sun5i use a Mali-400MP1. 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 framebuffer and X11 as windowing systems.

Mali kernel driver
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:  ump mali

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 succesfully.

Installing the Mali binary drivers
We have an all in one repository to do this for you, called sunxi-mali.

First we need to clone the repository, which is slightly less straightforward due to our use of git submodules for the actual binaries. Make sure to do this on the target system, and as root, as we will install directly into your system.

 git clone https://github.com/linux-sunxi/sunxi-mali.git git submodule init git submodule update

Now you can descend into sunxi-mali, if all goes well, you should only need to do this:

 make install

This should autodetect the version of the kernel driver, which ABI you are on, and whether you want X11 or framebuffer support (by looking for libX11). It will then build libUMP.so (ARM Mali's Universal Memory Provider), install libUMP and the GLES/EGL binaries into /usr/lib/, and install the UMP and EGL/GLES headers to /usr/include/.

RPM or deb packages are not available yet, for the simple reason that no-one has added spec files or a debian/ build tree to the sunxi-mali tree. If anyone needs a sunday-afternoon project, this is a good one.

Setting up X
If you are using the framebuffer, and have verified that the framebuffer version of the binaries was installed, then you can of course skip this section.

Get the xf86 driver for the mali:

 git clone git://github.com/linux-sunxi/xf86-video-mali.git

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

Then copy over the xorg.conf:  cp xorg.conf /usr/share/X11/xorg.conf.d/99-mali400.conf

You should now be able to (re)start your xserver, have a quick look through /var/log/Xorg.0.log to verify that the correct driver has been loaded:

... (II) Module mali: vendor="X.Org Foundation" compiled for 1.11.3, module version = 0.4.2 ABI class: X.Org Video Driver, version 11.0 (II) MALI: driver for Mali Framebuffer: mali (++) using VT number 7

(WW) Falling back to old probe method for mali (II) Loading /usr/lib/xorg/modules/drivers/mali_drv.so (II) MALI(0): using /dev/fb0 ...

Verifying the EGL/GLES driver stack
From the mali-sunxi repository, you can run:

 make test test/test

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" ...

Success!

Mesa libraries are still in the way
If your are seeing this:

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)

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/

Awkward, but at least gets you something workable.

= Media Acceleration driver =

Add info here about getting CedarX running.