Mali

Overview
Mali400 is a GPU from ARM. More information can be found on the ARM website.

Mali 400 on A1x
Allwinner officially supports the Mali GPU driver on the Android platform only. In this article we cover native linux usage, for android refer to publicly available sources https://github.com/allwinnerwk https://github.com/allwinner-ics and many others.

Binary libraries download links
Mali-400 uses proprietary libraries that must be provided by SoC manufacturer. This libraries are built with Mali DDK in various variants defining supported APIs. Example: if VARIANT is mali400-vg-gles20-linux-ump, library will be built with support for OpenGL ES 2 and OpenVG.

Libraries depend on driver version, for each Mali-400 kernel module drivers update you need appropriate libraries version and appropriate X11/DRI2 drivers version. If this conditions will not be met, you will end with unsupported IOCTL's and basically unstable system.

Open-source Mali driver
There is a project to develop a completely open-source Mali driver (work in progress): http://limadriver.org/

Mali-400 X11 DRI2 drivers
Since everything was moved to our github organization, installation became pretty simple and obvious. First, compile and install a new kernel into your rootfs from https://github.com/linux-sunxi/linux-sunxi, following instructions are made for this kernel and contain r3p0 version of Mali. Second, you need to load your modules right, order is important. Alternatively, you can add names of them to /etc/modules if your distro is capable of doing this.  modprobe lcd modprobe hdmi modprobe ump modprobe disp modprobe mali modprobe mali_drm Third, you need to install these packages to build everything:  apt-get install build-essential autoconf automake make libtool xorg-dev xutils-dev libdrm-dev libdri2-1 Finally, just follow the instructions:  mkdir malibuild cd malibuild git clone https://github.com/linux-sunxi/xf86-video-mali.git git clone https://github.com/linux-sunxi/libump.git git clone https://github.com/linux-sunxi/mali-libs.git cp mali-libs/r3p0/armhf/x11/lib/* /lib cd libump mkdir /usr/include/ump cp include/ump/* /usr/include/ump make cp libUMP.so /lib/libUMP.so cd ../xf86-video-mali autoreconf -vi ./configure --prefix=/usr --x-includes=/usr/include --x-libraries=/usr/lib make make install cp xorg.conf /usr/share/X11/xorg.conf.d/99-mali400.conf Installation is written for Linaro, if you have different distro, things may differ.
 * 1) default branch is r3p0-04rel0
 * 1) default branch is r3p0-04rel0
 * 1) default branch contains everything, so we need to copy only r3p0 stuff
 * 1) you can also select framebuffer instead of x11 if you want.
 * 1) libump has pretty simple makefile, just make and copy output lib.
 * 1) this is mandatory step
 * 1) if you have 'libdri2 not found' do 'cp /usr/lib/libdri2.so.1 /usr/lib/libdri2.so'
 * 1) xf86-video-mali needs autoreconf to build
 * 1) if you have different rootfs layout, fix paths to yours
 * 1) restart your X server
 * 2) dont forget to 'chmod 777 /dev/ump' and 'chmod 777 /dev/mali' on each boot, or create a rule for udev for this.

TODO for developers

 * Make Mali-400 kernel drivers output the version on load
 * Figure out permissions problems for popular distros (udev rule?)
 * Integrate G2D support for 2D acceleration, right now Mali drivers sometimes are slower than FBDEV in 2D tasks. Example of EXA integration with 2D acceleration from qualcomm: https://www.codeaurora.org/gitweb/quic/xwin/?p=xf86-video-msm.git;a=blob;f=src/msm-exa-c2d.c;hb=refs/heads/chromium
 * Integrate Sunxi_disp_driver support
 * Integrate EDID support for HDMI/DVI connections (dynamic resolution detection)
 * (OPTIONAL) Toss out libump and ump kernel module, Mali-400 modules can directly use OS RAM if needed (or check Snowball for this, they use /dev/hwmem device that gives 16MB of RAM to Mali)