Apalis IMX8 HDMI and LVDS display not mirroring/cloning

I am developing a medical device which is required to have a touchscreen display and also mirror the output to a monitor connected via HDMI. I am able to get the display extended from HDMI to LVDS, but not have the output mirrored to both displays.

  • Ixora Carrier Board
  • Apalis iMX8 QuadMax 4GB Wi-Fi / Bluetooth IT
  • Capacitive Touch Display 10.1" LVDS

I have this version of TorizonCore:

cat /etc/os-release 
ID=torizon
NAME="TorizonCore"
VERSION="6.2.0+build.2 (kirkstone)"
VERSION_ID=6.2.0-build.2
PRETTY_NAME="TorizonCore 6.2.0+build.2 (kirkstone)"
DISTRO_CODENAME="kirkstone"
BUILD_ID="2"
ANSI_COLOR="1;34"
VARIANT="Docker"

I updated the device tree:

cat  /sysroot/boot/ostree/torizon-fde04e5dc537e7d0fb52b2b3582fcf35a6a4c9a662edf9914167a2bada0feb30/dtb/overlays.txt
fdt_overlays=apalis-imx8_panel-cap-touch-10inch-lvds_overlay.dtbo apalis-imx8_hdmi_overlay.dtbo

cat /proc/cmdline
pci=nomsi root=LABEL=otaroot rootfstype=ext4 quiet logo.nologo vt.global_cursor_default=0 plymouth.ignore-serial-consoles splash fbcon=map:3 ostree=/ostree/boot.0/torizon/fde04e5dc537e7d0fb52b2b3582fcf35a6a4c9a662edf9914167a2bada0feb30/0

ls /sysroot/boot/ostree/torizon-fde04e5dc537e7d0fb52b2b3582fcf35a6a4c9a662edf9914167a2bada0feb30/dtb/overlays:
apalis-imx8_ar0521_overlay.dtbo
apalis-imx8_hdmi_overlay.dtbo
apalis-imx8_mezzanine_can_overlay.dtbo
apalis-imx8_mezzanine_ov5640_overlay.dtbo
apalis-imx8_mezzanine_panel-cap-touch-10inch-lvds_overlay.dtbo
apalis-imx8_ov5640_overlay.dtbo
apalis-imx8_panel-cap-touch-10inch-lvds_overlay.dtbo
apalis-imx8_panel-lvds-dual-channel-1080p_overlay.dtbo
apalis-imx8_resistive-touch_overlay.dtbo
apalis-imx8_spi1_spidev_overlay.dtbo
apalis-imx8_spi2_spidev_overlay.dtbo
display-dpi-lt170410_overlay.dtbo
display-edt5.7_overlay.dtbo
display-edt7_overlay.dtbo
display-fullhd_overlay.dtbo
display-lt161010_overlay.dtbo
display-lt170410_overlay.dtbo
display-vga_overlay.dtbo

I am starting the (flutter) application with the following command:
docker-compose.gallery.yaml (1.5 KB)

docker-compose -f docker-compose.gallery.yaml up

When I enter the running weston docker container, I can see the following:

ls /sys/class/drm
card0  card1  card1-HDMI-A-1  card1-LVDS-1  renderD128              renderD129  version
cat /sys/class/drm/card1-HDMI-A-1/status
connected
cat /sys/class/drm/card1-HDMI-A-1/enabled
enabled
cat /sys/class/drm/card1-LVDS-1/enabled
enabled
cat /sys/class/drm/card1-LVDS-1/status
connected
cat  /sys/class/drm/card1-HDMI-A-1/modes|sort -u
1024x768
1152x864
1280x1024
1280x720
1600x1200
1600x900
1920x1080
2048x1080
2560x1440
640x480
720x400
720x480
720x576
800x600
cat  /sys/class/drm/card1-LVDS-1/modes
1280x800

When I run with the default weston.ini file, the displays are extended.
orig.weston-dev.ini.txt (1.2 KB)
orig.beta-weston-stdout_2023-06-20_22-11-28.txt (11.5 KB)

I then changed the Weston.ini file, with the same results (following High performance, low power Embedded Computing Systems | Toradex Developer Center ):

[output]
name=HDMI-A-1
same-as=LVDS-1

weston.ini-2023-06-20_22-18-24.txt (1.3 KB)
beta-weston-stderr_2023-06-20_22-18-24.txt (11.5 KB)

And also:

[output]
name=LVDS-1
same-as=HDMI-A-1

weston.ini-2023-06-20_22-23-09.txt (1.3 KB)
beta-weston-stdout_2023-06-20_22-23-09.txt (23.6 KB)

Is the problem related to different resolutions? There don’t seem to be matching resolutions in the “mode” of the two interface.

Solutions?

Greetings @dawnhowe_alten,

Unfortunately this is a limitation with how the same-as property works in Weston. The same-as property is very literal, it doesn’t just copy the display output from one display to another. It tries to use the same display settings between both displays. Obviously this doesn’t work very well unless the two displays are the exact same model or very similar. Especially in your case where the two displays are completely different display interfaces (LVDS & HDMI), it’s not surprising this property doesn’t work.

As seen it’s a known issue even in the upstream Weston project: Clone mode with independent CRTCs (#333) · Issues · wayland / weston · GitLab

It does appear there have been efforts to create a more proper cloning method: WIP: compositor: enabling independent crtc clone output in weston (!381) · Merge requests · wayland / weston · GitLab

But far as I can tell none of these have actually been properly merged into Weston.

In short, this seems to be a technical limitation with Weston at the moment, with no official solution.

Best Regards,
Jeremias

@jeremias.tx,
Thanks for the response.

I found this post in the NXP forums that implies it may be possible: https://community.nxp.com/t5/i-MX-Processors/Using-HDMI-as-mirror-of-primary-lvds-display/m-p/1397527

I was not able to follow the solution because I’m not sure how to make the uboot changes with TorizonCore, and –clone-mode is not an option on weston-launch which is called from my docker-compose yaml file. I’m not sure if the version of weston in the Docker image is the same as what is referenced in the post. Do you have any ideas?

Thanks,
Dawn

I was not able to follow the solution because I’m not sure how to make the uboot changes

Well the bootloader changes described in that forum post applies to i.MX6 based modules. So it’s not really applicable to your case since the i.MX8 has a much different display stack.

–clone-mode is not an option on weston-launch which is called from my docker-compose yaml file. I’m not sure if the version of weston in the Docker image is the same as what is referenced in the post. Do you have any ideas?

Now here’s where I’m confused. I don’t know where this “clone-mode” option comes from exactly. I checked the upstream Weston source and even the weston-imx fork and nowhere in either code-base is there a “clone-mode” even mentioned. I can’t even find any solid reference to this option searching online. So I’m not exactly sure where that forum post got this from.

Best Regards,
Jeremias

@jeremias.tx,

I posted a query on the wayland-devel mailing list, and it appears a solution may be available soon. Keep an eye on this thread: Weston mirror/clone to 2 different displays

Enjoy,
Dawn

So it seems like the upstream team is still working on efforts to integrate better cloning capabilities into Weston. Once such a change is done we’ll need to see the possibility of back-porting such a change ourselves. Though it might not be as straightforward as that since technically we use a fork called “weston-imx” from NXP and not the upstream Weston itself.

Best Regards,
Jeremias

Hi @bjorn_helgaas,

Could you please open a different thread regarding this question

Hi @dawnhowe_alten ,

Did you find the solution for this issue? Could you please share it?. I also have the same issue. Many thanks.

I do not have any information further than what is in this thread. I am hoping that a fix is made to Weston in time for my development. I am able to get the displays to extend, rather than mirror and am considering writing my output twice to this extended canvas (I am implementing my GUI in Flutter and am considering a solution such as Flutter Desktop Multi Monitors - Stack Overflow, but do not know if I will have issues with touch yet, as we have not chosen our display). Another option to consider is to use a different compositor than Weston, such as Sway. The flutter-elinux developer just updated the wayland instructions to use sway instead of weston (weston was the recommendation when I started looking into this). GitHub - sony/flutter-elinux: Flutter tools for embedded Linux (eLinux). I do not know what support there is for Sway on the iMX8, but this may be a topic for another thread.

thanks,
Dawn

Hi All,

I configured successfully for clone / mirror mode. Thank you all.

I follow below link to apply the patch.

https://gitlab.freedesktop.org/wayland/weston/-/issues/333
https://gitlab.freedesktop.org/wayland/weston/-/merge_requests/381

And add clone-from section:

[output]
name=LVDS-1
mode=1920x1080@60

[output]
name=HDMI-A-1
clone-from=LVDS-1

This is my patch:
clone-from-LVDS-to-HDMI.patch (34.7 KB)

After rebuild yocto and install new image. The clone should work.

Thank you for sharing your results. I’m a bit surprised that old merge request still just works, but I appreciate your efforts to test this.

Best Regards,
Jeremias

Hi @jeremias.tx
Can someone help me in this issue ?

I got an error while applying the patch. For which version did you apply the patch?

Hi !, this is for weston v_9.0.0

Hi,

Thanks, the patch works fine. But the screen on the secondary display appeared rotated 90 degrees. The “transform-rotate” option did not work together with the “clone-from” command.

The main screen is vertical and has a resolution of 800x1280. How can I position the vertical screen in the middle of the secondary screen (HDMI-1-A & 1920x1080) so that the sides remain empty?
Even if I could do this, would it make sense to follow the blog post in the link?

Best Regards