| 1 | [[PageOutline]] |
| 2 | |
| 3 | |
| 4 | = Venice Multimedia Connectivity |
| 5 | |
| 6 | The GW720x and GW730x boards have a 50-pin MIPI Media Connector with the following signalling: |
| 7 | * 4-lane (4D+C) CSI (supports a maximum bitrate of 1.5Gbps on IMX8MM) |
| 8 | - Allows for camera / video input to the SBC |
| 9 | * 4-lane (4D+C) DSI (supports a maximum bitrate of 1.5Gbps on IMX8MM; up to 1080p60 display) |
| 10 | - Allows for a LCD Display to be connected to the SBC |
| 11 | * Bi-directional I2S audio |
| 12 | * 1x I2C |
| 13 | * 4x GPIO (can be used for enables, resets, interrupt) |
| 14 | |
| 15 | The GW16136 !RaspberryPi Camera and Display Adapter connects to the GW720x and GW730x boards 50-pin MIPI Media connector and provides the following (see [https://datasheets.raspberrypi.com/rpi4/raspberry-pi-4-reduced-schematics.pdf RaspberryPi v4 schematics for details]): |
| 16 | * 15pin Camera Interface with 2-lane MIPI CSI, 1x GPIO, 1x I2C (MX8MM I2C3) |
| 17 | - MIPI_GPIO4 is IMX8MM GPIO1_01 |
| 18 | - Note the pin numbers on the connector silkscreen are flipped |
| 19 | * 15pin Display Interface with 3-lane MIPI CSI, 1x I2C (MX8MM I2C3) |
| 20 | - MIPI_GPIO3 is connected to IMX8MM GPIO4_01 via 1Kohm |
| 21 | - MIPI_GPIO1 is connected to IMX8MM GPIO4_04 via 1Kohm |
| 22 | - Note the pin numbers on the connector silkscreen are flipped |
| 23 | |
| 24 | == Kernel Support |
| 25 | Support for IMX8MM MIPI CSI capture, MIPI DSI display, and VPU VP8/H264 decode are added to the downstream 5.15-venice Gateworks kernel via patches. |
| 26 | |
| 27 | While IMX8MM MIPI CSI support will be in the mainline v5.17 kernel, the MIPI DSI support in mainline is still being worked on. While there is support for the IMX8MM VPU decode making its way upstream there is no support currently for the IMX8MM VPU encoder. |
| 28 | |
| 29 | For more info on IMX8MM kernel support see [wiki:venice#linux venice#linux] |
| 30 | |
| 31 | [=#display] |
| 32 | = Venice Video Display |
| 33 | The IMX8M Mini SoC supports the following video display hardware capabilities: |
| 34 | - LCDIF Display controller supporting up to 1920x1200p60 via 4-lane MIPI DSI (operating up to a max bit rate of 1.5 Gbps) |
| 35 | - 3D GPU Core supporting: |
| 36 | * OpenGL ES 1.1, 2.0 |
| 37 | * OpenVG 1.1 |
| 38 | * !TrustZone support using a local MMU to manage secure regions |
| 39 | - 2D GPU Core supporting: |
| 40 | * multi-source composition |
| 41 | * one-pass filter |
| 42 | |
| 43 | == Compatible display devices |
| 44 | Display Devices: |
| 45 | - [https://www.dfrobot.com/product-2193.html DFROBOT DFR0678 7" 800x480 TFT Raspberry Pi DSI Touchscreen] |
| 46 | * [https://dfimg.dfrobot.com/nobody/wiki/e9efcd5bf561db9b20d2101c160aaa65.pdf schematics] |
| 47 | - [https://www.dfrobot.com/product-1784.html DFROBOT DFR0550 5" 800x480 TFT Raspberry Pi DSI Touchscreen] |
| 48 | * [https://dfimg.dfrobot.com/nobody/wiki/208d6cf05cacd2ee3b349341d5bfd6e2.pdf schematics] |
| 49 | |
| 50 | both of these displays consist of almost identical hardware: |
| 51 | - STM32F103C8T6-LQFP48 Microncontroller for backlight providing a backlight enable GPIO (on/off) - there is a physical thumbwheel to adjust brightness |
| 52 | - FT5316 I2C touchscreen controller without IRQ (requires a driver patch to allow 'polling' the controller); however the FT5x06 I2C runs 'through' the MCU which polls it and presents some different I2C API on the 15pin PFC I2C |
| 53 | - 800x480 WVGA TFT LCD panel |
| 54 | - ICN6211 MIPI-DSI bridge (MIPI DSI to MIPI DBI up to WXGA resolution); appears to be TC358762 compatible after the MCU configures it via I2C on power-up |
| 55 | |
| 56 | The Linux drivers for these displays are: |
| 57 | - regulator: |
| 58 | - CONFIG_REGULATOR_RASPBERRYPI_TOUCHSCREEN_ATTINY=y drivers/regulator/rpi-panel-attiny-regulator.c rpi_panel_attiny_regulator.ko |
| 59 | - touchscreen: |
| 60 | - CONFIG_TOUCHSCREEN_EDT_FT5X06 edt-ft5x06.ko |
| 61 | - MIPI DSI / DRM: |
| 62 | - CONFIG_DRM drm.ko |
| 63 | - CONFIG_DRM_PANEL_SIMPLE drivers/gpu/drm/panel/panel-simple.c panel_simple.ko |
| 64 | - CONFIG_DRM_TOSHIBA_TC358762 drivers/gpu/drm/bridge/tc358762.c tc358762.ko |
| 65 | - CONFIG_DRM_MXSFB=y drivers/gpu/drm/mxsfb/ mxsfb.ko |
| 66 | - CONFIG_LOGO=y (optional; if you want the tux) |
| 67 | - CONFIG_DRM_SAMSUNG_DSIM=y drivers/gpu/drm/bridge/samsung-dsim.c samsung-dsim.ko (changes required that are not yet in mainline) |
| 68 | - CONFIG_DRM_SAMSUNG_DSIM_IMX=y drivers/gpu/drm/bridge/samsung-dsim-imx.c samsung-dsim-imx.ko (not yet in mainline) |
| 69 | - CONFIG_PHY_EXYNOS_MIPI_VIDEO=y drivers/phy/samsung/phy-exynos-mipi-video.c phy_exynos_mipi_video.ko (not yet in mainline) |
| 70 | |
| 71 | Device-Tree changes: |
| 72 | - to add a device to your system you must properly configure your device-tree to describe how the device is connected to the host processor and other peripherals. Often this is most easily done via a device-tree overlay. The Gateworks venice kernels have dt overlays that support the DFROBOT 5in and 7in displays on the GW720x and GW730x boards. The dt overlay can be applied to the dt prior to booting the kernel by U-Boot. For example on a GW730x: |
| 73 | {{{#!bash |
| 74 | setenv fdt_overlays imx8mm-venice-gw73xx-0x-rpidsi.dtbo |
| 75 | saveenv |
| 76 | }}} |
| 77 | |
| 78 | The Linux runtime devices: |
| 79 | - /sys/class/backlight/7inch-touchscreen-panel-bl/ - back-light controller |
| 80 | - /sys/class/regulator/regulator.9/ - tc358762-power |
| 81 | - /sys/class/input/input1/ /dev/input/event1 - generic ft5x06 (79) |
| 82 | - /sys/class/drm/card0 |
| 83 | - /sys/class/drm/card0-DPI-1 |
| 84 | - /sys/class/graphics/fb0 - mxsfb_drv.c |
| 85 | |
| 86 | Notes: |
| 87 | - no kernel cmdline needed for video out |
| 88 | - samsung-dsim-imx does not currently load by itself. Work around this by adding it to /etc/modules |
| 89 | {{{#!bash |
| 90 | # update /etc/modules to load them on boot |
| 91 | echo "samsung-dsim-imx" >> /etc/modules |
| 92 | }}} |
| 93 | |
| 94 | |
| 95 | [=#qt5] |
| 96 | == Hardware Accelerated Qt5 |
| 97 | see [wiki:qt] |
| 98 | |
| 99 | [=#desktop] |
| 100 | == Hardware Accelerated Desktop UI |
| 101 | While it is not typical to use an embedded system with a desktop UI we often are asked how to do it. |
| 102 | |
| 103 | With the Ubuntu Focal (20.04) all the software is in place to give you 2D and 3D hardware acceleration on the IMX8MM with a modern kernel such as the Linux 5.15-venice kernel. |
| 104 | |
| 105 | Here are the steps to add a desktop UI: |
| 106 | 1. Add a USB mouse and keyboard to your hardware configuration |
| 107 | 1. Add a compatible display to your hardware configuration |
| 108 | 1. add samsung-dsim-imx to /etc/modules (if you have not done so already) |
| 109 | {{{#!bash |
| 110 | echo samsung-dsim-imx >> /etc/modules |
| 111 | }}} |
| 112 | 1. add a non-root user (required to login) |
| 113 | {{{#!bash |
| 114 | adduser gateworks |
| 115 | }}} |
| 116 | 1. add packages |
| 117 | {{{#!bash |
| 118 | apt update |
| 119 | apt install gnome-session gnome-terminal # installs about 1.5GB of packages |
| 120 | reboot # sync filesystem and reboot |
| 121 | }}} |
| 122 | * you'll notice dragging opaque windows around is fairly smooth as it is using hardware 2D acceleration |
| 123 | * Network manager will not allow access to interfaces in the GUI with "ifupdown" installed. If you plan to use network functions within the GUI you will need to remove/purge this package first. All network settings must be configured using the terminal. |
| 124 | 2. 3D opengl hardware acceleration: |
| 125 | {{{#!bash |
| 126 | apt install mesa-utils glmark2 |
| 127 | glxgears |
| 128 | glmark2 |
| 129 | }}} |
| 130 | - Note you need to run glxgears from a terminal on the display |
| 131 | - glxgears shows ~160 fps on IMX8MM |
| 132 | - glmark2 score is 39 on IMX8MM |
| 133 | 3. GStreamer Video display |
| 134 | {{{#!bash |
| 135 | apt-get install gstreamer1.0-x gstreamer1.0-tools \ |
| 136 | gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ |
| 137 | gstreamer1.0-libav gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 v4l-utils |
| 138 | # using glvideosink will render 'within' GUI |
| 139 | gst-launch-1.0 videotestsrc ! autovideosink |
| 140 | }}} |
| 141 | * Note: This pipeline is intended to be run in a terminal within the GUI as a non-root user |
| 142 | |
| 143 | |
| 144 | |
| 145 | [=#capture] |
| 146 | = Venice Video Capture |
| 147 | The IMX8M Mini SoC supports a 4-lane MIPI CSI2 (MIPI Camera Serial Interface) which operates up to a maximum bit rate of 1.5 Gbps with features including: |
| 148 | * Configurable interface logic to support most commonly available CMOS sensors. |
| 149 | * Support for ITU-R BT.656 video interface as well as traditional sensor interface. |
| 150 | * 8-bit / 16-bit / 24-bit data port for YCbCr, YUV, or RGB data input. |
| 151 | * 8-bit / 10-bit / 16-bit data port for Bayer data input. |
| 152 | * Full control of 8-bit/pixel, 10-bit/pixel or 16-bit / pixel data format to 64-bit receive FIFO packing. |
| 153 | * 256 x 64 FIFO to store received image pixel data. |
| 154 | * Receive FIFO overrun protection mechanism. |
| 155 | * Embedded DMA controllers to transfer data from receive FIFO or statistic FIFO through AHB bus. |
| 156 | * Support 2D (data is chosen as x/y coordinate) DMA transfer from the receive FIFO to the frame buffers in the external memory. |
| 157 | * Support double buffering two frames in the external memory. |
| 158 | * Single interrupt source to interrupt controller from maskable interrupt sources: Start of Frame, End of Frame, Change of Field, FIFO full, FIFO overrun, DMA transfer done, BT.656 error and AHB bus response error. |
| 159 | * Configurable master clock frequency output to sensor. |
| 160 | * Supports simple deinterlacing of interlaced input. |
| 161 | |
| 162 | CMOS image sensors are separated into two classes, dumb and smart. Dumb sensors are those that support only traditional sensor timing (Vertical SYNC and Horizontal SYNC) and output only RGB, YUV, and Bayer and statistics data, while smart sensors support ITU-R BT.656 video decoder formats and perform additional processing of the image (for example, image compression, image pre-filtering, and various data output formats). Statistics only work for Bayer data is 8-bit per pixel format. |
| 163 | |
| 164 | == Compatible capture devices |
| 165 | Capture Devices: |
| 166 | * !RaspberryPi Camera Module v2: Sony IMX219 8MP image sensor with RAW8/RAW10 output |
| 167 | - [https://datasheets.raspberrypi.com/camera/camera-v2-schematics.pdf schematics] |
| 168 | - pin 11 is an active high enable pin which enables on-board 1.8V, 2.8V, 1.2V regulators |
| 169 | - has its own on-board 24MHz osc |
| 170 | |
| 171 | The Linux drives required for this camera are: |
| 172 | - CONFIG_VIDEO_IMX_MEDIA drivers/staging/media/imx/imx-media-common.c imx_media_common.ko |
| 173 | - CONFIG_VIDEO_IMX7_CSI drivers/staging/media/imx/{imx7-media-csi,imx7-mipi-csis,imx8mq-mipi-csi2}.c imx7_media_csi.ko imx7-mipi-csis.ko |
| 174 | - CONFIG_VIDEO_IMX219 drivers/media/i2c/imx219.c imx219.ko |
| 175 | |
| 176 | Device-Tree changes: |
| 177 | - to add a device to your system you must properly configure your device-tree to describe how the device is connected to the host processor and other peripherals. Often this is most easily done via a device-tree overlay. The Gateworks venice kernels have dt overlays that support the IMX219 !RaspberryPi v2 camera module |
| 178 | on the GW720x and GW730x boards. The dt overlay can be applied to the dt prior to booting the kernel by U-Boot. For example on a GW730x: |
| 179 | {{{#!bash |
| 180 | setenv fdt_overlays imx8mm-venice-gw73xx-0x-imx219.dtbo |
| 181 | saveenv |
| 182 | }}} |
| 183 | |
| 184 | Examples: |
| 185 | * capture 640x480 RAW8 at 10fps from IMX219 and display to framebuffer using gstreamer |
| 186 | {{{#!bash |
| 187 | # install gstreamer |
| 188 | apt update |
| 189 | apt-get install gstreamer1.0-x gstreamer1.0-tools \ |
| 190 | gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ |
| 191 | gstreamer1.0-libav gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 v4l-utils |
| 192 | # using glvideosink will render 'within' GUI |
| 193 | gst-launch-1.0 videotestsrc ! autovideosink |
| 194 | # find media device whos model is 'imx-media' |
| 195 | MDEV=$(for i in `ls -d /sys/bus/media/devices/media*`; do if [ "$(cat $i/model)" = "imx-media" ]; then cat $i/dev | cut -d: -f2; fi; done) |
| 196 | # find video device whos name is 'csi capture' |
| 197 | VDEV=$(for i in `ls -d /sys/class/video4linux/video*`; do if [ "$(cat $i/name)" = "csi capture" ]; then cut -d: -f2 $i/dev; fi; done) |
| 198 | # configure media controller links |
| 199 | media-ctl --device /dev/media$MDEV --reset |
| 200 | media-ctl --device /dev/media$MDEV --links "'imx219 2-0010':0->'imx7-mipi-csis.0':0[1]" |
| 201 | media-ctl --device /dev/media$MDEV -v -V "'imx219 2-0010':0 [fmt:SRGGB8/640x480 field:none]" |
| 202 | media-ctl --device /dev/media$MDEV -v -V "'csi':0 [fmt:SRGGB8/640x480 field:none]" |
| 203 | # stream 640x480@30fps |
| 204 | gst-launch-1.0 v4l2src device=/dev/video$VDEV ! video/x-bayer,format=rggb,width=640,height=480,framerate=10/1 ! bayer2rgb ! fbdevsink |
| 205 | }}} |
| 206 | - bayer2rgb can't keep up at 640x480@30fps and uses about 25% of the CPU when converting 640x480@10fps (as shown above) |
| 207 | - bayer2rgbneon uses appx 10% of CPU when converting 640x480@30fps |
| 208 | |
| 209 | |
| 210 | Notes: |
| 211 | - The DSI display driver only accepts RGB pixel format so a pixel conversion must occur if you want to display video from anything that does not output RGB (such as a RAW8 camera or YUV from the VPU decoder). There is no hardware accelerated mem2mem driver at this time (and its not clear if there will be on the IMX8MM). There is a bayer2rgb lib with NEON support and a gstreamer plugin that can be used for RAW8 to RGB: |
| 212 | - https://gitlab-ext.sigma-chemnitz.de/ensc/bayer2rgb |
| 213 | - https://gitlab-ext.sigma-chemnitz.de/ensc/gst-bayer2rgb-neon |
| 214 | {{{#!bash |
| 215 | # build bayer2rgb lib |
| 216 | git clone https://gitlab-ext.sigma-chemnitz.de/ensc/bayer2rgb |
| 217 | cd bayer2rgb |
| 218 | #apt install build-essential git autoconf gengetopt |
| 219 | apt install build-essential git gengetopt autoconf automake autoconf-archive libtool help2man pkg-config |
| 220 | autoreconf -i -f |
| 221 | ./configure |
| 222 | make |
| 223 | make install |
| 224 | cd .. |
| 225 | |
| 226 | # build gstreamer plugin |
| 227 | git clone https://gitlab-ext.sigma-chemnitz.de/ensc/gst-bayer2rgb-neon |
| 228 | cd gst-bayer2rgb-neon |
| 229 | apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev |
| 230 | ./autogen.sh |
| 231 | ./configure |
| 232 | make |
| 233 | make install |
| 234 | gst-inspect-1.0 bayer2rgbneon |
| 235 | }}} |
| 236 | |
| 237 | |
| 238 | [=#video_decode] |
| 239 | = Video Decoding |
| 240 | The IMX8MM contains the following hardware |
| 241 | * !VeriSilicon Hantro G1 video decoder: |
| 242 | - 1080p60 MPEG2 decoder |
| 243 | - 1080p60 AVC/H.264 Baseline, Main, High decoder |
| 244 | - 1080p60 VP8 decoder |
| 245 | * !VeriSilicon Hantro G2 video decoder: |
| 246 | HEVC/VP9 (1080p60) |
| 247 | - 1080p60 VP9 Profile 0, 2 (10 bit) decoder |
| 248 | - 1080p60 HEVC/H.265 decoder |
| 249 | |
| 250 | |
| 251 | The Linux driver at drivers/staging/media/hantro: |
| 252 | * currently supports: |
| 253 | - G1: MPEG2/VP8/H.264 decode |
| 254 | - G2: HEVC decode |
| 255 | - G2: VP9 decode (Linux 5.17) |
| 256 | * registers both media control devices (/dev/media*) and video4linux devices (/dev/video*): |
| 257 | {{{#!bash |
| 258 | root@focal-venice:~/# dmesg | grep -i hantro |
| 259 | [ 1.505790] hantro-vpu 38300000.video-codec: registered nxp,imx8mm-vpu-dec as /dev/video0 |
| 260 | [ 1.515788] hantro-vpu 38310000.video-codec: registered nxp,imx8mm-vpu-g2-dec as /dev/video1 |
| 261 | root@focal-venice:~/# cat /sys/class/video4linux/video*/name |
| 262 | nxp,imx8mm-vpu-dec |
| 263 | nxp,imx8mm-vpu-g2-dec |
| 264 | root@focal-venice:~/# cat /sys/bus/media/devices/media*/model hantro-vpu |
| 265 | hantro-vpu |
| 266 | }}} |
| 267 | |
| 268 | The Hantro G1/G2 decoders are stateless decoders and require the Request API found in modern Linux kernels and a new {{{v4l2codecs}}} plugin to handle 'stateless decoders'. While the {{{v4l2codecs}}} plugin was added in GStreamer 1.18 it has been receiving many updates required for it to work with the Hantro G1/G2 VPU decoder. |
| 269 | |
| 270 | It is likely that Gstreamer 1.19 is needed to be able to access the v4l2codec plugin. The following is from a GStreamer 1.19 build using a 5.16 kernel with VPU support and VP9 support backported: |
| 271 | {{{#!bash |
| 272 | [gst-main] root@focal-venice:~/gstreamer/build# gst-inspect-1.0 v4l2codecs |
| 273 | Plugin Details: |
| 274 | Name v4l2codecs |
| 275 | Description V4L2 CODEC Accelerators plugin |
| 276 | Filename /root/gstreamer/build/subprojects/gst-plugins-bad/sys/v4l2codecs/libgstv4l2codecs.so |
| 277 | Version 1.19.3.1 |
| 278 | License LGPL |
| 279 | Source module gst-plugins-bad |
| 280 | Binary package GStreamer Bad Plug-ins git |
| 281 | Origin URL Unknown package origin |
| 282 | |
| 283 | v4l2slh264dec: V4L2 Stateless H.264 Video Decoder |
| 284 | v4l2slmpeg2dec: V4L2 Stateless Mpeg2 Video Decoder |
| 285 | v4l2slvp8alphadecodebin: VP8 Alpha Decoder |
| 286 | v4l2slvp8dec: V4L2 Stateless VP8 Video Decoder |
| 287 | v4l2slvp9dec: V4L2 Stateless VP9 Video Decoder |
| 288 | |
| 289 | 5 features: |
| 290 | +-- 5 elements |
| 291 | }}} |
| 292 | |
| 293 | Note that the Hantro G1/G2 VPU in the IMX8MM outputs raw video in NV12/YUY2/NV12_32L32 pixel formats. Note that IMX8MM MIPI DSI display supports only RGB formats therefore video conversion needs to take place in software in order to 'decode and display. |
| 294 | |
| 295 | Examples: |
| 296 | * install Gstreamer: |
| 297 | {{{#!bash |
| 298 | apt update |
| 299 | apt-get install gstreamer1.0-x gstreamer1.0-tools \ |
| 300 | gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly \ |
| 301 | gstreamer1.0-libav gstreamer1.0-gl gstreamer1.0-gtk3 gstreamer1.0-qt5 v4l-utils |
| 302 | # using glvideosink will render 'within' GUI |
| 303 | gst-launch-1.0 videotestsrc ! autovideosink |
| 304 | }}} |
| 305 | * VP8 hardware decode and display: |
| 306 | {{{#!bash |
| 307 | gst-launch-1.0 udpsrc port=9001 caps = 'application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP8, payload=(int)96, ssrc=(uint)3363940374, timestamp-offset=(uint)3739685909, seqnum-offset=(uint)28161, a-framerate=(string)30' ! rtpvp8depay ! v4l2slvp8dec ! videoconvert ! fbdevsink |
| 308 | }}} |
| 309 | - need videoconvert because vpu src is NV12/YUY2/NV12_32L32 and display only supports BGRx (at this resolution and bitrate CPU is using about 85% idle) |
| 310 | - The caps are taken from the udpsink0.GsdPad:sink: caps from the source |
| 311 | - using kmssink I get 'drmModeSetPlane failed: Invalid argument (22)' |
| 312 | * VP9 hardware decode and display: |
| 313 | {{{#!bash |
| 314 | gst-launch-1.0 udpsrc port=9001 caps = 'application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)VP9, payload=(int)96, ssrc=(uint)1956992802, timestamp-offset=(uint)828951387, seqnum-offset=(uint)28536, a-framerate=(string)30' ! rtpvp9depay ! vp9parse ! v4l2slvp9dec ! videoconvert ! kmssink |
| 315 | }}} |
| 316 | - need videoconvert because vpu src is NV12/YUY2/NV12_32L32 and display only supports BGRx (at this resolution and bitrate CPU is using about 93% idle) |
| 317 | - The caps are taken from the udpsink0.GsdPad:sink: caps from the source |
| 318 | * H264 |
| 319 | {{{#!bash |
| 320 | gst-launch-1.0 udpsrc port=9001 caps = 'application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264, packetization-mode=(string)1, profile-level-id=(string)64001f, sprop-parameter-sets=(string)"Z2QAH6zZQMg9sBagwCC0oAAAAwAgAAAHkeMGMsA\=\,aOvssiw\=", payload=(int)96, ssrc=(uint)2753453329, timestamp-offset=(uint)3593065282, seqnum-offset=(uint)12297, a-framerate=(string)30' ! rtph264depay ! v4l2slh264dec ! videoconvert ! kmssink |
| 321 | }}} |
| 322 | - need videoconvert because vpu src is NV12/YUY2/NV12_32L32 and display only supports BGRx (at this resolution and bitrate CPU is using about 90% idle) |
| 323 | - The caps are taken from the udpsink0.GsdPad:sink: caps from the source |
| 324 | - using fbdevsink video looks like it has the wrong colorspace |
| 325 | |
| 326 | |
| 327 | For the examples above streams were generated on a x86 system using GStreamer software encode: |
| 328 | {{{#!bash |
| 329 | # vp8 software encode |
| 330 | gst-launch-1.0 -v videotestsrc ! vp8enc ! rtpvp8pay ! udpsink host=192.168.1.22 port=9001 |
| 331 | # vp9 software encode |
| 332 | gst-launch-1.0 -v videotestsrc ! 'video/x-raw,width=800,height=480,format=(string)YV12' ! vp9enc ! rtpvp9pay ! udpsink host=192.168.1.22 port=9001 |
| 333 | gst-launch-1.0 -v videotestsrc ! vp9enc ! rtpvp8pay ! udpsink host=192.168.1.22 port=9001 |
| 334 | # h264 software encode |
| 335 | gst-launch-1.0 -v videotestsrc ! video/x-raw,width=800,height=480 ! x264enc ! rtph264pay ! udpsink host=192.168.1.22 port=9001 |
| 336 | }}} |
| 337 | - for VP9 vp9parse is required as the new stateless decoder handle frames, while VP9 have this notion of superframe. vp9parse will seperate the frames from the super frames. |
| 338 | |
| 339 | |
| 340 | Notes: |
| 341 | 1. The DSI display driver only accepts RGB pixel format so a pixel conversion must occur if you wish to display video from from the VPU which can only output NV12/YUY2/NV12_32L32. There is no hardware accelerated mem2mem driver at this time (and its not clear if there will be on the IMX8MM). There is a libneon and bayer2rgb neon project with a gstreamer plugin that can be used: |
| 342 | - https://gitlab-ext.sigma-chemnitz.de/ensc/bayer2rgb |
| 343 | - https://gitlab-ext.sigma-chemnitz.de/ensc/gst-bayer2rgb-neon |
| 344 | 1. While GStreamer 1.18 introduced the {{{v4l2codecs}}} plugin required to use the VPU it has been getting a lot of additional features and bugfixes that are required. Therefore you need to use either a development build or wait for a packaged GStreamer 1.20 release. To build a development build see [wiki:gstreamer#building] |
| 345 | |
| 346 | |
| 347 | [=#video_encode] |
| 348 | = Video Encoding |
| 349 | The IMX8MM contains the following hardware |
| 350 | * !VeriSilicon Hantro H1 video encoder: VP8/H.264 (1080p60) |
| 351 | |
| 352 | The Linux driver at drivers/staging/media/hantro currently do not have support for the IMX8MM Hantro H1 VPU |
| 353 | |
| 354 | Notes: |
| 355 | - Hantro H1 VPU supports VP8/H.264/MVC video encode but kernel support is still missing |
| 356 | - You can derive support from RK3288 support using Google ChromeOS method (a v4l2 plugin that simulate in userspace a stateful encoder): |
| 357 | - libv4l plugins / https://chromium.googlesource.com/chromiumos/third_party/libv4lplugins/+/refs/heads/master |
| 358 | - Kernel Driver / https://chromium.googlesource.com/chromiumos/third_party/kernel/+/chromeos-4.4/drivers/media/platform/rockchip-vpu/ |