I need advices on Wayland/EGLFS/QT. I am using Verdin Development Board with two HDMI display output (HDMI, HDMI via MIPI DSI). The OS is Yocto (Toradex EmbeddedLinux Reference Multimedia Image). My goal is to launch two separate Qt applications as full screen on each of HDMI displays.
After power-up, Weston desktop appears on each display. The two display screens are connected as I can move over the mouse.
To check if I can specify the target display of Qt application, I login to the Linux with putty, and executed /usr/share/qtsmarthome-1.0/smarthome. The program always show up in the default HDMI display (HDMI via DSI - card0-HDMI-A-1) instead of card0-HDMI-A-2.
I tried the followings before launching the program.
set Wayland environment variables (WAYLAND_DISPLAY, DISPLAY)
set Qt environment variables (QT_QPA_PLATFORM, QT_QPA_EGLFS_KMS_CONFIG)
edit Weston configuration file - /etc/xdg/weston/weston.ini
but nothing seems to be effective.
My questions are
Is there any way to control the target display when Qt program is launched?
What platform should be set for QT_QPA_PLATFORM? Setting eglfs gives error.
Hi @kazu , sorry for the late reply, this fell under my radar. Let me check and we will get back you you. I remember doing this some time ago (but with direct frame buffer and EGLFS).
Because Wayland probably wraps everything together so you should control this within your Qt application. Did you check this example from Qt for multiscreen in Wayland?
You should still use Wayland, so the default QT_QPA_PLATFORM is fine. EGLFS is not added by default to our BSP.
Thank you for response and suggestion. Unfortunately, we use Qt Widget instead of QML for the application program. So, QML example of Qt Wayland is not applicable. It may be possible to select screen or move the screen position in Qt Widget. On Toradex Yocto, wayland, wayland-egl and xcb seem to be supported as QT_QPA_PLATFORM.
Thanks for the answer @kazu. Just to understand the situation, you can create a Qt Widget application that you can move freely between both screens, right? (Like have half of the application in one screen, and another half in the other one).
So it would be a matter to have 2 application start at each screen, correct?
What is the screenWidth and screenHeight value for the following code?
int screenWidth;
int screenHeight;
QApplication *desktop = QApplication::desktop();
screenWidth = desktop->width();
screenHeight = desktop->height();
*In Qt 6, it seems QApplication::desktop() was deprecated…
A mouse can be moved across the two HDMI displays now. In the real implementation, the external displays will be LVDS and RGB with different resolution. We have legacy application with Qt5, and Qt6 won’t be used.
I will post it once I successfully experiment it.
Hello, I have conducted some testings with Qt5.14 program.
Two HDMI displays of the same resolution are connected to Verdin development board.
By default, Weston desktop appears on each display.
[platform=wayland]
two screens detected. QGuiApplication::screens().size() works.
cannot show a widget in a selected screen. It shows up in a main screen.
setScreen() is executed, but has no effect.
cannot move widget across screens (can do it with a mouse. but not by program).
setGeometry() does not work across the screens.
[platform=xcb]
same as above except that setGeometry() can be used to move a widget from one screen to the other screen.
other findings
showFullScreen is only effective on main screen.
main display seems to be changed by mouse click.
Hi @kazu , thanks for the detailed test information. We will try to do some checks here, but since this seems to be related to the Qt application configuration, did you also publish this on the Qt Forum?
Hi @kazu , thanks for the infomation. We have been making some tests and we have replicated your issue. We are also trying to contact Qt from other non-standard channels to see if they have a solution.
So far, it seems xcb might be the solution to go… Any reason why you want to avoid this? The performance might not be as good as wayland-egl, but should be good enough in many cases.
Thank you for testing and contacting Qt team.
setGeometry appears to be quite ad-hoc, and xcb is not yet a final solution until it is fully tested. e.g. - two displays with different resolution, hiding a weston tool bar on the secondary screen, and so on.
Thank you for all the efforts for my question. We slow down a bit on the this problem recently, but will continue to investigate. If we find something new, I will post it for the community.
Thank you for the information. I tried with two HDMI displays with different resolutions. The app-id and kiosk-mode perfectly worked without the help of xcb platform. BTW, if only one display is connected and detected, both applications will be launched on the same display regardless of the configuration in weston.ini file.