iMX6 with mainline kernel and etnaviv for EGLFS

Dear Community,

I’m currently using version 2.8 of the Linux BSP with an iMX6 only with a framebuffer (no X11 or Wayland). It runs a Qt application with hardware acceleration. For this, it uses the EGLFS backend from Qt (OpenGL). In order to provide the acceleration, the BSP uses a freescale kernel with the vivante kernel module: imx-gpu-viv.

Since I wanted to switch to the mainline kernel, and specifically to a kernel with PREEMPT_RT support, I tried to change my setup to use the linux-toradex repo (branch toradex_4.19.y-rt). With this setup, instead of the imx-gpu-viv, it should use the etnaviv driver from mesa. If I understand correctly, this is what Torizon is using as well.

However, I don’t seem to be able to change my setup to use the mesa / etnaviv driver.

This is the config for Qt (qtbase):

PACKAGECONFIG_append = " linuxfb eglfs gles2 sql-sqlite accessibility"
PACKAGECONFIG_remove = "xcb xcb-xinput openssl tests examples openssl sm xml testlib printer"

I have also this line in my local.conf, in order to activate etnaviv.

MACHINEOVERRIDES .= ":use-mainline-bsp"

However, when I try to build, then I get the following error.

ERROR: Nothing PROVIDES 'virtual/egl'
imx-gpu-viv PROVIDES virtual/egl but was skipped: incompatible with machine apalis-imx6 (not in COMPATIBLE_MACHINE)

Can someone hint me at what else I need to activate etnaviv? Do I need to activate X11 or Wayland for this (which I would like to avoid)?

Note that I’m using my own distribution, based on the Torizon manifest and the 3.0 BSP from Toradex (branch thud).

Thanks for reading and for your help!

Hi

It’s hard to comment on your setup, you seem to have mixed a lot of stuff so that I don’t have a setup which does even come close. I hope you did not mix layer versions (rocko/thud) though as your reference to versions 2.8 and 3.0 of the BSP does suggest.

virtual/egl in the case of use-mainline-bsp should be provided by mesa. To enable the relevant mesa PACKAGECONFIG opengl must be in distro features, see here.

The file mesa.txt generated by bitbake mesa -e > mesa.txt might give some insight why mesa in your setup does not provide virtual/egl.

Max

Thank you @max.tx for your fast response! I hope my setup is not so mixed :wink: I was referring to BSP 2.8 only because this is my setup with the freescale kernel which works.

For the experiment with mainline kernel, I switched everything to thud, based on the toradex 3.0 BSP manifest in toradex-bsp-platform.git. In addition, I switched to the toradex_4.19.y-rt mainline kernel as described in the OP. Do you see any problems with this setup?

In any case, thank you for the pointer for opengl. I haven’t seen this and it was indeed missing. Mesa now builds fine. I still have an issue with the HDMI output, I therefore cannot yet report whether it works with a Qt application. I’ll update this question once it works (hopefully).

Thanks again, Michael

Hi Michael

I was just confused by the 2.8 vs. 3.0 references. Mixing these would not be a good idea.

At least on a Torizon Image with that kernel HDMI gets initialized and displays stuff for me so I guess it is a Kernel config or device-tree issue in your setup.

Max

Hi,

Thanks to the help of @max.tx, I could solve the issue and I’m now able to run a Qt application with EGLFS (no X11 or wayland) on a mainline kernel with the mesa provided etnaviv driver. I answer my own question here with the addition of the required Qt settings, hoping that it might help someone in the future.

My kernel is from the linux-toradex.git repo, branch toradex_4.19.y-rt:

$ uname -r
4.19.50-rt22-yocto-preempt-rt

The necessary configuration is as follows.

  1. Configure to use the mainline bsp in local.conf:

    MACHINEOVERRIDES .= “:use-mainline-bsp”

  2. Add opengl to the DISTRO_FEATURES, and remove x11 and wayland:

    DISTRO_FEATURES_append = " opengl"
    DISTRO_FEATURES_remove = “x11 wayland”

  3. Configure Qt to enable eglfs and the required backends in qtbase_%.bbappend. It is important to remove gl, because otherwise Qt tries to configure desktop opengl, which makes the configuration step fail.

    PACKAGECONFIG_append = " linuxfb eglfs gbm gles2 kms"
    PACKAGECONFIG_remove = “gl xcb xcb-xinput”

  4. Run the Qt application with the following settings.

    QT_QPA_PLATFORM=eglfs
    QT_QPA_EGLFS_INTEGRATION=eglfs_kms

I’m using an HDMI output which I had to configure to use /dev/dri/card1.

QT_QPA_EGLFS_ALWAYS_SET_MODE=1
QT_QPA_EGLFS_KMS_CONFIG=kms.json

Where kms.json specifies the output

{
  "device": "/dev/dri/card1",
  "outputs": [ { "name": "HDMI1" } ]
}

Very well done, thanks for letting us know!