[Interest] Qt examples and primary screen

Mylène Josserand mylene.josserand at bootlin.com
Fri Dec 14 15:16:23 CET 2018

Hello everyone,

I need some hints about some behaviors I have while running Qt
examples. Here is my setup:
   - a custom embedded platform based on IMX6
   - Qt 5.11
   - 2 displays: HDMI and LVDS
   - a touchscreen on top of the LVDS
   - want to be able to use only LVDS, only HDMI or both LVDS and HDMI
     with cloning
   - OpenGL support

To be able to choose between the different displays, we use json files,
exported with QT_QPA_EGLFS_KMS_CONFIG variable:

    - Both LVDS and HDMI:
	  "device": "/dev/dri/card1",
	  "outputs": [
	      {"name": "HDMI1",	"mode": "1024x768", "primary":
	      false, "clones": "LVDS1" },
	      { "name": "LVDS1", "mode": "1024x768", "primary": true } ]

   - only LVDS:
	{ "device": "/dev/dri/card1", 
	  "outputs": [
	     { "name": "HDMI1", "mode": "1920x1080", "primary": false },
	     { "name": "LVDS1", "mode": "1024x768", "primary": true } ]

   - only HDMI:
	{ "device":"/dev/dri/card1", 
	  "outputs": [
	     { "name": "HDMI1", "mode": "1920x1080", "primary": true },
	     { "name": "LVDS1", "mode": "1024x768", "primary": false } ]

After testing Qt examples, I noticed two different behaviors:
   1.) Cloning is working fine, touchscreen is working on every
   configuration: on "Qt5_CinematicExperience" and "hellowindow"
   2.) Cloning is not working, touchscreen is working only on HDMI's
   setup and application is shown on HDMI when LVDS is the primary
   screen: on "hellogl2", "contextinfo", "cube"

The second case is the one I need help with. On these examples, I got
the following behaviors according to the primary screen used:

    - Cloning LVDS on HDMI reports an error:
	"Screen HDMI1 clones another screen. swapBuffers() not allowed."

    - HDMI as primary: everything works correctly. The application is
      shown on HDMI display and the touchscreen is working fine.

    - LVDS as primary: the application is shown on HDMI instead of LVDS
      as expected. The touchscreen is not working at all.

We looked at these examples and they do not seem to use QML or
QWindow. They are using a QWidget and it seems that it is not taken
into account the primary screen. According to QWindow's description,
this is normal for an application to use a QWidget directly.

"An application will typically use QWidget or QQuickView for its UI, and
not QWindow directly."

Is it correct?
What should we implement to have the same behavior on examples that
are using QWidget than the ones using a QWindow (such as
"hellowindow")? Is it possible?

Thank you in advance for any help!


Mylène Josserand, Bootlin
Embedded Linux and Kernel engineering

More information about the Interest mailing list