Mali binary driver

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 framebuffer and X11 as windowing systems.

= Mali kernel driver =

First get a working display driver.

Modules
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:  mali

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 Mali binary drivers =

We have a repository to do this for you, called sunxi-mali.

You need libdri2-dev,xorg-dev,xutils-dev for success build.

 apt-get install git build-essential libdri2-dev xorg-dev xutils-dev


 * Some distributions have libdri2 compiled in X11 binary. If it is packaged install it. Otherwise you can compile it yourself. You need install libdrm-dev for the compilation:

 git clone https://github.com/robclark/libdri2 cd libdri2 ./autogen.sh ./configure make make install

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 cd sunxi-mali 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/.

If mali needs to be used in X11 desktop, then setting up X is also necessary (the default fbdev x11 driver will not work!). Move on to the next section.

= Setting up X =

If you are using the framebuffer console only, and have verified that the framebuffer version of the Mali binaries was installed, then you can of course skip this section.

= 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!

= Common pitfalls =

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.

= See also =


 * Setting up a working display driver
 * Setting up an accelerated driver for the Xserver
 * CedarX media acceleration (video decoding).