I followed bellow instructions when using the Qt Wayland plugin.
The first application that starts is shown on the left screen and the second on the right screen.
This instructions was tested on an iMX8QM Toradex.
1). Apalis iMX8 Ycoto Linux is compiled by Ycoto/Openembedded framework
Apalis-iMX8_Reference-Multimedia-Image-Tezi_5.7.0-devel-20230613121500+build.0
-------------------------------
# local.conf, add eglfs and kms support
+ PACKAGECONFIG_append_pn-qtbase = " sql-sqlite eglfs kms"
+ PACKAGECONFIG_append_pn-qtmultimedia = " gstreamer"
+ ACCEPT_FSL_EULA = "1"
layers/meta-toradex-demos/recipes-images/images/tdx-reference-multimedia-image.bb, add SDK populate
+ inherit populate_sdk populate_sdk_qt5
compile Reference-Multimedia image
$ bitbake tdx-reference-multimedia-image
compile SDK
bitbake tdx-reference-multimedia-image -c populate_sdk
2). Display configuration
root@apalis-imx8:~# cat /boot/overlays.txt
fdt_overlays=apalis-imx8_hdmi_overlay.dtbo apalis-imx8_lvds_overlay.dtbo display-lt170410_overlay.dtbo
because i dont want use lvds toch screen so,i didnt use
apalis-imx8_atmel-mxt_overlay.dtbo
3). Qtwayland compositor Compile and deploy
3.a). The qtwayland compositor used in this test comes from Toradex Europe FAE Stefan Eichenberger, please refer to the source code Dual Screen Qt Wayland compositor:
Use the compiled dual-screen qtwayland compositor to replace the system default weston compositor
root@apalis-imx8:~# cat /etc/kms.conf
{
"device": "/dev/dri/card1",
"hwcursor": true,
"pbuffers": false,
"outputs": [
{ "name": "HDMI-A-1",
"mode": "1920x1080",
"virtualIndex": 0, "primary": true
},
{ "name": "LVDS-1",
"mode": "1280x800",
"virtualIndex": 1
}
]
}
3.b). For the compositor the following environment variables need to be set:
export QT_QPA_EGLFS_KMS_CONFIG=/etc/kms.conf
export QT_QPA_EGLFS_INTEGRATION=kms
export QT_QPA_PLATFORM=eglfs
export QT_QPA_EGLFS_KMS_ATOMIC=1
export QT_QPA_PLATFORM=wayland
Anyway,finally after run
./dual-screen
page1 and page2 just display on active screen(HDMI)and tow pages display on top of each other.
root@apalis-imx8:~# ./dual-screen
QML debugging is enabled. Only use this in a safe environment.
qt.qpa.wayland: Setting cursor position is not possible on wayland
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
unable to lock lockfile /run/user/0/wayland-0.lock, maybe another compositor is running
And with QT debug flag::
root@apalis-imx8-:~# export QT_LOGGING_RULES=qt.qpa.*=true # Option
root@apalis-imx8-:~# ./dual-screen
QML debugging is enabled. Only use this in a safe environment.
qt.qpa.wayland: using input method: QComposeInputContext
qt.qpa.fonts: default fonts: system QFont(Sans Serif,9,-1,5,50,0,0,0,0,0) fixed QFont(monospace,9,-1,2,50,0,0,0,0,0)
qt.qpa.wayland: Setting cursor position is not possible on wayland
qt.qpa.wayland: Available client buffer integrations: ("wayland-egl")
qt.qpa.wayland: Using Wayland-EGL
qt.qpa.wayland: Initializing client buffer integration "wayland-egl"
qt.qpa.wayland: Using the 'xdg-shell' shell integration
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
qt.qpa.wayland: Received xdg_toplevel.configure with QSize(1920, 1080) and QFlags<Qt::WindowState>(WindowFullScreen)
qt.qpa.wayland: Applied pending xdg_toplevel configure event: QSize(1920, 1080) QFlags<Qt::WindowState>(WindowFullScreen)
qt.qpa.wayland: Wayland does not support QWindow::requestActivate()
unable to lock lockfile /run/user/0/wayland-0.lock, maybe another compositor is running
qt.qpa.wayland: Received xdg_toplevel.configure with QSize(1920, 1080) and QFlags<Qt::WindowState>(WindowFullScreen)
qt.qpa.wayland: Applied pending xdg_toplevel configure event: QSize(1920, 1080) QFlags<Qt::WindowState>(WindowFullScreen)
qt.qpa.wayland.backingstore: handleUpdate QSGRenderThread(0xaaab0ff6ee20)
qt.qpa.wayland.backingstore: requestUpdate
qt.qpa.wayland.backingstore: handleUpdate QSGRenderThread(0xaaab0ff6ee20)
qt.qpa.wayland.backingstore: handleUpdate QSGRenderThread(0xaaab0ff70840)
qt.qpa.wayland.backingstore: requestUpdate
qt.qpa.wayland.backingstore: handleUpdate QSGRenderThread(0xaaab0ff70840)
qt.qpa.wayland: Received xdg_toplevel.configure with QSize(1920, 1080) and QFlags<Qt::WindowState>(WindowFullScreen|WindowActive)
qt.qpa.wayland.input: Setting frame event QtWaylandClient::QWaylandPointerEvent::Enter
qt.qpa.wayland.backingstore: deliverUpdateRequest
qt.qpa.wayland: Received xdg_toplevel.configure with QSize(1920, 1080) and QFlags<Qt::WindowState>(WindowFullScreen)
qt.qpa.wayland: Received xdg_toplevel.configure with QSize(1920, 1080) and QFlags<Qt::WindowState>(WindowFullScreen|WindowActive)
qt.qpa.wayland.input: Setting frame event QtWaylandClient::QWaylandPointerEvent::Leave
qt.qpa.wayland.input: Setting frame event QtWaylandClient::QWaylandPointerEvent::Enter
qt.qpa.wayland.backingstore: deliverUpdateRequest
qt.qpa.wayland: Applied pending xdg_toplevel configure event: QSize(1920, 1080) QFlags<Qt::WindowState>(WindowFullScreen)
qt.qpa.wayland.backingstore: requestUpdate
qt.qpa.wayland.backingstore: requestUpdate called twice without committing anything
qt.qpa.wayland.backingstore: requestUpdate
qt.qpa.wayland.backingstore: handleUpdate QSGRenderThread(0xaaab0ff6ee20)
qt.qpa.wayland: Applied pending xdg_toplevel configure event: QSize(1920, 1080) QFlags<Qt::WindowState>(WindowFullScreen|WindowActive)
qt.qpa.wayland.backingstore: handleUpdate QSGRenderThread(0xaaab0ff70840)