iMX6 with mainline kernel and etnaviv for EGLFS

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" } ]
}