setup:
weston container
app1 container
app2 container
can not get app2 to draw on weston
setup:
weston container
app1 container
app2 container
can not get app2 to draw on weston
Hi, Iām the Toradex AI Assistant. The Toradex Support team will follow up with you shortly!
Did you like my answer?
To run applications on two displays using Weston on Torizon, you need to ensure that each application is directed to the correct display. Hereās a step-by-step guide to achieve this setup:
Identify the App IDs:
Each Wayland application can set an app ID. You need to find out the app ID for each of your applications. You can do this by running the application with the WAYLAND_DEBUG
environment variable set.
WAYLAND_DEBUG=1 ./your-application
Look for the set_app_id
request in the output. For example, you might see something like:
[123456.789] -> wl_surface@4.set_app_id("app1")
Here, app1
is the app ID.
Configure weston.ini
:
Edit the weston.ini
file to specify which display each application should use. Hereās an example configuration:
[core]
shell=kiosk-shell.so
[output]
name=HDMI-A-1
mode=1920x1080
[output]
name=HDMI-A-2
mode=1920x1080
[kiosk-shell]
app-id=app1
output=HDMI-A-1
[kiosk-shell]
app-id=app2
output=HDMI-A-2
In this example:
HDMI-A-1
and HDMI-A-2
are the names of the displays.app1
and app2
are the app IDs for your applications.[kiosk-shell]
section directs an application to a specific display.Run the Weston Container:
Ensure the Weston container is running with the updated weston.ini
file. You can bind mount the weston.ini
file if you are in the prototyping phase:
docker run -d --rm --name=weston --net=host -v /path/to/your/weston.ini:/etc/xdg/weston/weston.ini torizon/wayland-weston
Run Your Application Containers:
Start your application containers, ensuring they are set to use Wayland and have the correct app ID.
docker run -d --rm --name=app1 --net=host -e WAYLAND_DISPLAY=wayland-0 -e WAYLAND_DEBUG=1 your-app1-image
docker run -d --rm --name=app2 --net=host -e WAYLAND_DISPLAY=wayland-0 -e WAYLAND_DEBUG=1 your-app2-image
weston.ini
file match those set by your applications.HDMI-A-1
, HDMI-A-2
) using weston-info
inside the Weston container.By following these steps, you should be able to run app1
on one display and app2
on another display using Weston on Torizon.
Please, also check if these links can help you solve your problem:
Here are our app ids:
torizon@verdin-imx8mp-15207741:~$ docker compose run --rm -e WAYLAND_DEBUG=1 infotainment 2>&1 | grep set_app_id
[3625339.789] -> xdg_toplevel@24.set_app_id("StarOSApp")
^C
torizon@verdin-imx8mp-15207741:~$ docker compose run --rm -e WAYLAND_DEBUG=1 dash 2>&1 | grep set_app_id
[3645913.156] -> xdg_toplevel@24.set_app_id("StarDashApp")
Here is our weston.ini
[core]
idle-time=0
require-input=false
xwayland=true
modules=screen-share.so
shell=kiosk-shell.so
#require-outputs=all-found
[shell]
panel-position=top
locking=false
allow-zap=true
num-workspaces=1
[output]
name=HDMI-A-2
mode=preferred
app-ids=StarDashApp
[output]
name=HDMI-A-1
mode=preferred
app-ids=StarOSApp
Both screens show as connected:
torizon@verdin-imx8mp-15207741:~$ cat /sys/class/drm/card0-HDMI-A-1/status
connected
torizon@verdin-imx8mp-15207741:~$ cat /sys/class/drm/card0-HDMI-A-2/status
connected
Here is the screen setup from the weston-info
call:
interface: 'zxdg_output_manager_v1', version: 2, name: 4
xdg_output_v1
output: 22
name: 'HDMI-A-2'
logical_x: 1920, logical_y: 0
logical_width: 1920, logical_height: 1080
xdg_output_v1
output: 21
name: 'HDMI-A-1'
logical_x: 0, logical_y: 0
logical_width: 1920, logical_height: 1080
We can run each container on its own but if we run them at the same time, we just get a 139 exit code:
torizon@verdin-imx8mp-15207741:~$ docker stats --no-stream
CONTAINER ID NAME CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
3a0b29ca1608 live-infotainment-1 44.68% 111MiB / 7.754GiB 1.40% 3.43kB / 0B 0B / 61.4kB 9
7e96d7a3546c live-weston-1 16.12% 18.26MiB / 7.754GiB 0.23% 0B / 0B 32.8kB / 307kB 11
torizon@verdin-imx8mp-15207741:~$ docker compose up dash --no-deps
[+] Running 1/1
ā dash Pulled 0.7s
[+] Running 1/0
ā Container live-dash-1 Created 0.0s
Attaching to live-dash-1
live-dash-1 | Loaded language: "en"
live-dash-1 | Font "Inter-Bold.ttf" loaded
live-dash-1 | Font "Inter-Medium.ttf" loaded
live-dash-1 | Font "Inter-Regular.ttf" loaded
live-dash-1 | Font "Inter-SemiBold.ttf" loaded
live-dash-1 exited with code 139
Hi @sebastian-verge !
Have you tried following the Working with Weston on Torizon OS | Toradex Developer Center? Specifically the Multi-Display section.
I just tried the Single-DRM approach listed there and it worked for me.
Just one catch: the weston.ini of the torizon-samples repository did a small mistake where the the app-ids
is repeated. For that specific demo, you need to replace org.qt-project.animation
with capp
on one of the outputs. I just submitted a PR to fix it. Here it is for your reference: Fix app-ids to display the tic-tac-toe app by griloHBG Ā· Pull Request #32 Ā· toradex/torizon-samples Ā· GitHub
As I tested on dual HDMI, I also had to modify the output names (just like you did. you know the drill )
For reference, here is my setup:
See the photo below with the result: tic-tac-toe on the left (capp
- 4k LG monitor - native HDMI from) and the Qt app (org.qt-project.animation
- OBS running on my notebook - HDMI to DSI adapter).
Please let us know if this helps you
Best regards,
Hi @henrique.tx!
Thank you for the reply!
I can get the demo app working, and I can move the app around the outputs. With our apps on the other hand, I cannot move the app around:
[output]
name=HDMI-A-2
app-ids=StarDashApp,org.qt-project.animation
[output]
name=HDMI-A-1
app-ids=StarOSApp,capp
[output]
name=HDMI-A-2
app-ids=StarOSApp,capp
[output]
name=HDMI-A-1
app-ids=StarDashApp,org.qt-project.animation
[output]
name=HDMI-A-2
app-ids=StarDashApp,org.qt-project.animation
[output]
name=HDMI-A-1
app-ids=StarOSApp,capp
[output]
name=HDMI-A-2
app-ids=StarOSApp,capp
[output]
name=HDMI-A-1
app-ids=StarDashApp,org.qt-project.animation
I posted the app id output (I found that using the command from the dock you referenced) which in our case is:
[2604330.484] -> xdg_toplevel@24.set_app_id("StarDashApp")
The only difference between the two docker compose files I have are:
Can you suggest where I should start looking next?
Thanks,
Seb
Hi @sebastian-verge !
Thanks for testing the demo and for the additional information.
Is it possible that your Qt app is simply āforcingā its way to one of the outputs?
I donāt even know if this is possible, but I know that using Qt you can quite some flexibility to define some behaviors in your application.
Maybe you can enable and check the debug log of your applications as well as check the logs from Weston by enabling the WAYLAND_DEBUG
environment variable.
My line of thought: since the demo is working as expected for you, there might be something specific to your application that is ābreakingā the desired behavior.
One other thing you could try: write a very simple hello-world GUI application using Qt (as simple as possible like some colored background with a button in the middle) and try to put it on each of the displays. You can do one with e.g. blue background and the other red, so you know which is which. This simple test might give you some clue about what is going on with your application.
Best regards,
Hi @henrique.tx,
I have managed to get a little further, but I have hit a little bit of a wall again
So, the first, the things that worked!
One thing I have also noticed is that you can have all your apps on the same screen, they just cover each other.
[core]
idle-time=0
require-input=false
xwayland=true
shell=kiosk-shell.so
[shell]
background-image=/bg.png
background-color=0xFF00FF00
panel-color=0xFF00FF00
panel-position=none
locking=false
allow-zap=true
num-workspaces=1
[output]
name=HDMI-A-1
mode=preferred
app-ids=StarDashApp,capp
[output]
name=HDMI-A-2
mode=preferred
transform=rotate-90
app-ids=StarOSApp
Secondly, the further questions I have:
We have run the second app with WAYLAND_DEBUG=1
, and QT_DEBUG_PLUGINS=1
but everything seems normal there. (I can email that to you if it helps?)
Many thanks,
Seb
Hi @sebastian-verge !
Great news!
So guessed correctly! It is nice to shoot some correct guess from time to time hahaha
Just to be sure here: the āApp 1 (Output 1) + Tic Tac Toe (Output 2)ā picture shows the Output 1 (with App 1) completely blackā¦ Is that working correctly?
If yes, then nice!
EDIT: ohā¦ okā¦ this is related to the 139 segfault, right? please ignore
Now to the open points:
My first guess would be that maybe the weston.ini
being picked up could be the developer one (Working with Weston on Torizon OS | Toradex Developer Center) instead of yours. But since you are playing around with the position of the applications and it is working well, this must not be the case.
After some trial and error from my side (which started to drive me crazy ), I realized that the culprit was the shell=kioski-shell.so
. I simply commented it out and I could get my background-image
working .
Could you please try on your side?
Disclaimer: I know that in order to use app-ids
, kiosk-shell is needed (reference: weston.ini(5) ā Arch manual pages). So since I guess that having the applications on their correct display is more important than the background imageā¦ seems like there is not much to do besides simply do not use background-image
.
Regarding the background-color
, it is working as expected on my side. Your weston.ini
is using background-color=0xFF00FF00
, which is the green color. It is showing green for me.
Side note: using 0xFF00FF00
or 0x0000FF00
has the same outcome, so the alpha (since the hexa means 0xAARRGGBB
) is not doing much. 0x00FF00
gives the same result, so 0xAARRGGBB
seems not to be mandatory (weston.ini(5) ā Arch manual pages).
This is from your own application/container live-dash-1, right?
This one is hard for me to help. This could be caused by so many issues related to the applicationā¦ My recommendation is to debug it. Also, just being paranoid, you can check the the dependencies for your application are all there and are in the expected version.
Best regards,
Hi @matti.paksula and @sebastian-verge !
Do you have any update here?
Were you able to make any progress?
Best regards,
Hi @henrique.tx
Sorry for the slower reply!
We did have some success, it seems that simply delaying the startup of the second application (by around 15 seconds) stopped the seg fault in its tracksā¦
We have made a simple āhello worldā app pair that displays on both screens and does not have the segfault issue implying its something in the application itself.
The code for that is here if anyone is interested: GitHub - vergemotorcycles/hello-world
This is obviously not quite the solution we were hoping for, but itās the best we currently have! We are going to return to try to work out why this happens later.
Thank you for your help
Hi @sebastian-verge !
Thanks for sharing your approach!
Hopefully it will help others in the same situation
I will mark your message as the solution.
Best regards,