Qt Debian Container for Torizon
Introduction
Toradex provides Qt containers with the base Qt5 libraries installed. It makes it easy for you to extend this container with your application and its dependencies. See some advantages of using this container:
- You can keep applications independent
- Use different runtimes
- Encapsulate application dependencies in the container
- It will be easier to maintain
The following containers from Toradex are available:
qt5-wayland
: minimal container with Qt5 libraries. You should use it as the base for deploying your own app.qt5-wayland-examples
: built on top ofqt5-wayland
withqtbase5-examples
andqtdeclarative5-examples
. You can use it for a great out-of-the-box evaluation experience, as described in this article.
This article complies with the Typographic Conventions for Torizon Documentation.
Prerequisites
The following prerequisites are proposed:
- Computer on Module with Torizon installed.
- Reading and understanding of Debian Containers for Torizon.
- Awareness about TorizonCore Containers Tags and Versioning.
- (optional) Basic understanding of Docker and
docker run
command options.
Executing the Containers
Run a Weston Container
Connect to the board terminal by establishing an SSH connection.
Start a Weston container which will be the graphics server. Choose your module from the tabs below and follow the instructions:
(Optional) pull the torizon/weston
container image:
# docker pull torizon/weston:$CT_TAG_WESTON
Start the weston
compositor:
# docker run -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
--device-cgroup-rule='c 226:* rmw' \
torizon/weston:$CT_TAG_WESTON --developer --tty=/dev/tty7
(Optional) pull the torizon/weston
container image:
# docker pull torizon/weston:$CT_TAG_WESTON
Start the weston
compositor:
# docker run -d --rm --ipc=host --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
--device-cgroup-rule='c 226:* rmw' \
torizon/weston:$CT_TAG_WESTON --developer --tty=/dev/tty7 -- --use-pixman
(Optional) pull the torizon/weston-vivante
container image:
# docker pull torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE
Start the weston
compositor:
Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)
# docker run -e ACCEPT_FSL_EULA=1 -d --rm --name=weston --net=host --cap-add CAP_SYS_TTY_CONFIG \
-v /dev:/dev -v /tmp:/tmp -v /run/udev/:/run/udev/ \
--device-cgroup-rule='c 4:* rmw' --device-cgroup-rule='c 13:* rmw' \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/weston-vivante:$CT_TAG_WESTON_VIVANTE --developer --tty=/dev/tty7
To learn more about the device_cgroup_rules
section of the docker-compose file above, please refer to the Hardware Access through Control Group Rules (cgroup) section of the Torizon Best Practices Guide
Run a Qt Wayland Container
Start a Qt Wayland examples container. It works on top of Wayland, as explained in Debian Containers for Torizon, and has Qt libraries. When you package your own application, use the base instead of the examples image to save flash storage space.
Select your module from the tabs below and follow the instructions:
- 32-bit SoCs (arm32v7)
- 64-bit SoCs with CPU only (arm64v8)
- 64-bit i.MX 8 SoCs with Vivante graphics acceleration (arm64v8)
The following command brings up the Qt5 Wayland container with an interactive command prompt:
# docker run --rm -it --name=qt5 \
-v /tmp:/tmp \
-v /dev/dri:/dev/dri --device-cgroup-rule='c 226:* rmw' \
torizon/qt5-wayland-examples:$CT_TAG_QT5_WAYLAND_EXAMPLES \
bash
Use the Qt Quick 2D Renderer
Inside the Qt5 Wayland container, only if you are using a module without GPU (Colibri iMX7 and Colibri iMX6ULL) and plan to also use Qt Quick, we recommend that you use the Qt Quick 2D Renderer, otherwise you may see a poor performance and high CPU load:
only export QMLSCENE_DEVICE=softwarecontext
if your module does not have a GPU!
## export QMLSCENE_DEVICE=softwarecontext
Keep in mind that there are feature limitations when using the Qt Quick 2D Renderer.
Start a Qt Sample Application (32-bit SoCs)
Inside the Qt5 Wayland container, start any of the available Qt5 sample applications:
## /usr/lib/arm-linux-gnueabihf/qt5/examples/quick/animation/animation &
or
## /usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/calculator/calculator &
or
## /usr/lib/arm-linux-gnueabihf/qt5/examples/widgets/widgets/shapedclock/shapedclock &
or
## /usr/lib/arm-linux-gnueabihf/qt5/examples/opengl/cube/cube &
The following command brings up the Qt5 Wayland container with an interactive command prompt:
# docker run --rm -it --name=qt5 \
-v /tmp:/tmp \
-v /dev/dri:/dev/dri --device-cgroup-rule='c 226:* rmw' \
torizon/qt5-wayland-examples:$CT_TAG_QT5_WAYLAND_EXAMPLES \
bash
Start a Qt Sample Application (64-bit SoCs with CPU only)
Inside the Qt5 Wayland container, start any of the available Qt5 sample applications:
## /usr/lib/aarch64-linux-gnu/qt5/examples/quick/animation/animation &
or
## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/calculator/calculator &
or
## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/shapedclock/shapedclock &
or
## /usr/lib/aarch64-linux-gnu/qt5/examples/opengl/cube/cube &
The following command brings up the Qt5 Wayland container with an interactive command prompt:
Please, note that by executing the following line you are accepting the terms and conditions of the NXP's End-User License Agreement (EULA)
# docker run -e ACCEPT_FSL_EULA=1 --rm -it --name=qt5 \
-v /tmp:/tmp \
-v /dev/dri:/dev/dri -v /dev/galcore:/dev/galcore \
--device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \
torizon/qt5-wayland-examples-vivante:$CT_TAG_QT5_WAYLAND_EXAMPLES_VIVANTE \
bash
Start a Qt Sample Application (64-bit i.MX 8 SoCs with Vivante graphics acceleration)
Inside the Qt5 Wayland container, start any of the available Qt5 sample applications:
## /usr/lib/aarch64-linux-gnu/qt5/examples/quick/animation/animation &
or
## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/calculator/calculator &
or
## /usr/lib/aarch64-linux-gnu/qt5/examples/widgets/widgets/shapedclock/shapedclock &
or
## /usr/lib/aarch64-linux-gnu/qt5/examples/opengl/cube/cube &
Executing the QT5 Containers through Portainer
The image TorizonCore with evaluation containers has many different demos. For instructions about how to install Torizon on your board, refer to Toradex Quickstart Guide. In this image, the Weston container starts automatically after boot, therefore you do not need to start it.
With Portainer opened, explore the demos by going to the App Templates section in Portainer and click on the QT template and then click on Deploy The Container
.
This demo will execute the 3D Cube example. After creating and executing the container, you can edit the container to execute other demos. To do that, click on the Containers menu and select the qt5-app container
On the container's menu, click on the Duplicate/Edit button
Edit the CMD field with the other demos' paths, as shown in the previous section, and click on the Deploy the Container button.
The demo will start as a new overlay in Weston.
More Information
Also, please watch the video session below for more information.