没有 X11/Xorg 的带有 Mesa 驱动程序的 QT EGLFS 后端

QT EGLFS backend with Mesa driver without X11/Xorg

我正在尝试 运行 QT 5.12 中的示例应用程序之一,但未安装 XServer。我正在使用 Ubuntu Linux。当我使用 linuxfb 后端启动它时,它工作正常,但是 mapboxgl 插件不起作用(可能是因为缺少原生 opengl)

但是当我使用 EGLFS 后端启动它时

./qml_location_mapviewer -platform eglfs

失败 "Could not initialize egl display"

我尝试了 weston/wayland 合成器,-platform wayland 一切正常。为什么 QT EGLFS 看不到我的 Intel Haswell Open GL 设备,但其他人都能看到?

正如@derhass 建议的那样,需要先安装所有必要的 OpenGL 库来重新编译 QT。

# 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

确保您获得与此类似的 EGLFS 部分:

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

然后编译安装整个东西

make
sudo make install

编译您的项目并运行它。

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

请看这里:

https://doc.qt.io/qt-5/embedded-linux.html

特别是,尝试在 运行 您的应用程序之前设置以下环境变量:

export QT_QPA_EGLFS_INTEGRATION=eglfs_kms

如果这不起作用,请执行 strace 并检查失败的 open 调用以检查是否缺少任何库:

strace ./qml_location_mapviewer -platform eglfs 2>&1 | tee log.txt

/usr/lib 中的以下 libraries/plugins 特别重要:

  • libQt5EglFSDeviceIntegration.so.5
  • libQt5EglFsKmsSupport.so.5
  • qt5/plugins/platforms/libqeglfs.所以
  • qt5/plugins/egldeviceintegrations/libqeglfs-kms-integration.所以