|
1 | 1 | <!-- Copyright © SixtyFPS GmbH <[email protected]> ; SPDX-License-Identifier: MIT -->
|
2 |
| -<!-- cSpell: ignore Torizon Toradex Vivante --> |
3 |
| -# Running Slint Demos on Torizon |
| 2 | +<!-- cSpell: ignore Torizon Toradex Vivante imx8 am62 am62p imx95 PowerVR --> |
| 3 | +# Running Slint Demos on Torizon OS |
4 | 4 |
|
5 |
| -Toradex provides [TorizonCore](https://developer.toradex.com/torizon/) a Linux based platform for its embedded devices that packages applications in docker containers. |
| 5 | +Toradex provides [Torizon OS](https://developer.toradex.com/torizon/) a Linux based platform for its embedded devices that packages applications in docker containers. |
6 | 6 |
|
7 |
| -We provide our demos compiled for Toradex as docker containers. |
| 7 | +We provide our demos compiled for Toradex as docker containers with GPU acceleration support. |
8 | 8 |
|
9 | 9 | ## Prerequisites
|
10 | 10 |
|
11 |
| - - A device running Torizon |
12 |
| - - A running [weston container](https://developer.toradex.com/torizon/5.0/provided-containers/working-with-weston-on-torizoncore) |
13 |
| - - SSH access to the Torizon device |
| 11 | +- A device running Torizon OS 6.0 or later |
| 12 | +- SSH access to the Torizon device |
| 13 | +- Docker installed on the device |
| 14 | + |
| 15 | +**Note**: The Slint demos run directly on the linux/kms and do not require a Weston container. |
14 | 16 |
|
15 | 17 | ## Running
|
16 | 18 |
|
17 |
| -Our pre-compiled demos are available in four different variants: |
| 19 | +Our pre-compiled demos are available in multiple variants optimized for different hardware platforms: |
18 | 20 |
|
19 |
| -1. Compiled for ARM 32-bit as `armhf` and compiled for ARM 64-bit as `arm64` |
20 |
| -2. Compiled with Linux DRI or with support for Vivante GPUs (`-vivante` suffix) |
| 21 | +1. **Standard ARM64 without GPU build** (`torizon-demos-arm64`) - Uses software rendering |
| 22 | +2. **i.MX8 GPU build** (`torizon-demos-arm64-imx8`) - Optimized for i.MX8 series with GPU acceleration |
| 23 | +3. **AM62 GPU build** (`torizon-demos-arm64-am62`) - Optimized for AM62 series with GPU acceleration |
| 24 | +4. **AM62P GPU build** (`torizon-demos-arm64-am62p`) - Optimized for AM62P series with GPU acceleration |
| 25 | +5. **i.MX95 GPU build** (`torizon-demos-arm64-imx95`) - Optimized for i.MX95 series with GPU acceleration |
| 26 | +6. **Vivante GPU build** (`torizon-demos-arm64-vivante`) - Legacy variant for i.MX8 with Vivante GPU acceleration |
21 | 27 |
|
22 | 28 | A complete list of all containers can be found at
|
23 | 29 |
|
24 | 30 | https://github.com/orgs/slint-ui/packages?q=torizon&tab=packages&q=torizon
|
25 | 31 |
|
26 |
| -For example to run the container on an i.MX8 board with Vivante GPU, use the following command line: |
| 32 | +### Running with Docker |
| 33 | + |
| 34 | +For i.MX8 series boards: |
| 35 | + |
| 36 | +```bash |
| 37 | +sudo docker run --rm --privileged \ |
| 38 | + --user=torizon \ |
| 39 | + -v /dev:/dev \ |
| 40 | + -v /tmp:/tmp \ |
| 41 | + -v /run/udev:/run/udev \ |
| 42 | + --device-cgroup-rule='c 199:* rmw' \ |
| 43 | + --device-cgroup-rule='c 226:* rmw' \ |
| 44 | + --device-cgroup-rule='c 13:* rmw' \ |
| 45 | + --device-cgroup-rule='c 4:* rmw' \ |
| 46 | + ghcr.io/slint-ui/slint/torizon-demos-arm64-imx8 |
| 47 | +``` |
| 48 | + |
| 49 | +For AM62 series boards with GPU: |
| 50 | + |
| 51 | +```bash |
| 52 | +sudo docker run --rm --privileged \ |
| 53 | + --user=torizon \ |
| 54 | + -v /dev:/dev \ |
| 55 | + -v /tmp:/tmp \ |
| 56 | + -v /run/udev:/run/udev \ |
| 57 | + --device-cgroup-rule='c 199:* rmw' \ |
| 58 | + --device-cgroup-rule='c 226:* rmw' \ |
| 59 | + --device-cgroup-rule='c 13:* rmw' \ |
| 60 | + --device-cgroup-rule='c 4:* rmw' \ |
| 61 | + ghcr.io/slint-ui/slint/torizon-demos-arm64-am62 |
| 62 | +``` |
| 63 | + |
| 64 | +For generic ARM64 devices without GPU acceleration: |
| 65 | + |
| 66 | +```bash |
| 67 | +sudo docker run --rm --privileged \ |
| 68 | + --user=torizon \ |
| 69 | + -v /dev:/dev \ |
| 70 | + -v /tmp:/tmp \ |
| 71 | + -v /run/udev:/run/udev \ |
| 72 | + --device-cgroup-rule='c 199:* rmw' \ |
| 73 | + --device-cgroup-rule='c 226:* rmw' \ |
| 74 | + --device-cgroup-rule='c 13:* rmw' \ |
| 75 | + --device-cgroup-rule='c 4:* rmw' \ |
| 76 | + ghcr.io/slint-ui/slint/torizon-demos-arm64 |
| 77 | +``` |
27 | 78 |
|
| 79 | +## Available Demos |
| 80 | + |
| 81 | +By default, the **energy-monitor** demo is run. The containers package multiple demo applications: |
| 82 | + |
| 83 | +- **energy-monitor** (default) - Energy monitoring dashboard |
| 84 | +- **printerdemo** - 3D printer control interface |
| 85 | +- **gallery** - Image gallery with touch navigation |
| 86 | +- **slide_puzzle** - Interactive sliding puzzle game |
| 87 | +- **opengl_underlay** - OpenGL rendering demonstration |
| 88 | +- **carousel** - 3D carousel interface |
| 89 | +- **todo** - Task management application |
| 90 | +- **weather-demo** - Weather information display (requires API key) |
| 91 | +- **home-automation** - Smart home control panel |
| 92 | + |
| 93 | +### Selecting Specific Demos |
| 94 | + |
| 95 | +Run a specific demo by specifying it as a parameter: |
| 96 | + |
| 97 | +```bash |
| 98 | +# Printer demo on i.MX8 with GPU acceleration |
| 99 | +sudo docker run --rm --privileged --user=torizon \ |
| 100 | + -v /dev:/dev -v /tmp:/tmp -v /run/udev:/run/udev \ |
| 101 | + --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \ |
| 102 | + --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 4:* rmw' \ |
| 103 | + ghcr.io/slint-ui/slint/torizon-demos-arm64-imx8 printerdemo |
| 104 | + |
| 105 | +# Gallery demo on AM62P with GPU acceleration |
| 106 | +sudo docker run --rm --privileged --user=torizon \ |
| 107 | + -v /dev:/dev -v /tmp:/tmp -v /run/udev:/run/udev \ |
| 108 | + --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \ |
| 109 | + --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 4:* rmw' \ |
| 110 | + ghcr.io/slint-ui/slint/torizon-demos-arm64-am62p gallery |
| 111 | + |
| 112 | +# Todo demo on AM62 without GPU acceleration |
| 113 | +sudo docker run --rm --privileged --user=torizon \ |
| 114 | + -v /dev:/dev -v /tmp:/tmp -v /run/udev:/run/udev \ |
| 115 | + --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' \ |
| 116 | + --device-cgroup-rule='c 13:* rmw' --device-cgroup-rule='c 4:* rmw' \ |
| 117 | + ghcr.io/slint-ui/slint/torizon-demos-arm64 todo |
28 | 118 | ```
|
29 |
| -docker run --user=torizon -v /dev:/dev -v /tmp:/tmp --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' ghcr.io/slint-ui/slint/torizon-demos-arm64-vivante |
| 119 | + |
| 120 | +### Auto-running on Boot |
| 121 | + |
| 122 | +Torizon OS supports automatically starting containers on boot by placing a `docker-compose.yml` file in `/var/sota/storage/docker-compose/` on the device. |
| 123 | + |
| 124 | +[How to Autorun an Application With Torizon OS |
| 125 | +](https://developer.toradex.com/torizon/application-development/working-with-containers/how-to-autorun-an-application-with-torizoncore/) |
| 126 | + |
| 127 | +**Step 1: Create docker-compose.yml** |
| 128 | + |
| 129 | +Create a file named `docker-compose.yml` with the following content (adjust the image variant for your platform): |
| 130 | + |
| 131 | +```yaml |
| 132 | +services: |
| 133 | + slint-demo: |
| 134 | + image: ghcr.io/slint-ui/slint/torizon-demos-arm64-imx8:latest |
| 135 | + restart: unless-stopped |
| 136 | + environment: |
| 137 | + - ACCEPT_FSL_EULA=1 |
| 138 | + - SLINT_FULLSCREEN=1 |
| 139 | + - SLINT_BACKEND=linuxkms-skia-opengl |
| 140 | + user: torizon |
| 141 | + privileged: true |
| 142 | + volumes: |
| 143 | + - type: bind |
| 144 | + source: /tmp |
| 145 | + target: /tmp |
| 146 | + - type: bind |
| 147 | + source: /dev |
| 148 | + target: /dev |
| 149 | + - type: bind |
| 150 | + source: /run/udev |
| 151 | + target: /run/udev |
| 152 | + device_cgroup_rules: |
| 153 | + # ... for tty |
| 154 | + - "c 4:* rmw" |
| 155 | + # ... for /dev/input devices |
| 156 | + - "c 13:* rmw" |
| 157 | + - "c 199:* rmw" |
| 158 | + # ... for /dev/dri devices |
| 159 | + - "c 226:* rmw" |
| 160 | + command: home-automation |
30 | 161 | ```
|
31 | 162 |
|
32 |
| -## Selecting Demos |
| 163 | +**Step 2: Deploy to Device** |
33 | 164 |
|
34 |
| -By default, the printer demo from /usr/bin is run. The containers however package multiple demos: |
| 165 | +Copy the file to your Torizon device: |
35 | 166 |
|
36 |
| - * printerdemo |
37 |
| - * slide_puzzle |
38 |
| - * gallery |
39 |
| - * opengl_underlay |
40 |
| - * carousel |
41 |
| - * todo |
42 |
| - * energy-monitor |
| 167 | +```bash |
| 168 | +# Create the directory if it doesn't exist |
| 169 | +ssh torizon@<device-ip> "sudo mkdir -p /var/sota/storage/docker-compose" |
43 | 170 |
|
44 |
| -Run then by specifying them as parameter to `docker run`, for example: |
| 171 | +# Copy the docker-compose.yml file |
| 172 | +scp docker-compose.yml torizon@<device-ip>:/tmp/ |
| 173 | +ssh torizon@<device-ip> "sudo mv /tmp/docker-compose.yml /var/sota/storage/docker-compose/" |
45 | 174 |
|
| 175 | +# Reboot to start the application automatically |
| 176 | +ssh torizon@<device-ip> "sudo reboot" |
46 | 177 | ```
|
47 |
| -docker run --user=torizon -v /dev:/dev -v /tmp:/tmp --device-cgroup-rule='c 199:* rmw' --device-cgroup-rule='c 226:* rmw' ghcr.io/slint-ui/slint/torizon-demos-arm64-vivante opengl_underlay |
| 178 | + |
| 179 | +**Platform-specific variants:** |
| 180 | +- For **i.MX8**: `ghcr.io/slint-ui/slint/torizon-demos-arm64-imx8:latest` |
| 181 | +- For **AM62 with GPU**: `ghcr.io/slint-ui/slint/torizon-demos-arm64-am62:latest` |
| 182 | +- For **AM62P**: `ghcr.io/slint-ui/slint/torizon-demos-arm64-am62p:latest` |
| 183 | +- For **i.MX95**: `ghcr.io/slint-ui/slint/torizon-demos-arm64-imx95:latest` |
| 184 | +- For **Generic ARM64**: `ghcr.io/slint-ui/slint/torizon-demos-arm64:latest` |
| 185 | + |
| 186 | +The demo will automatically start on boot and restart if it crashes. To stop auto-running, remove the file: |
| 187 | + |
| 188 | +```bash |
| 189 | +ssh torizon@<device-ip> "sudo rm /var/sota/storage/docker-compose/docker-compose.yml && sudo reboot" |
48 | 190 | ```
|
0 commit comments