Mali

For information on how to install the OpenGLES (3D) driver for the Mali-400 GPU present on the Allwinner A10 and A13, please refer to the binary drivers installation guide. There does not seem to be much relevant information left in this page, only obscure background information.

Mali-400 MP (Mali400 for short) is a GPU (Graphics Processor Unit) from ARM Ltd. (ARM Holdings plc), designed for embedded systems.

=Overview=

The Mali series of Graphics Processing Units (GPUs) are semiconductor intellectual property cores produced by ARM Holdings for licensing in various ASIC (Application-specific integrated circuit) designs by ARM partners. The core is mainly developed by ARM Norway, at the former Falanx company site.

Like other embedded IP cores for 3D support, the Mali GPU does not feature display controllers driving monitors (such as the combination often found in common video cards). Instead it is a pure 3D engine that renders graphics into memory and hands the rendered image over to another core that handles the display.

ARM supplies tools to help in authoring OpenGL ES shaders named Mali GPU Shader Development Studio and Mali GPU User Interface Engine.

Variants:
The Mali core grew out of the cores previously produced by Falanx and currently constitute:

More information can be found on the ARM website.

=Allwinner implementations= Allwinner officially only 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).

The Mali GPU variants can be found in the following SoCs (systems on chips) by Allwinner:

Mali-400 MP in A1x
Allwinner A10 (sun7i), A10s (sun5i), and A13 (sun5i) SoCs all features a Single-Core Cortex-A8 ARM CPU and an Single-Core (1 shader engine) Mali400 GPU from ARM.

Mali-400 MP2 in A20
Allwinner A20 (sun7i) SoC features a Dual-Core Cortex-A7 ARM CPU and an Dual-Core (2 shader engines) Mali400 MP2 GPU from ARM.

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

Please keep in mind that we have Makefile installation system for libraries with detection of what kernel space drivers you have. It is located at https://github.com/linux-sunxi/mali-libs In driver installation section we use only mali-libs. Following table contains every Mali-400 library that we got from various sources. You can use it for your own risk, most stable stuff is always in mali-libs.

NOTE: In r3p0 and newer versions all symbols are contained within libMali.so and libUMP.so. The standard OpenGL libraries are just symlinks to libMali.so. Thus it might be tempting to just install libMali.so and libUMP.so and link your application against them. But that will not work. libMali tries to dlopen libGLESv2.so.2.0 et. all. and without them it will just fail with a EGL_BAD_CONFIG (0x3005)

Mali-400 libraries breif table
= Lima open source Mali driver = Lima is a project to develop a completely open source graphics driver which supports ARM's Mali-200 and Mali-400 GPUs (work in progress).


 * http://limadriver.org/

The aim of this driver and others such as freedreno is to finally bring all the advantages of open source software to ARM SoC graphics drivers. Currently, the sole availability of binary drivers is increasing development and maintenance overhead, while also reducing portability, compatibility and limiting choice. Anyone who has dealt with GPU support on ARM, be it for a linux with a GNU stack, or for an android, knows the pain of dealing with these binaries.

= Mali-400 X11 DRI2 drivers = Some demo of these drivers is available on the youtube http://www.youtube.com/watch?v=tyR3Wqw5yZ0

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 libdri2-dev git Finally, just follow the instructions:  mkdir malibuild cd malibuild git clone git://github.com/linux-sunxi/xf86-video-mali.git git clone git://github.com/linux-sunxi/libump.git git clone git://github.com/linux-sunxi/mali-libs.git cd mali-libs make x11 make headers cd ../libump make make install cd ../xf86-video-mali autoreconf -vi ./configure --prefix=/usr make make install mkdir /usr/share/X11/xorg.conf.d 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) you can also select framebuffer instead of x11 if you want.
 * 1) if you have 'libdri2 not found': apt-get install libdri2-dev
 * 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.

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.

Missing X symbols
symbol lookup error: /usr/lib/libGLESv2.so.2: undefined symbol: XextCreateExtension

This is due to bad library dependencies of the libMali.so binary we have been given. We have worked around it in our manually built libUMP.so. Check that the loaded libUMP.so is the manually built one. If your mali-libs falsely installs an included one, and you get the above issue, then tell us about it, and we can adjust our mali-libs installation accordingly.

Tips on building

 * Some distributions have libdri2 compiled in X11 binary, so there is libdri2 separated in a github repo https://github.com/robclark/libdri2

API Info
APIs reported by es1_info: EGL_VERSION: 1.4 Linux-r3p0-04rel0 EGL_VENDOR: ARM EGL_EXTENSIONS: EGL_KHR_image, EGL_KHR_image_base, EGL_KHR_image_pixmap, EGL_KHR_gl_texture_2D_image, EGL_KHR_gl_texture_cubemap_image, EGL_KHR_gl_renderbuffer_image, EGL_KHR_reusable_sync, EGL_KHR_fence_sync, EGL_KHR_lock_surface, EGL_KHR_lock_surface2 EGL_CLIENT_APIS: OpenGL_ES GL_VERSION: OpenGL ES-CM 1.1 GL_RENDERER: Mali-400 MP GL_EXTENSIONS: GL_OES_byte_coordinates, GL_OES_fixed_point, GL_OES_single_precision, GL_OES_matrix_get, GL_OES_read_format, GL_OES_compressed_paletted_texture, GL_OES_point_size_array, GL_OES_point_sprite, GL_OES_texture_npot, GL_OES_query_matrix, GL_OES_matrix_palette, GL_OES_extended_matrix_palette, GL_OES_compressed_ETC1_RGB8_texture, GL_OES_EGL_image, GL_OES_draw_texture, GL_OES_depth_texture, GL_OES_packed_depth_stencil, GL_EXT_texture_format_BGRA8888, GL_OES_framebuffer_object, GL_OES_stencil8, GL_OES_depth24, GL_ARM_rgba8, GL_OES_EGL_image_external, GL_OES_EGL_sync, GL_EXT_multisampled_render_to_texture, GL_OES_texture_cube_map, GL_EXT_discard_framebuffer APIs reported by es2_info: EGL_VERSION: 1.4 Linux-r3p0-04rel0 EGL_VENDOR: ARM EGL_EXTENSIONS: EGL_KHR_image, EGL_KHR_image_base, EGL_KHR_image_pixmap, EGL_KHR_gl_texture_2D_image, EGL_KHR_gl_texture_cubemap_image, EGL_KHR_gl_renderbuffer_image, EGL_KHR_reusable_sync, EGL_KHR_fence_sync, EGL_KHR_lock_surface, EGL_KHR_lock_surface2 EGL_CLIENT_APIS: OpenGL_ES GL_VERSION: OpenGL ES 2.0 GL_RENDERER: Mali-400 MP GL_EXTENSIONS: GL_OES_texture_npot, GL_OES_compressed_ETC1_RGB8_texture, GL_OES_standard_derivatives, GL_OES_EGL_image, GL_OES_depth24, GL_ARM_rgba8, GL_ARM_mali_shader_binary, GL_OES_depth_texture, GL_OES_packed_depth_stencil, GL_EXT_texture_format_BGRA8888, GL_EXT_blend_minmax, GL_OES_EGL_image_external, GL_OES_EGL_sync, GL_EXT_multisampled_render_to_texture, GL_EXT_discard_framebuffer, GL_OES_get_program_binary, GL_EXT_shader_texture_lod

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

=See also=
 * Framebuffer

=References=

=External Links=
 * Mali-400 MP website
 * GPUs Comparison: ARM Mali vs Vivante GCxxx vs PowerVR SGX vs Nvidia Geforce ULP
 * MALI graphics hardware series webpage at ARM Holdings
 * Mali developer a developer site run by ARM
 * Open Source Mali GPUs Linux EXA/DRI2 and X11 Display Drivers
 * Lima driver