Configures dual-screen display based on Qtwayland

Hello All,

I have an Apalis IMX8 QM Module with an ixora 1.2 carrier board (with a LVDS Display 10.1) and Im using the tdx-reference-multimedia-image right now.
I want to run a QT application on dual Screen(LVDS and HDMI) with Extend Mode!!
I try to build and use Qt dual-screen and I would like use “QtWayland” module
Based this question and this link i did All instrutctions but finally when run a qt application with 2 pages we faced bellow messages and pages display on active screen(here is HDMI)-2 pages with white color(HDMI-A-1) and red color (LVDS-1) screen page on top of each other:

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

My kms.conf is::

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

Bytheway I dont have TochScreen(so i didnt do related configuration for lvds and hdmi tochscreen event) and i can’t set position for windows(pages)!!
Can you explain Whats solution??
Thank you in advance,

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 :slight_smile:

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)

The version of Multimedia-Reference-Image::

Apalis-iMX8_Reference-Multimedia-Image-Tezi_5.7.0-devel-20230613121500+build.0

And Bellow code::

    int width[3], height[3];
        int num_of_screens;

        // check multiple screens
        QList <QScreen*> screens = QGuiApplication::screens();
        num_of_screens = screens.size();
        qDebug() << "the number of display: " << num_of_screens;

        QCursor::setPos(10,10);

        for (int i = 0; i < screens.size(); i++) {
            width[i] = screens[i]->geometry().width();
            height[i] = screens[i]->geometry().height();
        auto name = screens[i]->name();
            qDebug() << "[" << i << " " << name << "]" <<  \
            width[i] << " x " << height[i];
        }

And The result of it::

root@apalis-imx8:~# ./doubleScreen
the number of display:  2
qt.qpa.wayland: Setting cursor position is not possible on wayland
[ 0   "HDMI-A-1" ] 1920  x  1080
[ 1   "LVDS-1" ] 1280  x  800

Hello,
When,I want to run application dual-screen ,we have to start weston service
Really why??

 systemctl start weston@root.service

Without that we face this error:

root@apalis-imx8-:~# ./dual-screen 
QML debugging is enabled. Only use this in a safe environment.
Failed to create wl_dis[p l5a8y5 5(.N3o8 4s0u7c5h]  faiuldei to:r  tdyipree=c1t7o0r1y )audit(1687268514.209:9): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=1879 comm="dual-screen" exe="/home/root/dual-screen" sig=6 res=1

qt.qpa.wayland: Using Wayland-EGL
EGL: Warning: No default display support on wayland
qt.qpa.wayland: EGL not available
qt.qpa.plugin: Could not load the Qt platform plugin "wayland-egl" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, webgl, xcb.

Aborted

Any Idea??
Thanks

Hello All,
Theres nobody to guide me,please!!
Waiting for your response. I am stuck with this issue, any update from your side will be a great help. Would like to hear from you on this.
Thanks & Regards,

Hello @hhami ,
I have reached out to the author of the article (@hai.tx) , we will get back to you as soon as possible.

Best regards,
Josep

Thank @josep.tx for your answer!!
Waiting for your response.
Thanks & Regards,

Hello @josep.tx again
Can you give me @hai.tx emails or any connection way!!
I have some question that stuck me and his answers will be great help!!
Thank you

Hi Hhami,

Sorry that we have just spent a 3-day holiday and back to work today. for your issue i have below suggestions:

1). qtwayland compositor is the replacement of BSP default weston compositor, so before run qtwayland compositor, you need to create and modify below files to accomplish this.

### create dual-screen.sh script file with content as below, if you don't have touch devices, jut ignore the touch related part ###
------------------------
# get system touch device event number
while [ ! -e /dev/input/ts0 ]
do
sleep 0.1
done
ts0=$(readlink /dev/input/ts0)
while [ ! -e /dev/input/ts1 ]
do
sleep 0.1
done
ts1=$(readlink /dev/input/ts1)
# compare with kms.conf settings
while [ ! -e /etc/kms.conf ]
do
sleep 0.1
done
ts_hdmi=$(sed -n 8p /etc/kms.conf|cut -d '"' -f4|cut -d '/' -f4)
ts_lvds=$(sed -n 13p /etc/kms.conf|cut -d '"' -f4|cut -d '/' -f4)
# modify kms.conf if seetings is not consistent with system event
if [ "$ts_hdmi"!="$ts0" ];then
sed -i "8 s/event.*/$ts0\"\,/g" /etc/kms.conf
fi
if [ "$ts_lvds"!="$ts1" ];then
sed -i "13 s/event.*/$ts1\"\,/g" /etc/kms.conf
fi
# execute qtwayland compositor
/usr/bin/dual-screen &
------------------------

### create and configure permission to this file ###
# copy dual-screen binary to /usr/bin
$ cp dual-screen /usr/bin/
# create dual-screen.sh script, detailed content in above 
$ vi /usr/bin/dual-screen.sh
# add executable permission
$ chmod +x dual-screen.sh

### create qtwayland@.service systemd file to start qtwayland compositor, there is some environment exported in this file, please note the QPA_Platform  is not "wayland" but "eglfs"###
-----------------------------
# /lib/systemd/system/qtwayland@.service
[Unit]
Description=Qt Wayland Compositor 
RequiresMountsFor=/run
Conflicts=plymouth-quit.service
After=systemd-user-sessions.service plymouth-quit-wait.service
[Service]
User=%i
PAMName=login
Environment="QT_QPA_EGLFS_KMS_CONFIG=/etc/kms.conf"
Environment="QT_QPA_EGLFS_INTEGRATION=eglfs_kms"
Environment="QT_QPA_PLATFORM=eglfs"
Environment="QT_QPA_EGLFS_KMS_ATOMIC=1"
Environment="QT_QPA_EGLFS_NO_LIBINPUT=1"
StandardError=journal
PermissionsStartOnly=true
IgnoreSIGPIPE=no
ExecStart=/usr/bin/dual-screen.sh
-------------------------------

### create /etc/kms.conf file ###
------------------------------
$ vi /etc/kms.conf
{
 "device": "/dev/dri/card0",
 "hwcursor": true,
 "pbuffers": false,
 "outputs": [
 { "name": "HDMI1",
 "mode": "1920x1080",
 "touchDevice": "/dev/input/event2",
 "virtualIndex": 0, "primary": true
 },
 { "name": "LVDS1",
 "mode": "1280x800",
 "touchDevice": "/dev/input/event4",
 "virtualIndex": 1
 }
 ]
}
-------------------------------------

### create new udev rule file  71-qtwayland-drm.rules to replace default 71-weston-drm.rules, this is the necessary way to make sure qtwayland compositor start at boot instead of weston, you CAN NOT just ignore this process ###
---------------------------------------
# remove default weston udev rule
$ rm /etc/udev/rules.d/71-weston-drm.rules
# add qtwayland rule
$ vi /etc/udev/rules.d/71-qtwayland-drm.rules
# connect HDMI HID touchscreen and LVDS I2C touchscreen with fix symlink
SUBSYSTEM=="input" KERNEL=="event*" ATTRS{name} =="HID 27c0:0818", SYMLINK+="input/ts0"
SUBSYSTEM=="input" KERNEL=="event*" ATTRS{name} =="Atmel maXTouch Touchscreen", SYMLINK+="input/ts1
# start qtwayland compositor
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", 
ENV{SYSTEMD_WANTS}+="qtwayland@root.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", 
ENV{SYSTEMD_WANTS}+="qtwayland@root.service"
------------------------------------------

### now you can test qtwayland compositor ###
--------------------------------
# disable default wayland qt demo app systemd service
$ systemctl disable wayland-app-launch
$ reboot
-------------------------------

Thanks and Best Regards
Hai

Hello @hai.tx
Thank you for your answer.
I hope you have had a wonderful holiday and a great start to the New week!!
I Did The instructions based on your guide!!
But after reboot, I was not successful ,unfortunately!!


When I turn on “QT_DEBUG_PLUGINS=1” and then

root@apalis-imx8:~# export QT_LOGGING_RULES=qt.qpa.*=true 
root@apalis-imx8:~# /usr/bin/dual-screen
QML debugging is enabled. Only use this in a safe environment.
Failed to create wl_display (No such file or directory)
0t.qpa.wayland: Using Wayland-[E G2L3
 3.534168] audit: type=1701 audit(1687679131.451:4): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=925 comm="dual-screen" exe="/usr/bin/dual-screen" sig=6 res=1
EGL: Warning: No default display support on wayland
qt.qpa.wayland: EGL not available
qt.qpa.plugin: Could not load the Qt platform plugin "wayland-egl" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

Available platform plugins are: eglfs, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, webgl, xcb.

Aborted

root@apalis-imx8:~# /usr/bin/dual-screen -platform eglfs
QML debugging is enabled. Only use this in a safe environment.
qt.qpa.egldeviceintegration: EGL device integrati[o n2 6p1l1u.g0i1n2 0k0e1y]s :a u(d"ietg:l ftsy_peem=u1"7,0 1" eaguldfist_(k1m6s8_7e6g7l9d4e3v8i.c9e2"3,: 5")e:g lafusi_dk=m4s2"9,4 96"e7g29lf5s u_viid=v"0, g "iedg=l0f ss_evsi=v4_2w9l4"9)67295 pid=928 comm="dual-screen" exe="/usr/bin/dual-screen" sig=6 res=1

qt.qpa.egldeviceintegration: EGL device integration plugin keys (sorted): ("eglfs_emu", "eglfs_kms_egldevice", "eglfs_kms", "eglfs_viv", "eglfs_viv_wl")
qt.qpa.egldeviceintegration: Trying to load device EGL integration "eglfs_emu"
qt.qpa.egldeviceintegration: Using EGL device integration "eglfs_emu"
EGL: Warning: No default display support on wayland
Could not open egl display
Aborted
root@apalis-imx8:~# 


What should I do now?
Thank you for your help!!
Regards

Hi Hami,

looks like qtwayland compositor environment may have some issue, first you can check if the qtwayland compositor service is running correctly with below command

$ systemctl status qtwayland@root

the qtwayland compositor is a wayland compositor, you can’ t just run it like a general Qt application. it will definitely try to find a wayland-egl QPA platform for a Qt application running on wayland compositor.

Yes,Your Right

root@apalis-imx8:~# systemctl status qtwayland@root.service
* qtwayland@root.service - Qt Wayland Compositor
     Loaded: loaded (/lib/systemd/system/qtwayland@.service; static; vend>
     Active: failed (Result: exit-code) since Sun 2023-06-25 07:07:18 UTC>
    Process: 853 ExecStart=/usr/bin/dual-screen.sh (code=exited, status=2>
   Main PID: 853 (code=exited, status=203/EXEC)

Jun 25 07:07:17 apalis-imx8 systemd[1]: Started Qt Wayland Compo>
Jun 25 07:07:18 apalis-imx8 systemd[1]: qtwayland@root.service: >
Jun 25 07:07:18 apalis-imx8 systemd[1]: qtwayland@root.service: >
lines 1-9/9 (END)

My Configurations on the based your guide::



root@apalis-imx8:~# cat /usr/bin/dual-screen.sh
# get system touch device event number
sleep 0.1
# compare with kms.conf settings
while [ ! -e /etc/kms.conf ]
do
sleep 0.1
done
# modify kms.conf if seetings is not consistent with system event
# execute qtwayland compositor
/usr/bin/dual-screen &




root@apalis-imx8:~# cat /etc/kms.conf 
{
 "device": "/dev/dri/card0",
 "hwcursor": true,
 "pbuffers": false,
 "outputs": [
 { "name": "HDMI1",
 "mode": "1920x1080",
 "virtualIndex": 0, "primary": true
 },
 { "name": "LVDS1",
 "mode": "1280x800",
 "virtualIndex": 1
 }
 ]
}




root@apalis-imx8:~# cat /lib/systemd/system/qtwayland@.service 
[Unit]
Description=Qt Wayland Compositor 
RequiresMountsFor=/run
Conflicts=plymouth-quit.service
After=systemd-user-sessions.service plymouth-quit-wait.service
[Service]
User=%i
PAMName=login
Environment="QT_QPA_EGLFS_KMS_CONFIG=/etc/kms.conf"
Environment="QT_QPA_EGLFS_INTEGRATION=eglfs_kms"
Environment="QT_QPA_PLATFORM=eglfs"
Environment="QT_QPA_EGLFS_KMS_ATOMIC=1"
Environment="QT_QPA_EGLFS_NO_LIBINPUT=1"
StandardError=journal
PermissionsStartOnly=true
IgnoreSIGPIPE=no
ExecStart=/usr/bin/dual-screen.sh



root@apalis-imx8:~# cat /boot/overlays.txt 
fdt_overlays=apalis-imx8_hdmi_overlay.dtbo apalis-imx8_lvds_overlay.dtbo  display-lt170410_overlay.dtbo



root@apalis-imx8:~#  systemctl status wayland-app-launch
* wayland-app-launch.service - Start a wayland application
     Loaded: loaded (/lib/systemd/system/wayland-app-launch.service; disa>
     Active: inactive (dead)



root@apalis-imx8:~#  rm /etc/udev/rules.d/71-weston-drm.rules
rm: cannot remove '/etc/udev/rules.d/71-weston-drm.rules': No such file or directory
root@apalis-imx8:~# cat /etc/udev/rules.d/71-qtwayland-drm.rules
#tart qtwayland compositor
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", 
ENV{SYSTEMD_WANTS}+="qtwayland@root.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", 
ENV{SYSTEMD_WANTS}+="qtwayland@root.service"

please check permission for qtwayland@.service and 71-qtwayland-drm.rules files, should not have executable permission.

root@apalis-imx8-07308034:~# ls -al /lib/systemd/system/qtwayland\@.service 
-rw-r--r-- 1 root root 510 Sep 20 16:12 /lib/systemd/system/qtwayland@.service
root@apalis-imx8-07308034:~# cat /lib/systemd/system/qtwayland\@.service
[Unit]
Description=Qt Wayland Compositor
RequiresMountsFor=/run
Conflicts=plymouth-quit.service
After=systemd-user-sessions.service plymouth-quit-wait.service

[Service]
User=%i
PAMName=login
Environment="QT_QPA_EGLFS_KMS_CONFIG=/etc/kms.conf"
Environment="QT_QPA_EGLFS_INTEGRATION=eglfs_kms"
Environment="QT_QPA_PLATFORM=eglfs"
Environment="QT_QPA_EGLFS_KMS_ATOMIC=1"
Environment="QT_QPA_EGLFS_NO_LIBINPUT=1"
StandardError=journal
PermissionsStartOnly=true
IgnoreSIGPIPE=no

ExecStart=/usr/bin/dual-screen.sh
root@apalis-imx8-07308034:~# ls -al /etc/udev/rules.d/71-qtwayland-drm.rules 
-rw-r--r-- 1 root root 528 Sep 20 16:15 /etc/udev/rules.d/71-qtwayland-drm.rules
root@apalis-imx8-07308034:~# cat /etc/udev/rules.d/71-qtwayland-drm.rules
# connect HDMI HID touchscreen and LVDS I2C touchscreen with fix symlink
SUBSYSTEM=="input" KERNEL=="event*" ATTRS{name} =="HID 27c0:0818",       SYMLINK+="inpu
t/ts0"
SUBSYSTEM=="input" KERNEL=="event*" ATTRS{name} =="Atmel maXTouch Touchscreen",       S
YMLINK+="input/ts1"
# start qtwayland compositor
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", ENV{SYSTEMD_WANTS}
+="qtwayland@root.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="
qtwayland@root.service"

:tired_face: :tired_face: :tired_face:

root@apalis-imx8:~# ls -al /lib/systemd/system/qtwayland\@.service 
-rw-r--r-- 1 root root 511 Jun 25 10:34 /lib/systemd/system/qtwayland@.service
root@apalis-imx8-06540921:~# cat /lib/systemd/system/qtwayland\@.service 
[Unit]
Description=Qt Wayland Compositor 
RequiresMountsFor=/run
Conflicts=plymouth-quit.service
After=systemd-user-sessions.service plymouth-quit-wait.service

[Service]
User=%i
PAMName=login
Environment="QT_QPA_EGLFS_KMS_CONFIG=/etc/kms.conf"
Environment="QT_QPA_EGLFS_INTEGRATION=eglfs_kms"
Environment="QT_QPA_PLATFORM=eglfs"
Environment="QT_QPA_EGLFS_KMS_ATOMIC=1"
Environment="QT_QPA_EGLFS_NO_LIBINPUT=1"
StandardError=journal
PermissionsStartOnly=true
IgnoreSIGPIPE=no

ExecStart=/usr/bin/dual-screen.sh
root@apalis-imx8:~# 

And

root@apalis-imx8:~# ls -al /etc/udev/rules.d/71-qtwayland-drm.rules 
-rw-r--r-- 1 root root 256 Jun 25 10:40 /etc/udev/rules.d/71-qtwayland-drm.rules
root@apalis-imx8:~# cat /etc/udev/rules.d/71-qtwayland-drm.rules # start qtwayland compositor
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", ENV{SYSTEMD_WANTS}
+="qtwayland@root.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="
qtwayland@root.service"
root@apalis-imx8:~#

And

root@apalis-imx8:~#  systemctl status qtwayland@root
* qtwayland@root.service - Qt Wayland Compositor
     Loaded: loaded (/lib/systemd/system/qtwayland@.service; static; vend>
     Active: inactive (dead)
lines 1-3/3 (END)

After reboot
Hdmi output::


And LVDS output::

Hi Hami,

I have re-setup the HW/SW environment and re-test the whole dual-screen article, and finally found the issue, you can see below journalctl log output, the qt library can’ t find corresponding display resources.

root@apalis-imx8-07308034:~# journalctl |grep dual
Sep 20 11:14:15 apalis-imx8-07308034 dual-screen.sh[851]: QML debugging is enabled. Onl
y use this in a safe environment.
**Sep 20 11:14:15 apalis-imx8-07308034 dual-screen.sh[851]: drmModeGetResources failed (O**
**peration not supported)**
**Sep 20 11:14:15 apalis-imx8-07308034 dual-screen.sh[851]: Cannot create window: no scre**
**ens available**
Sep 20 11:14:15 apalis-imx8-07308034 audit[851]: ANOM_ABEND auid=4294967295 uid=0 gid=0
 ses=4294967295 pid=851 comm="dual-screen" exe="/usr/bin/dual-screen" sig=6 res=1
Sep 20 11:14:15 apalis-imx8-07308034 kernel: audit: type=1701 audit(1600600455.712:3): 
auid=4294967295 uid=0 gid=0 ses=4294967295 pid=851 comm="dual-screen" exe="/usr/bin/dua
l-screen" sig=6 res=1
Sep 20 11:14:15 apalis-imx8-07308034 kernel[773]: [   10.080736] audit: type=1701 audit
(1600600455.712:3): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=851 comm="dual-scree
n" exe="/usr/bin/dual-screen" sig=6 res=1

then after some checking, i modified the device definition in /etc/kms.conf from “/dev/dri/card0” to “/dev/dri/card1”, then after rebooting, all work fine now.

{
  "device": "/dev/dri/card1",
  "hwcursor": true,
  "pbuffers": false,
  "outputs": [
      { "name": "HDMI1",
        "mode": "1920x1080",
        "touchDevice": "/dev/input/event1",
        "virtualIndex": 0, "primary": true
      },
      { "name": "LVDS1",
        "mode": "1280x800",
        "touchDevice": "/dev/input/event3",
        "virtualIndex": 1
      }
  ]
}
~

you can check if you have the similar issue on your side.

Hello @hai.tx
Thank you very much for your answer
I just have to change /etc/kms.conf from “/dev/dri/card0” to “/dev/dri/card1”
or have to change (KERNEL==“card0”) at 71-qtwayland-drm.rules file ,too.

root@apalis-imx8:~# cat /etc/udev/rules.d/71-qtwayland-drm.rules # start qtwayland compositor
ACTION=="add", SUBSYSTEM=="graphics", KERNEL=="fb0", TAG+="systemd", ENV{SYSTEMD_WANTS}
+="qtwayland@root.service"
ACTION=="add", SUBSYSTEM=="drm", KERNEL=="card0", TAG+="systemd", ENV{SYSTEMD_WANTS}+="
qtwayland@root.service"

Thanks

Hi Hami,

Only /etc/kms.conf modification is needed on my side.

Hello @hhami ,
Do you have any updates on this topic?

Best regards,
Josep