Search code examples
qtopenglinteleglfs

QT EGLFS backend with Mesa driver without X11/Xorg


I am trying to run one of the example apps from QT 5.12 without having XServer installed. I am using Ubuntu Linux. When I start it using linuxfb backend, it works fine, but then mapboxgl plugin does not work (probably because of lack of native opengl)

but when I start it with EGLFS backend

./qml_location_mapviewer -platform eglfs

it fails with "Could not initialize egl display"

I tried weston/wayland compositor and -platform wayland everything works as well. Why QT EGLFS does not see my Intel Haswell Open GL device, but everyone else can?


Solution

  • as @derhass suggested it was required to recompile QT with all necessary OpenGL libraries installed first.

    # essentials
    sudo apt-get install build-essential libssl-dev python
    
    # bluez stack (optional)
    sudo apt-get install libbluetooth-dev bluetooth blueman bluez libusb-dev libdbus-1-dev bluez-hcidump bluez-tools
    
    # OpenGL EGL support
    sudo apt-get install mesa-utils libegl1-mesa libegl1-mesa-dev libgbm-dev libgbm1 libgl1-mesa-dev libgl1-mesa-dri libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev 
    
    # assuming QT is downloaded and extracted before
    cd ~/qt-everywhere-src-5.12.6
    ./configure -confirm-license -opensource -nomake tests -nomake examples -openssl-linked
    

    Ensure you get EGLFS section similar to this:

    QPA backends:
      DirectFB ............................... no
      EGLFS .................................. yes
      EGLFS details:
        EGLFS OpenWFD ........................ no
        EGLFS i.Mx6 .......................... no
        EGLFS i.Mx6 Wayland .................. no
        EGLFS RCAR ........................... no
        EGLFS EGLDevice ...................... yes
        EGLFS GBM ............................ yes
        EGLFS VSP2 ........................... no
        EGLFS Mali ........................... no
        EGLFS Raspberry Pi ................... no
        EGLFS X11 ............................ yes
      LinuxFB ................................ yes
      VNC .................................... yes
      Mir client ............................. no
    

    Then compile and install the whole thing

    make
    sudo make install
    

    Compile your project and run it.

    cd mapviewer
    /usr/local/Qt-5.12.6/qmake
    make
    ./qml_location_mapviewer -platform eglfs