2D/3D/Video acceleration on cubieboard2 (and MyPaint v1.1 + Wacom数码绘图板)

I managed, this week-end, finally relativly easily to add full hardware acceleration support on Cubieboard2. I used the current stage (beta) of linux-sunxi kernel, and followed step by step kernel compilation tutorial on linux-sunxi.org wiki. I slightly improved documentation, in the case of AllWinner A20.

Focus that created the system image I used to these modification also made an article about this, inspirated by some of my recommandations, and now, The modified image is available from the download area of cubieboard.org. You can still continue to read this article to understand how to for another distribution. I myself needed to apply some of this rules for my version of (l/x)ubuntu 13.10

Kernel compilation

Tutorial for the kernel (choose the stage branche), to do on a powerfull PC if possible and avoid to do it on Cubieboard itself, it could take lot of time, about 1 hour (never tried).

Barely, after installing the cross-compilation tools:

If you want to optimize a little your code for the Cubieboard2, if possible, use GCC 4.8 (included in Ubuntu 13.10) but at lest set the following CFLAGS enironment variable before any configuration for compilation:

export CFLAGS="-O3 -march=armv7-a -mcpu=cortex-a7 -mfpu=neon-vfpv4 -mfloat-abi=hard"

The whole process of making kernel use 5 lines of shell (and lot of time), if you don’t have lot of memory (<= 2GB), stop most services as possible to have more to compiler caches, you can redus by twice to ten times the compilation time. If you can stop X11 service and do it in console. Don’t use github.com downloadable snapshot they are full crap and will not work at all, use git command instead to get tree !!! :

git clone https://github.com/linux-sunxi/linux-sunxi -b stage/sunxi-3.4 # Clone stage branch
cd linux-sunxi
cp -a  arch/arm/configs/sun7i_defconfig .config     # Copie standard configuration for AllWinner A20 at the good place
sed -i 's/CONFIG_SUNXI_EMAC=m/CONFIG_SUNXI_EMAC=y/g' .config    # Link the network driver instead of creating a module, to have it working at reboot time.
make -j8 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules    # Compilation, can take lot of time.

Replace the 8 of -j8 in the last line, by the number of cores of your CPU. I use a core i7 (4 core * 2 (Hyperthreading) = 8 cores), This take about 6 minutes to compile.

An important detail, I worked on the system image I speak about on a previous post. To replace the kernel and modules files, with for this example :
* /arc/compilation/linux-sunxi, Kernel directory.
* /mnt/sdc1 uboot partition and /mnt/sdd1 system partition (on SATA disk)

mv /mnt/sdc1/uImage /mnt/sdc1/uImage.old                # Save a copy of older kernel
cp -a /arc/compilation/linux-sunxi/arch/arm/boot/uImage /mnt/sdc1/  # Copy the new kernel
mv /mnt/sdd1/lib/firmware /mnt/sdd1/lib/firmware.old         # Save a copy of old firmwares
mv /mnt/sdd1/lib/modules /mnt/sdd1/lib/modules.old          # Save a copy of old kernel modules
cd /arc/compilation/linux-sunxi/                  # change to kernel dir and install modules and firmwares
make INSTALL_MOD_PATH=/mnt/sdd1/lib/modules  ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules_install

Compilation of well balanced, state of the art X11 driver (free + closed)

Follow this instructions about graphics driver.

fbturbo, former sunxifb (renamed, as it can now be used on any platform using an ARM Mali GPU, and probably more) is a free software 2D driver allowing acceleration of desktop usage, improving management of framebuffer. It is about ten time faster for 2D, and can help to make the 3D up to 3 time faster.

The closed source 3D driver, Mali already as a free software competitor, I still didn’t tried to install. Developers say that performances are already better than the closed and proprietary driver, they also say that this can still be improved in near futur.

I still don’t know which part is used for that, but mplayer and VLC can already play videos (at least the few I tested) without problems. That’s even better than on my Intel Core i7. Some speak about only few codecs managed, didn’t searched more for now, but at least the defaut Linaro VLC (so not specifically linked with closed driver), can already play french Freebox (internet box) TV channels, I was able to play chinese channels without problems. My ADSL line is not good enough too play Freebox HD channels, but I played without problem HD videos by internet connexion, at least what I done to demoing the Cubieboard2 state :

This is a demo of MyPaint with Wacom tablet (I didn’t try to make a masterpiece, only to test performances of somes brushes ^^). => liste of supported tablets with the Linux driver

Mypaint v1.1 with Wacom tablet on cubieboard2, minimal 2d acceleration

Screencast of Mypaint v1.1 with Wacom tablet on cubieboard2, minimal 2d acceleration

For imformation, on this kind of light plateforme, only OpenGL ES (for embedded systems) has hardware acceleration management. There is not full OpenGL hardware acceleration at all. Here is a comparative view of the same benchmark (glmark2) in the two cases, at left Open GL, at right OpenGL ES:

glmark2 (OpenGL, at left), versus glmark2-es2 (OpenGL ES) at right

glmark2 (OpenGL, at left), versus glmark2-es2 (OpenGL ES) at right

You can also see other test video I made last week-end in the following folder : /cubieboard/demos_video.201310/

October 2014 updateglmark2 ArchlinuxARM package, Works really better with software renderer with new LLVMpipe driver (3 to 4 times faster).

2 thoughts on “2D/3D/Video acceleration on cubieboard2 (and MyPaint v1.1 + Wacom数码绘图板)

  1. MartinB

    Greetings from Czech Republic!

    I wondering if you can desribe how to compile version for internal NAND booting instead of booting with uboot from SATA drive. I’m absolute begginer when it comes down to compiling distros, but I’m interested in using Cubie for Vjing (via custom OpenFrameworks application, basicaly C++ and OpenGL), but somehow, there is problem with accessing hardware acceleration, which as I see you somehow solved. Maybe if you could upload already compiled image or at least provide some information, that would be awesome!

    Best regards

    Martin

    1. Popolon Post author

      You must first know, that Cubieboard1/2, have a Mali GPU, that, as all ARM GPU, until there is an ARM platform with PCI or desktop/server GPU, doesn’t support OpenGL acceleration, it only supports OpenGL ES, embedded subset of OpenGL. This is good enough for most task. So first this framwork must be ported to OpenGL ES. I seen, there was some effort to port it to OpenGL ES only, about one year ago and some report success about it:

      http://forum.openframeworks.cc/index.php/topic,9107.0.html

      I installed NAND image at first with allwinner tool for Linux, but I had error, and image I used was very instable. I currently try to have a good system on HDD or µSD, and then will backport it to NAND. I must first manage to write into NAND from µSD or SATA booted system, the allwinner application from allwinner doesn’t work well.

      Ultimatly, I would like to have a quick booting image from NAND, like an hibernated image, so, it can populate memory really quickly, have a little partition for users data, and be able to choose between NAND and SATA or µSD for a more complete standard desktop system or server oriented system.

Leave a Reply