Qt on EGLFS without window manager
-
Hi,
I have an x86-based platform on which I would like to run Qt applications on EGLFS directly with DRM, i.e. without a window manager like Wayland or Xorg. For this, I compiled Mesa with platform
drm
and the necessary drivers. My Qt compile configuration is attached at the bottom of this post.When trying to run a Qt application, I get the following error:
EGL error : Could not create the egl surface: error = 0x300b
The error 0x300b means
EGL_BAD_NATIVE_WINDOW
.I digged into Qt's and Mesa's source code and found the following: The error is raised in Mesa's implementation of
eglCreateWindowSurface()
. This function is called in Qt's methodQEglFSWindow::resetSurface()
, as follows:... m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format); m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL); ...
I found out that
m_window
is alwaysNULL
(makes sense, because we don't have a window manager), which is what Mesa does not like, see Mesa's function_eglCreateWindowSurfaceCommon()
:static EGLSurface _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config, void *native_window, const EGLint *attrib_list) { ... if (native_window == NULL) RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); ...
How can I configure Qt in such a way that Mesa is happy?
My Qt configuration is as follows:
Configure summary: Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: devices/linux-ks-sdk-g++ (x86_64, CPU features: mmx sse sse2) Target compiler: gcc 7.4.0 Configuration: cross_compile sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c largefile rdrnd shani nostrip x86SimdAlways shared rpath release c++11 c++14 c++1z concurrent reduce_exports stl Build options: Mode ................................... release Optimize release build for size ........ no Building shared libraries .............. yes Using C standard ....................... C11 Using C++ standard ..................... C++1z Using ccache ........................... no Using gold linker ...................... no Using new DTAGS ........................ yes Using precompiled headers .............. no Using LTCG ............................. no Target compiler supports: SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX .................................. AVX AVX2 AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI Other x86 ............................ AES F16C RDRAND SHA Intrinsics without -mXXX option ...... yes Build parts ............................ libs examples Qt modules and options: Qt Concurrent .......................... yes Qt D-Bus ............................... no Qt D-Bus directly linked to libdbus .... no Qt Gui ................................. yes Qt Network ............................. yes Qt Sql ................................. yes Qt Testlib ............................. yes Qt Widgets ............................. yes Qt Xml ................................. yes Support enabled for: Using pkg-config ....................... yes udev ................................... yes Using system zlib ...................... yes Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... no iconv .................................. yes ICU .................................... no Tracing backend ........................ <none> Logging backends: journald ............................. no syslog ............................... no slog2 ................................ no Using system PCRE2 ..................... yes Qt Network: getifaddrs() ........................... yes IPv6 ifname ............................ yes libproxy ............................... no Linux AF_NETLINK ....................... yes OpenSSL ................................ yes Qt directly linked to OpenSSL ........ no OpenSSL 1.1 ............................ yes DTLS ................................... yes SCTP ................................... no Use system proxies ..................... yes Qt Gui: Accessibility .......................... yes FreeType ............................... yes Using system FreeType ................ yes HarfBuzz ............................... no Using system HarfBuzz ................ no Fontconfig ............................. no Image formats: GIF .................................. no ICO .................................. yes JPEG ................................. yes Using system libjpeg ............... yes PNG .................................. yes Using system libpng ................ yes EGL .................................... yes OpenVG ................................. no OpenGL: Desktop OpenGL ....................... no OpenGL ES 2.0 ........................ yes OpenGL ES 3.0 ........................ yes OpenGL ES 3.1 ........................ yes OpenGL ES 3.2 ........................ yes Vulkan ................................. no Session Management ..................... yes Features used by QPA backends: evdev .................................. yes libinput ............................... no INTEGRITY HID .......................... no mtdev .................................. no tslib .................................. no xkbcommon .............................. no X11 specific: XLib ................................. no XCB Xlib ............................. no EGL on X11 ........................... no 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 ............................ no LinuxFB ................................ yes VNC .................................... yes Mir client ............................. no Qt Sql: SQL item models ........................ yes Qt Widgets: GTK+ ................................... no Styles ................................. Fusion Windows Qt PrintSupport: CUPS ................................... no Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. no Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt Testlib: Tester for item models ................. yes Qt QML: QML network support .................... yes QML debugging and profiling support .... yes QML sequence object .................... yes QML list model ......................... yes QML XML http request ................... yes QML Locale ............................. yes QML delegate model ..................... yes Qt Quick: Direct3D 12 ............................ no AnimatedImage item ..................... yes Canvas item ............................ yes Support for Qt Quick Designer .......... yes Flipable item .......................... yes GridView item .......................... yes ListView item .......................... yes TableView item ......................... yes Path support ........................... yes PathView item .......................... yes Positioner items ....................... yes Repeater item .......................... yes ShaderEffect item ...................... yes Sprite item ............................ yes Qt Quick Controls 2: Styles ................................. Default Fusion Imagine Material Universal Qt Quick Templates 2: Hover support .......................... yes Multi-touch support .................... yes Qt Tools: QDoc ................................... no
The configure command line in detail:
Command line: -v -opensource -confirm-license -force-pkg-config -hostprefix /top/bsp/local/qt/target -nomake tests -no-gif -no-harfbuzz -no-icu -no-pch -no-strip -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtscript -skip qtsensors -skip qtserialbus -skip qttranslations -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtwinextras -skip qtx11extras -no-use-gold-linker -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtvirtualkeyboard -skip qtdocgallery -skip qtfeedback -skip qtnetworkauth -skip qtpim -skip qtqa -skip qtrepotools -skip qtspeech -skip qtsystems -skip qtandroidextras -examplesdir /usr/lib/qt5/examples -plugindir /usr/lib/qt5/plugins -prefix /usr -sysconfdir /etc/xdg -system-freetype -system-libjpeg -system-libpng -system-pcre -system-zlib -no-reduce-relocations -extprefix /top/fs/fsdev/usr -sysroot /top/fs/fsdev -no-gcc-sysroot -device ks-sdk -device-option CROSS_COMPILE= -device-option TARGET_COMPILER_CC=gcc-7 -device-option TARGET_COMPILER_CXX=g++-7 -device-option TARGET_COMPILER_LD=ld -device-option TARGET_COMPILER_AR=gcc-ar-7 -device-option TARGET_COMPILER_OBJCOPY=objcopy -device-option TARGET_COMPILER_NM=gcc-nm-7 -device-option TARGET_COMPILER_STRIP=strip -device-option 'TARGET_COMPILER_CFLAGS= -Wall -finput-charset=UTF-8 -g -O2 -isystem /top/fs/fsdev/include -isystem /top/fs/fsdev/usr/include -I/top/fs/fsdev/usr/include/freetype2 -I/top/fs/fsdev/usr/src/ti/include' -device-option 'TARGET_COMPILER_LDFLAGS= -Wl,-rpath-link=/top/fs/fsdev/lib -Wl,-rpath-link=/top/fs/fsdev/usr/lib -Wl,-rpath-link=/top/fs/fsdev/lib/ -L/top/fs/fsdev/lib -L/top/fs/fsdev/usr/lib' -L/top/fs/fsdev/lib -L/top/fs/fsdev/usr/lib -no-opengl -skip qtwayland -opengl es2 -gbm -qpa eglfs -no-directfb -eglfs -evdev -kms -linuxfb -no-xcb -no-xcb-xlib -no-xcb-xinput -release -shared -no-cups -no-dbus -no-glib -openssl -no-sql-sqlite -skip qtcharts -skip qtserialport -skip qtxmlpatterns -no-tslib
Best,
Holger -
I got a step further. The reason for the above error is that the appropriate device integration plugin is not loaded. To fix this, I set the environment variable:
QT_QPA_EGLFS_INTEGRATION=eglfs_kms
but got a new error:
qt.qpa_egldeviceintegration: Failed to load EGL device integration "eglfs_kms" EGL library doesn't support emulator extensions Aborted
So the plugin cannot be loaded, although it's there:
# ls /usr/lib/qt5/plugins/egldeviceintegrations libqeglfs-emu-integration.so libqeglfs-kms-egldevice-integration.so libqeglfs-kms-integration.so
Any ideas?
-
Hi,
I have an x86-based platform on which I would like to run Qt applications on EGLFS directly with DRM, i.e. without a window manager like Wayland or Xorg. For this, I compiled Mesa with platform
drm
and the necessary drivers. My Qt compile configuration is attached at the bottom of this post.When trying to run a Qt application, I get the following error:
EGL error : Could not create the egl surface: error = 0x300b
The error 0x300b means
EGL_BAD_NATIVE_WINDOW
.I digged into Qt's and Mesa's source code and found the following: The error is raised in Mesa's implementation of
eglCreateWindowSurface()
. This function is called in Qt's methodQEglFSWindow::resetSurface()
, as follows:... m_window = qt_egl_device_integration()->createNativeWindow(this, surfaceSize, m_format); m_surface = eglCreateWindowSurface(display, m_config, m_window, NULL); ...
I found out that
m_window
is alwaysNULL
(makes sense, because we don't have a window manager), which is what Mesa does not like, see Mesa's function_eglCreateWindowSurfaceCommon()
:static EGLSurface _eglCreateWindowSurfaceCommon(_EGLDisplay *disp, EGLConfig config, void *native_window, const EGLint *attrib_list) { ... if (native_window == NULL) RETURN_EGL_ERROR(disp, EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); ...
How can I configure Qt in such a way that Mesa is happy?
My Qt configuration is as follows:
Configure summary: Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: devices/linux-ks-sdk-g++ (x86_64, CPU features: mmx sse sse2) Target compiler: gcc 7.4.0 Configuration: cross_compile sse2 aesni sse3 ssse3 sse4_1 sse4_2 avx avx2 avx512f avx512bw avx512cd avx512dq avx512er avx512ifma avx512pf avx512vbmi avx512vl compile_examples enable_new_dtags f16c largefile rdrnd shani nostrip x86SimdAlways shared rpath release c++11 c++14 c++1z concurrent reduce_exports stl Build options: Mode ................................... release Optimize release build for size ........ no Building shared libraries .............. yes Using C standard ....................... C11 Using C++ standard ..................... C++1z Using ccache ........................... no Using gold linker ...................... no Using new DTAGS ........................ yes Using precompiled headers .............. no Using LTCG ............................. no Target compiler supports: SSE .................................. SSE2 SSE3 SSSE3 SSE4.1 SSE4.2 AVX .................................. AVX AVX2 AVX512 ............................... F ER CD PF DQ BW VL IFMA VBMI Other x86 ............................ AES F16C RDRAND SHA Intrinsics without -mXXX option ...... yes Build parts ............................ libs examples Qt modules and options: Qt Concurrent .......................... yes Qt D-Bus ............................... no Qt D-Bus directly linked to libdbus .... no Qt Gui ................................. yes Qt Network ............................. yes Qt Sql ................................. yes Qt Testlib ............................. yes Qt Widgets ............................. yes Qt Xml ................................. yes Support enabled for: Using pkg-config ....................... yes udev ................................... yes Using system zlib ...................... yes Qt Core: DoubleConversion ....................... yes Using system DoubleConversion ........ no GLib ................................... no iconv .................................. yes ICU .................................... no Tracing backend ........................ <none> Logging backends: journald ............................. no syslog ............................... no slog2 ................................ no Using system PCRE2 ..................... yes Qt Network: getifaddrs() ........................... yes IPv6 ifname ............................ yes libproxy ............................... no Linux AF_NETLINK ....................... yes OpenSSL ................................ yes Qt directly linked to OpenSSL ........ no OpenSSL 1.1 ............................ yes DTLS ................................... yes SCTP ................................... no Use system proxies ..................... yes Qt Gui: Accessibility .......................... yes FreeType ............................... yes Using system FreeType ................ yes HarfBuzz ............................... no Using system HarfBuzz ................ no Fontconfig ............................. no Image formats: GIF .................................. no ICO .................................. yes JPEG ................................. yes Using system libjpeg ............... yes PNG .................................. yes Using system libpng ................ yes EGL .................................... yes OpenVG ................................. no OpenGL: Desktop OpenGL ....................... no OpenGL ES 2.0 ........................ yes OpenGL ES 3.0 ........................ yes OpenGL ES 3.1 ........................ yes OpenGL ES 3.2 ........................ yes Vulkan ................................. no Session Management ..................... yes Features used by QPA backends: evdev .................................. yes libinput ............................... no INTEGRITY HID .......................... no mtdev .................................. no tslib .................................. no xkbcommon .............................. no X11 specific: XLib ................................. no XCB Xlib ............................. no EGL on X11 ........................... no 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 ............................ no LinuxFB ................................ yes VNC .................................... yes Mir client ............................. no Qt Sql: SQL item models ........................ yes Qt Widgets: GTK+ ................................... no Styles ................................. Fusion Windows Qt PrintSupport: CUPS ................................... no Qt Sql Drivers: DB2 (IBM) .............................. no InterBase .............................. no MySql .................................. no OCI (Oracle) ........................... no ODBC ................................... no PostgreSQL ............................. no SQLite2 ................................ no SQLite ................................. no Using system provided SQLite ......... no TDS (Sybase) ........................... no Qt Testlib: Tester for item models ................. yes Qt QML: QML network support .................... yes QML debugging and profiling support .... yes QML sequence object .................... yes QML list model ......................... yes QML XML http request ................... yes QML Locale ............................. yes QML delegate model ..................... yes Qt Quick: Direct3D 12 ............................ no AnimatedImage item ..................... yes Canvas item ............................ yes Support for Qt Quick Designer .......... yes Flipable item .......................... yes GridView item .......................... yes ListView item .......................... yes TableView item ......................... yes Path support ........................... yes PathView item .......................... yes Positioner items ....................... yes Repeater item .......................... yes ShaderEffect item ...................... yes Sprite item ............................ yes Qt Quick Controls 2: Styles ................................. Default Fusion Imagine Material Universal Qt Quick Templates 2: Hover support .......................... yes Multi-touch support .................... yes Qt Tools: QDoc ................................... no
The configure command line in detail:
Command line: -v -opensource -confirm-license -force-pkg-config -hostprefix /top/bsp/local/qt/target -nomake tests -no-gif -no-harfbuzz -no-icu -no-pch -no-strip -skip qt3d -skip qtactiveqt -skip qtcanvas3d -skip qtconnectivity -skip qtdoc -skip qtimageformats -skip qtlocation -skip qtmacextras -skip qtmultimedia -skip qtscript -skip qtsensors -skip qtserialbus -skip qttranslations -skip qtwebchannel -skip qtwebengine -skip qtwebview -skip qtwinextras -skip qtx11extras -no-use-gold-linker -skip qtdatavis3d -skip qtgamepad -skip qtpurchasing -skip qtscxml -skip qtvirtualkeyboard -skip qtdocgallery -skip qtfeedback -skip qtnetworkauth -skip qtpim -skip qtqa -skip qtrepotools -skip qtspeech -skip qtsystems -skip qtandroidextras -examplesdir /usr/lib/qt5/examples -plugindir /usr/lib/qt5/plugins -prefix /usr -sysconfdir /etc/xdg -system-freetype -system-libjpeg -system-libpng -system-pcre -system-zlib -no-reduce-relocations -extprefix /top/fs/fsdev/usr -sysroot /top/fs/fsdev -no-gcc-sysroot -device ks-sdk -device-option CROSS_COMPILE= -device-option TARGET_COMPILER_CC=gcc-7 -device-option TARGET_COMPILER_CXX=g++-7 -device-option TARGET_COMPILER_LD=ld -device-option TARGET_COMPILER_AR=gcc-ar-7 -device-option TARGET_COMPILER_OBJCOPY=objcopy -device-option TARGET_COMPILER_NM=gcc-nm-7 -device-option TARGET_COMPILER_STRIP=strip -device-option 'TARGET_COMPILER_CFLAGS= -Wall -finput-charset=UTF-8 -g -O2 -isystem /top/fs/fsdev/include -isystem /top/fs/fsdev/usr/include -I/top/fs/fsdev/usr/include/freetype2 -I/top/fs/fsdev/usr/src/ti/include' -device-option 'TARGET_COMPILER_LDFLAGS= -Wl,-rpath-link=/top/fs/fsdev/lib -Wl,-rpath-link=/top/fs/fsdev/usr/lib -Wl,-rpath-link=/top/fs/fsdev/lib/ -L/top/fs/fsdev/lib -L/top/fs/fsdev/usr/lib' -L/top/fs/fsdev/lib -L/top/fs/fsdev/usr/lib -no-opengl -skip qtwayland -opengl es2 -gbm -qpa eglfs -no-directfb -eglfs -evdev -kms -linuxfb -no-xcb -no-xcb-xlib -no-xcb-xinput -release -shared -no-cups -no-dbus -no-glib -openssl -no-sql-sqlite -skip qtcharts -skip qtserialport -skip qtxmlpatterns -no-tslib
Best,
Holger@HolgerS said in Qt on EGLFS without window manager:
I have an x86-based platform
Could it be possible to know more about the device? any links you could provide?
Any ideas?
Have you checked this forum?
There are a couple of posts (1, 2) with same error, although related to embedded devices., but that could lead you in same path regarding EGL drivers and plugin integration.
There's algo a Qt bug reported.
-
@HolgerS said in Qt on EGLFS without window manager:
I have an x86-based platform
Could it be possible to know more about the device? any links you could provide?
Any ideas?
Have you checked this forum?
There are a couple of posts (1, 2) with same error, although related to embedded devices., but that could lead you in same path regarding EGL drivers and plugin integration.
There's algo a Qt bug reported.
@Pablo-J-Rogina said in Qt on EGLFS without window manager:
@HolgerS said in Qt on EGLFS without window manager:
I have an x86-based platform
Could it be possible to know more about the device? any links you could provide?
My device is a standard (but customized) PC with Intel HD graphics. It is supposed to run only one application, therefore no need for Wayland or Xorg, which only add complexity.
-
I have found the solution.
First of all: The error message
EGL library doesn't support emulator extensions
does not come from theeglfs_kms
plugin itself, but from the emulator plugineglfs_emu
which is used as a fallback, since the original plugin could not be loaded.So why could
eglfs_kms
not be loaded in the first place?The answer is that the library, resp. symlink
libQt5EglFsKmsSupport.so.5
had not been deployed on my target device; therefore, loading theeglfs_kms
plugin failed. Deploying the library with the appropriate symlink fixed the problem, i.e. the filesystem should look like this:~ # ls -l /usr/lib/libQt5EglFsKmsSupport.so.5* lrwxrwxrwx ... /usr/lib/libQt5EglFsKmsSupport.so.5 -> libQt5EglFsKmsSupport.so.5.12.8 -rwxr-xr-x ... /usr/lib/libQt5EglFsKmsSupport.so.5.12.8
I found this out by doing an
strace
on one of Qt's example applications:export QT_QPA_EGLFS_INTEGRATION=eglfs_kms strace /usr/lib/qt5/examples/widgets/tutorials/notepad/notepad 2>&1 | tee log.txt
and then
grep
ing for failedopen
-statements.@Pablo-J-Rogina Thanks for your time!