Running Mesa on Toradex Apalis i.mx6


As promised in our last post regarding the new Toradex Freescale i.MX6-based SoM we continue our series about this module.

This time however we wanted to approach a different aspect of the i.MX6 processor – the Vivante GPU unit.

Mesa on i.MX6 - cube

Drivers for various versions of the Vivante GPU already existed thanks to an active community.
The support for the relatively new Toradex Apalis board however did not, and so we decided to remedy that.

Today we would like to share the code and a small how-to with you.

In the process we also helped update the version of mesa in the original repository that we based on (since it was a bit dated) and added our driver to it – long live Open Source!

Compile the driver

First of all, we are assuming you do everything directly on the board, not cross-compiling.

To compile it, get the source code from our repo and run make:

git clone
cd etna_viv/src
export GCABI=apalis #important
make -j5

It should compile with no errors.
Some tests are compiled along with the driver, to test if everything worked, run the following:


Compile MESA

The second step is Mesa.
Like earlier you can get the code from our repo.
Issue the following commands to setup, build and install Mesa on your Toradex board.

git clone

export DIR=/usr

#make sure to change the line below!!!

export CFLAGS="-I${DIR}/include -I${ETNAVIV_INC}"
export CXXFLAGS="-I${DIR}/include -I${ETNAVIV_INC}"
export LDFLAGS="-L${DIR}/lib -L${ETNAVIV_LIB}"
export LIBDRM_LIBS="-L${DIR}/lib -ldrm"

export ETNA_LIBS="-letnaviv"
#make sure you have libtool installed in your system
export LIBTOOL_FOR_BUILD="/usr/bin/libtool"

autoreconf -vfi

./configure --enable-gles2 --enable-gles1 --disable-glx --enable-egl \
    --enable-dri --with-gallium-drivers=swrast,etna \
    --with-egl-platforms=fbdev --enable-gallium-egl \
    --enable-debug --with-dri-drivers=swrast
make -j5
make install

After it compiles with success, you’re ready to go.
Now let’s run some tests.

git clone

cd mesatest_gles
make -j5

#set env variable with mesa libs
export LD_LIBRARY_PATH=/path_to_your/mesa/lib
#run example app

Mesa on i.MX6 - shapes

Not all of these test work yet, but most of them do, and they show what the Vivante GPU is capable of.

This post is part of a series of posts on Toradex technologies, the efect of a long-lasting cooperation between Toradex and Antmicro.
If you have suggestions of things you’d like to see written about, write to us at