Running QT5.9 with mainline kernel on mx6sabresd board

2 minute read

In embedded systems it is very common to have an LCD that shows a graphical interface to the user.

There are many graphics frameworks that perform such task and a particular very popular one is Qt.

Thanks to the progress of the Etnaviv project, it is possible to run Qt on i.MX6 with hardware graphics acceleration.

How can we easily test Qt on i.MX6 running a mainline kernel?

Etnaviv can run on your favorite build system/Linux distro. I have been using it with Buildroot, so this post shows the steps for building and running a Buildroot image with Qt on i.MX6.

In general the Buildroot configs tend to generate a minimal rootfs, but in some cases a more complete defconfig can be accepted. I have added support for the imx6-sabresd_qt5_defconfig target in Buildroot that includes mainline U-Boot, mainline kernel, mesa, libdrm, kmscube, Qt5, glmark2 application.

The imx6-sabresd_qt5_defconfig can be found here

With the imx6-sabresd_qt5_defconfig target we can easily run Qt applicatons.

In order to generate a Buildroot image with Qt5 support for mx6sabresd:

$ make imx6-sabresd_qt5_defconfig
$ make

This will download and build all the software components from scratch, so it may take a while.

After the build process is finished an sdcard.img file will be available at output/images/sdcard.img.

Just flash it directly to the SD card:

$sudo dd if=output/images/sdcard.img of=/dev/mmcblk0; sync

Then boot the mx6sabresd board (Since this image uses SPL, it can run on any mx6sabresd board variant: i.MX6Q, i.MX6DL and i.MX6QP).

The default password is root.

In order to run a Qt demo called Cinematic Experience:

# export QT_QPA_EGLFS_KMS_CONFIG=/root/sabresd.json
# /usr/share/Qt5/CinematicExperience/Qt5_CinematicExperience

The sabresd.json file describes the graphics rendering device and also the available displays of the system:

{
  "device": "/dev/dri/card0",
  "hwcursor": false,
  "pbuffers": true,
  "outputs": [
    {
      "name": "HDMI-1",
      "mode": "off"
    },
    {
      "name": "LVDS-1",
      "mode": "1024x768"
    }
  ]
}

In this case the LVDS screen is the enabled one and HDMI output is disabled.

Here is a video showing the CinematicExperience running on imx6sabresd:

One problem I noticed when running this demo initially was that the Egalax touchscreen stops receiving events after some time. I haven’t really found the root cause and fix for this problem yet.

I have only found a way to workaround the problem and the temporary solution I am using is to change the cpufreq driver governor to performance.

Here is the kernel defconfig fragment used in Buildroot that makes this change

With this setting the touchscreen does not fail. Feel free to ping us in case you know of a proper fix to this touchscreen problem.

Enjoy running Qt5 with a mainline kernel :-)