Using Mali on Linux for Radxa Rock

all credit goes to olegk0 and linux-sunxi community.

I just tried olegk0's code and introduce about it. don't ask olegk0 about any error in this page, he is not responsible for anything written in here.

prepare

toolchain

git clone -b kitkat-release --depth 1 https://android.googlesource.com/platform/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6 prebuilts/gcc/linux-x86/arm/arm-eabi-4.6

this is official toolchain to build Android for Rockchip. you may use another toolchain which is known to work with your kernel source.

kernel source

git clone -b radxa-stable-3.0 https://github.com/radxa/linux-rockchip.git

this is up-to-date kernel source from Rockchip, but only drm.ko is needed. you may use your kernel source.

mali source

git clone -b r3p2-01rel2-olegk0 https://github.com/linux-rockchip/mali-modules.git

this is (currently) r3p2-01rel2 source code from ARM + minimal rk30 support code taken from olegk0's repository.

build kernel modules

drm.ko

cd /path/to/linux-rockchip
make radxa_rock_pro_linux_hdmi_defconfig
make Image
make EXTRA_CFLAGS="-D__linux__" M=drivers/gpu/drm

drivers/gpu/drm/drm.ko will be built.

mali_drm.ko

cd /path/to/mali-modules/DX910-SW-99002-r3p2-01rel2/driver/src/egl/x11/drm_module/mali_drm.rk30
ln -s /path/to/linux-rockchip/drivers/gpu/drm ../
make EXTRA_CFLAGS="-D__linux__" CROSS_COMPILE=/path/to/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- KDIR=/path/to/linux-rockchip

DX910-SW-99002-r3p2-01rel2/driver/src/egl/x11/drm_module/mali_drm.rk30/mali_drm.ko will be built.

ump.ko

cd /path/to/mali-modules/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump
make CROSS_COMPILE=/path/to/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- KDIR=/path/to/linux-rockchip CONFIG=rk30-m400-4 BUILD=release

DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/ump/ump.ko will be built.

mali.ko

cd /path/to/mali-modules/DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/mali
make EXTRA_CFLAGS="-DMALI_VOLTAGE_LOCK=0 -DMALI_POWER_MGMT_TEST_SUITE=0" CROSS_COMPILE=/path/to/prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi- KDIR=/path/to/linux-rockchip USING_UMP=1 BUILD=release TARGET_PLATFORM=rk30 MALI_PLATFORM=rk30 MALI_SHARED_INTERRUPTS=1

DX910-SW-99002-r3p2-01rel2/driver/src/devicedrv/mali/mali.ko will be built.

build userland binaries

please follow http://linux-sunxi.org/Binary_drivers for now.

for xf86-video-fbturbo, mali-r3p2-support branch is better than 0.4.0 branch.

you may need to run

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

and put

Option "AccelMethod" "CPU"

into "Device" section in xorg.conf.

compiled binaries

video

benchmarks

mali_600mhz.ko is used.

glmark2-es2

=======================================================
    glmark2 2012.08
=======================================================
    OpenGL Information
    GL_VENDOR:     ARM
    GL_RENDERER:   Mali-400 MP
    GL_VERSION:    OpenGL ES 2.0
=======================================================
[build] use-vbo=false: FPS: 119 FrameTime: 8.403 ms
[build] use-vbo=true: FPS: 127 FrameTime: 7.874 ms
[texture] texture-filter=nearest: FPS: 128 FrameTime: 7.812 ms
[texture] texture-filter=linear: FPS: 127 FrameTime: 7.874 ms
[texture] texture-filter=mipmap: FPS: 129 FrameTime: 7.752 ms
[shading] shading=gouraud: FPS: 116 FrameTime: 8.621 ms
[shading] shading=blinn-phong-inf: FPS: 119 FrameTime: 8.403 ms
[shading] shading=phong: FPS: 112 FrameTime: 8.929 ms
[bump] bump-render=high-poly: FPS: 85 FrameTime: 11.765 ms
[bump] bump-render=normals: FPS: 134 FrameTime: 7.463 ms
[bump] bump-render=height: FPS: 129 FrameTime: 7.752 ms
[effect2d] kernel=0,1,0;1,-4,1;0,1,0;: FPS: 65 FrameTime: 15.385 ms
[effect2d] kernel=1,1,1,1,1;1,1,1,1,1;1,1,1,1,1;: FPS: 32 FrameTime: 31.250 ms
[pulsar] light=false:quads=5:texture=false: FPS: 136 FrameTime: 7.353 ms
[desktop] blur-radius=5:effect=blur:passes=1:separable=true:windows=4: FPS: 48 FrameTime: 20.833 ms
[desktop] effect=shadow:windows=4: FPS: 95 FrameTime: 10.526 ms
Error: Requested MapBuffer VBO update method but GL_OES_mapbuffer is not supported!
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=map: Unsupported
[buffer] columns=200:interleave=false:update-dispersion=0.9:update-fraction=0.5:update-method=subdata: FPS: 46 FrameTime: 21.739 ms
Error: Requested MapBuffer VBO update method but GL_OES_mapbuffer is not supported!
[buffer] columns=200:interleave=true:update-dispersion=0.9:update-fraction=0.5:update-method=map: Unsupported
[ideas] speed=duration: FPS: 101 FrameTime: 9.901 ms
[jellyfish] <default>: FPS: 83 FrameTime: 12.048 ms
Error: SceneTerrain requires Vertex Texture Fetch support, but GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS is 0
[terrain] <default>: Unsupported
[conditionals] fragment-steps=0:vertex-steps=0: FPS: 136 FrameTime: 7.353 ms
[conditionals] fragment-steps=5:vertex-steps=0: FPS: 104 FrameTime: 9.615 ms
[conditionals] fragment-steps=0:vertex-steps=5: FPS: 134 FrameTime: 7.463 ms
[function] fragment-complexity=low:fragment-steps=5: FPS: 134 FrameTime: 7.463 ms
[function] fragment-complexity=medium:fragment-steps=5: FPS: 75 FrameTime: 13.333 ms
[loop] fragment-loop=false:fragment-steps=5:vertex-steps=5: FPS: 134 FrameTime: 7.463 ms
[loop] fragment-steps=5:fragment-uniform=false:vertex-steps=5: FPS: 134 FrameTime: 7.463 ms
[loop] fragment-steps=5:fragment-uniform=true:vertex-steps=5: FPS: 134 FrameTime: 7.463 ms
=======================================================
                                  glmark2 Score: 108 
=======================================================

es2gears

EGL_VERSION = 1.4 Linux-r3p2-01rel2
vertex shader info: 
fragment shader info: 
info: 
2064 frames in 5.0 seconds = 412.635 FPS
2129 frames in 5.0 seconds = 425.630 FPS
2180 frames in 5.0 seconds = 435.913 FPS
2098 frames in 5.0 seconds = 419.348 FPS
2228 frames in 5.0 seconds = 445.511 FPS
2231 frames in 5.0 seconds = 446.111 FPS
2087 frames in 5.0 seconds = 417.400 FPS
2274 frames in 5.0 seconds = 454.800 FPS
2119 frames in 5.0 seconds = 423.715 FPS
2251 frames in 5.0 seconds = 450.200 FPS