ZCU106 VCU Reference Design for QNX - 2020.2
This page describes the process for installing, building, and testing support for the ZU+ Video Codec Unit (VCU) under the QNX RTOS. The Zynq UltraScale+ MPSoC VCU TRD 2020.2 Design Module #1 is used as the hardware platform for the examples below. This release also supports the Quad Sensor Design Module.
This is an EA version of the reference design instructions. Please report any issues you find to your FAE or Xilinx Technical Marketing.
The content of this wiki page is not supported by Xilinx Technical Support. Please contact your Xilinx or QNX FAE for more information.
Table of Contents
- 1 Introduction
- 2 Building the QNX BSP Project
- 3 Preparing the Hardware
- 4 Example : Running the DM#1 Test Applications
- 5 Running the Multimedia Test Applications
- 6 Changing the Resolution of the Display
- 7 Mounting an NFS Partition
- 8 Other Hardware Configurations
- 9 Appendix A: Hardware Configurations
- 10 Appendix B: Example ctrlsw_encoder Config File Format
- 11 Appendix C: Test Videos
Introduction
Blackberry QNX provides support for the Zynq UltraScale+VCU when using their ZCU106 BSP for the QNX Neutrino RTOS. This is support is enabled by way of updates to the QNX Multimedia Suite 2.0 packages as referenced in the Required QNX RTOS Software Packages section below. In addition to the VCU support, there is an addition Sensor Framework packages which provides MIPI camera support.
In the sections below, the process for building and evaluating the packages to exercise the VCU and MIPI camera input will be described.
Required QNX Software
It is assumed that the user has installed the following tools from QNX:
QNX Software Development Platform Version: 7.1.0
available through QNX Software Center
For general information about the ZCU106 BSP that is utilized for this project, you should refer to the ZCU106 BSP User Guide.
Xilinx Boot Files Archive
A set of pre-built boot files are available in the following archive:
Please contact your Xilinx FAE or Xilinx Technical Marketing to access to the boot files archive.
The archive also includes QNX .build files.
Please contact your Xilinx FAE or Xilinx Technical Marketing to access to the boot files archive.
Package Directory Structure of QNX_VCU_TRD_Package-2020.2_RELEASE.zip , received from AMD-Xilinx
| README.txt -------> (Contains all details to reproduce binaries & pre-built images)
|
+---graphics_conf -------> (Contains list of graphics files for different resolutions)
| graphics_1080p.conf
| graphics_1080p_sw.conf
| graphics_2160p.conf
| graphics_720p.conf
|
+---vcu_trd_dm_1 -------> (Design Module #1 - Single Sensor binaries)
| | README_QNX_DM1.txt
| | zcu106.build
| |
| \---prebuilt -------> (Design Module #1 - Single Sensor prebuilt SD card images)
| BOOT.BIN
| QNX-IFS
| boot.scr
\---vcu_trd_dm_11 -------> (Design Module #11 - Quad Sensor binaries)
| README_QNXI_DM11.txt
| zcu106.build
|
\---prebuilt -------> (Design Module #11 - Quad Sensor prebuilt SD card images)
| BOOT.BIN
| QNX-IFS
| boot.scr
Recreating the Boot Files
The bitstream and FSBL are from the Zynq UltraScale+ MPSoC VCU TRD 2020.2 - VCU TRD Multi Stream Video Capture and Display design module (DM #1).
To reproduce these files, use the Build flow for Design Module #1 (Multi Stream) and follow the steps below:
Create a Petalinux project based on BSP in the TRD
Create a link to the device tree for DM#1
Configure the Petalinux project to use the new .xsa
Build the petalinux project
The new boot artifacts will in the <petalinux project>/images/linux directory
Required QNX RTOS Software Packages
The build the QNX reference design for the ZCU106, the following runtime software packages are required from Blackberry QNX. The packages are available through the QNX Software Center application and are available upon request for current QNX customers. Please contact your QNX or Xilinx FAE for assistance.
Make sure you also update your QNX SDP 7.1 installation
Package Type | Package Name | BuildID (minimum) | Notes |
---|---|---|---|
BSP | QNX® SDP 7.1 BSP for Xilinx Zynq UltraScale+ MPSoC ZCU106 - 7.1 | 17 | QNX 7.1 BuildID 17 - Sep 30, 2022. |
Graphics | QNX® SDP 7.1 Screen Base Graphics 7.1 | 535 | January 25, 2022 |
QNX® SDP 7.1 Screen Device Input Utilities 7.1 | 535 | January 25, 2022 | |
QNX® SDP 7.1 Screen Utilities 7.1 | 535 | January 25, 2022 | |
QNX SDP 7.1 Screen Board Support ZCU10x 7.1 | 535 | November 18, 2021 (The release solves an issue where the screen had a green tint. It also includes a large number of bug fixes, performance improvements and minor new features.)
| |
Multimedia | QNX® Multimedia Suite 2.0 - Character Conversion - 7.1 | 659 | These are in addition to the latest Multimedia Suite 2.0 packages. Released on March 11, 2022 |
QNX® Multimedia Suite 2.0 - MP4 Muxer Support - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Filesystem Input Support - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Multimedia Framework API - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - OMX IL helper library - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - OpenMAX IL API - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - OpenMAX AL API - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Audio Output Support - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Screen Output Support - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - MP4 container support - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Playlist Parsing API - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Media Renderer API - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Media Renderer playlist support API - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Resource Arbiter - 7.1 | 659 | ||
QNX® Multimedia Suite 2.0 - Xilinx zcu106 hardware codec - 7.1 | 659 | ||
Sensor Framework (camera) | Sensor Framework Base Support - 7.1 | 441 | Released on March 11, 2022 |
Sensor Framework Camera Library - 7.1 | 441 | Released on March 11, 2022 | |
Sensor Framework AR0231 Camera Support - 7.1 | 441 | Released on March 11, 2022 | |
Sensor Framework Xilinx ZCU106 Support - 7.1 | 441 | Released on March 11, 2022 | |
Sensor Framework Serdes Support - 7.1 | 441 | Released on March 11, 2022 |
Limitations
There are a few outstanding issues related to using the 4k display while encoding/decoding with the test applications below. At this time, it is recommended that users limit the display resolution to 1080p for best overall performance.
Building the QNX BSP Project
The QNX BSP Project can be built from the command line or using the QNX Momentics IDE. The Momentics flow running under Windows will be described below.
A “boot files archive” is needed (See “Xilinx Boot Files” section above) with all necessary components to recreate the BOOT.BIN for staring up the system.
A Pre-built BOOT.BIN is provided in the boot files archive if you do not want to build them from scratch. A pre-built QNX-IFS for each set of demos (Single Sensor & Quad Sensor) is also available in a QNX Pre-built archive upon request. Please contact your QNX or Xilinx FAE for access.
Using the Momentics IDE Flow
Create the ZCU106 BSP Project
Launch Momentics and create a new workspace.
Create a new project based on the ZCU106 BSP
File->Import
Choose QNX->QNX Source Package and BSP. Click Next
Browse for the ZCU106 BSP (Example steps below)
<QNX install path>\qnx710\bsp\BSP_xilinx-xzynq-zcu106_br-710_be-710_SVN947906_JBN0_2022
Click Next Twice
Give the project a suitable name
Click Finish
Modify the Project
Replace the default zcu106.build file with the one of the ones provided in the boot files archive. There are two options, depending on which set of applications you want to test:
vcu_trd_dm_1/zcu106.build: Use this if you want to capture, display, and record live video from the FMC MIPI camera (LI-IMX274MIPI-FMC). You’ll also need to install the packages mentioned in the table above.
vcu_trd_dm_11/zcu106.build: VCU based design supporting Avnet Quad Sensor video capture through MIPI CSI2-Rx and display through HDMI-Tx for NV12 format
In either case, copy the .build file into the QNX BSP project and rename it zcu106.build. In the QNX project, the .build file is found under xilinx-zynq-zcu106->images in the project explorer.
Copy all of the .conf files (From package directory “QNX_VCU_TRD_Package/graphics_conf/”) in the graphics directory of the boot files archive to the following directory (this only needs to be done once and can be used for other projects): <QNX install path>/qnx710\target\qnx7\aarch64le\usr\lib\graphics\zcu10x
Update the Makefile in the images directory. Modify the QNX-IFS target as shown below so that QNX-IFS gets updated during every build:
QNX-IFS: ifs-xzynq-zcu106.raw
cp ifs-xzynq-zcu106.raw QNX-IFS
Build the Project
Right click on the project name and select "Clean Project”
Right click on the project name and select "Build Project"
Wait for the build to complete. This process will take several minutes.
Once complete, the QNX-IFS will be available in the images folder along-with boot.scr.
Prepare the Boot Image
Download the VCU TRD 2020.2 release package here https://www.xilinx.com/cgi-bin/docs/ctdoc?cid=bigfile;d=rdf0428-zcu106-vcu-trd-2020-2.zip
The TRD package contents are placed in the following directory structure as shown below.
For Quad Sensor design (VCU TRD Design Module #11)
The user needs to copy BOOT.bin from the
rdf0428-zcu106-vcu-trd-2020.2\images\vcu_quad_sensor
to FAT32 formatted SD card directory along with QNX-IFS & boot.scr , generated & available from previous steps.
For Single Sensor design (VCU TRD Design Module #1)
The user needs to copy BOOT.bin from the
rdf0428-zcu106-vcu-trd-2020.2\images\vcu_multistream_nv12
to FAT32 formatted SD card directory along with QNX-IFS & boot.scr , generated & available from previous steps.SD Card contents
rdf0428-zcu106-vcu-trd-2020.2
├── apu
│ └── vcu_petalinux_bsp
├── images
│ ├── vcu_10g
│ ├── vcu_audio
│ ├── vcu_hdr10_hdmi
│ ├── vcu_llp2_hdmi_nv12
│ ├── vcu_llp2_hdmi_nv16
│ ├── vcu_llp2_hdmi_xv20
│ ├── vcu_llp2_sdi_xv20
│ ├── vcu_multistream_nv12
│ ├── vcu_pcie
│ ├── vcu_quad_sensor
│ └── vcu_sdi_xv20
├── pcie_host_package
│ ├── COPYING
│ ├── include
│ ├── LICENSE
│ ├── readme.txt
│ ├── RELEASE
│ ├── tests
│ ├── tools
│ └── xdma
├── pl
│ ├── constrs
│ ├── designs
│ ├── prebuild
│ ├── README.md
│ └── srcs
└── README.txt
TRD package contents specific to VCU TRD Multi Stream design are placed in the following directory structure.
rdf0428-zcu106-vcu-trd-2020.2
├── apu
│ └── vcu_petalinux_bsp
│ └── xilinx-vcu-zcu106-v2020.2-final.bsp
├── images
│ ├── vcu_multistream_nv12
│ │ ├── autostart.sh
│ │ ├── BOOT.BIN
│ │ ├── boot.scr
│ │ ├── config
│ │ ├── image.ub
│ │ ├── system.dtb
│ │ └── vcu
├── pcie_host_package
├── pl
│ ├── constrs
│ ├── designs
│ │ └── zcu106_trd
│ ├── prebuild
│ │ └── zcu106_trd
│ ├── README.md
│ └── srcs
│ ├── hdl
│ └── ip
└── README.txt
Preparing the Hardware
By default, this reference design targets the 2020.2 VCU TRD Design Module #1 , At this moment it, In the provided current reference design of QNX it supports DisplayPort output (DisplayPort in the PS) , With modification, other similar hardware configurations can be supported as well - please refer to Appendix A below. From a QNX software perspective, this reference design supports a subset of the VCU TRD interfaces as defined below:
Supported Hardware Interfaces
Sources
MIPI CSI-2 Rx capture pipeline implemented in the PL
Capture Pipeline: MIPI CSI-2 Subsystem → Demosaic → Gamma → VPSS(CSC) → VPS (Scaler) → Framebuffer Write
File source: SD card
Sinks
DP Tx display pipeline in the PS.
File sink: SD card
VCU Codec
Video Encode/Decode capability using VCU hard block in PL
AVC/HEVC encoding
Encoder/decoder parameter configuration.
Video Input Pipeline
MIPI CSI-2 Subsystem → Demosaic → Gamma → VPSS(CSC) → VPS (Scaler) → Framebuffer Write
Setting up the board
To set the board up for testing, please refer to the Board Setup instructions in the VCU TRD: Zynq UltraScale+ MPSoC VCU TRD 2020.2 | 3.5 Board Setup
For this this version of the reference design, since we will only be using the MIPI camera input and DisplayPort output, the other interfaces can be left disconnected. Make sure the FMC voltage is configured correctly. Please refer to https://www.xilinx.com/support/answers/67308.html for details.
Booting up the Board
Add BOOT.BIN , QNX-IFS & boot.scr to the FAT partition of an SD Card. For best results, use the SD Memory Card Formatter from the SD Association to format the card.
Insert the card in ZCU106 and power on the board.
As part of the default boot process, the boot script will attempt to mount the SD cards at /sdcard.
Here is a reference command to mount the SD cards (If required) - mount -t dos /dev/hd0t12 /sdcard
The FAT partition should show up as /dev/hd0t11, /dev/hd0t12, or /dev/hd0t14 depending on how the flags are set on the partition. It has been observed that certain SD cards, depending on how the boot flags are set, may show up as /dev/hd0t131 which is technically denoting an ext4 partition.
Setting the MAC Address
To use the Ethernet interface, you’ll need make sure that the MAC address for the board is programmed into the on-board EEPROM. During boot, if you see an error about the MAC address not being set, refer to the ZCU106 BSP User Guide for details regarding programming the MAC address into the EEPROM.
How to run the #DM1 and DM#11 applications using prebuilt BOOT.bin and QNX-IFS
To run the DM#1 and #DM#11 tests , Follow the README under the package directory & copy the Boot.bin and QNX-IFS for respective design modules from prebuilt\ directory in package :
* vcu_trd_dm_1\README_QNX_DM1
* vcu_trd_dm_11\README_QNX_DM11
Example : Running the DM#1 Test Applications
The camera_example application can be used to exercise the available hardware interfaces. The examples in this section are provided by the QNX® Platform packages listed above. The available tests are highlighted below. Source code for the camera_example application is available from QNX upon request.
To run using pre-builts, you should use the QNX-IFS file located in the \vcu_trd_dm_1\prebuilt or vcu_trd_dm_11\prebuilt directory of the QNX Pre-built archive.
Camera Tests
In the serial console, run the camera_example application and follow the default options as marked in - README_QNX_DM1.txt
================================== Camera tests ======================================
(1) Camera capture.
Booting up the target with the "BOOT.BIN" and "QNX-IFS" files.
The sensor service is already running after the boot-up. It can also be slayed and manually
started again with below command:
# sensor -U 521:521,1001 -r /sdcard -c /etc/imx274.conf -b external
Running camera_example to get the viewfinder output. Supported formats are RGB8888 and NV12.
Choosing default for all options will display 1080P RGB8888.
Below are the steps to choose NV12 color format:
# camera_example
Select which example you want to run:
1) Camera viewfinder
2) Record video to a file
3) Camera stream
4) Multiple camera video
5) EGL viewfinder
6) Event example
7) Multiple camera streams
8) Synchronized cameras
x) Exit the example
1
Select which of the following 1 cameras you want to use:
1) CAMERA_UNIT_1
Enter Choice:
1
Select which of the following VF modes you want to use:
2) CAMERA_VFMODE_VIDEO
Enter Choice:
2
Do you want to modify the viewfinder configuration (y/n)?
y
Format is currently set to RGB8888, do you want to modify it (y/n)?
y
Select which of the following format you want to use:
1) RGB8888
2) NV12
Enter Choice:
2
Resolution is currently set to 1920 x 1080, do you want to modify it (y/n)?
n
Framerate is currently set to 30.000000, do you want to modify it (y/n)?
n
Rotation is currently set to 0, do you want to modify it (y/n)?
n
Overlay is currently set to 0, do you want to modify it (y/n)?
n
Print status info is currently set to false, do you want to modify it (y/n)?
n
Do you want to modify image attributes (y/n)?
n
Choose from the following options:
i) Modify image attributes
l) Lock 3A
v) Modify viewfinder configuration
x) Exit the example
# x
The camera streaming starts and the viewfinder should show up on the connected DisplayPort Monitor
The screen resolution should be set to the camera resolution for best performance. By default, both are set to 1920x1080. See the section below “Changing the Resolution of the Display” for more information.
Camera Recording Test
In the serial console, start the VCU encoder application:
# vcu-encoder-zcu106
Now run the camera_example application and follow the default options as marked in - README_QNX_DM1.txt
-------
(2) Video recording.
Booting up the target with the "BOOT.BIN" and "QNX-IFS" files. The sensor service is
already running after the boot-up.
Mount a NFS server export as "/tmp" on the target and start video encode resmgr.
#fs-nfs3 server_ip:/file_directory /tmp
#vcu-encoder-zcu106
Record a video clip using camera_example.
#camera_example
Select which example you want to run:
1) Camera viewfinder
2) Record video to a file
3) Camera stream
4) Multiple camera video
5) EGL viewfinder
6) Event example
7) Multiple camera streams
8) Synchronized cameras
x) Exit the example
2
Select which of the following 1 cameras you want to use:
1) CAMERA_UNIT_1
Enter Choice:
1
Do you want to modify viewfinder configuration (y/n)?
n
Choose from the following options:
c) Change video configuration
e) Modify encoder parameters
k) Force a Key Frame
r) Start/Stop Recording a video
v) Modify viewfinder configuration
x) Exit the example
r
Starting to record video to file /tmp/VID_xxxxxxx_xxxxxx_.mp4
Choose from the following options:
c) Change video configuration
e) Modify encoder parameters
k) Force a Key Frame
r) Start/Stop Recording a video
v) Modify viewfinder configuration
x) Exit the example
Choose "r" again to stop recording. The default recording resolution is 1920x1080.
To play back the recorded files on "/tmp", access permission needs to be changed. For example:
#chmod 777 /tmp/xxx.mp4
At the final menu, choose “r” to start recording and choose "r" again to stop recording. While recording, you should see the live video on the DisplayPort monitor.
In case you you like to use SD card as storage mechanism for recording instead of NFS server, The steps would be :
-Reboot the target
-Mount SD card, If its not auto-mounted (By default SD Card will be Mounting at /sdcard during boot)
# mount -t dos /dev/hd0t12 /sdcard
-Start vcu encoder driver
# vcu-encoder-zcu106
Slay sensor service and restart it with the modified recording path.
# slay sensor
# sensor -U 521:521,1001 -r /sdcard -c /etc/imx274.conf -b external
Record using camera_example & follow instructions in README_QNX_DM1.txt
# camera_example
The default recording resolution is 1920x1080 & By default SD card is mounted at /sdcard during bootup.
4k recording is not reliable at this time. This seems to be related to the amount of data being written to disk. To lower the bitrate of the encoded video, you can modify the bitrate by selecting the “Modify encoder parameters” menu option before starting to record. The default rate for 1080p is 16Mbps, and the default rate for 4k is 72 Mbps
Video File Playback Test
Before running this test, the video file to be played back must be copied to /sdcard/video.mp4. The can be overridden by changing the contents of /etc/playback.conf in the .build file
In the serial console, start the VCU decoder application:
# vcu-decoder-zcu106
Restart the test application by running the vcu-decoder-zcu106
and follow the default options as marked in - README_QNX_DM1.txt for File camera playback
# slay sensor
# sensor -U 521:521,1001 -r /sdcard -c /etc/playback.conf -b external
Now run the camera_example application and press 1 for “Camera Viewfinder”. After that, select all default options:
-------
(3) File camera playback
Mount a NFS server export as "/tmp" on the target and start video decode resmgr.
#fs-nfs3 server_ip:/file_directory /tmp
#vcu-decoder-zcu106
Rename the video file to be played (.mp4 only) to "video.mp4" and put it under "server_ip:/file_directory"
so it could be accessed under "/tmp" on the target.
Restart the sensor service with a playback.conf file
# slay sensor
# sensor -U 521:521,1001 -r /tmp -c /etc/playback.conf -b external
Playback video.mpt as a file camera
# camera_example
Select which example you want to run:
1) Camera viewfinder
2) Record video to a file
3) Camera stream
4) Multiple camera video
5) EGL viewfinder
6) Event example
7) Multiple camera streams
8) Synchronized cameras
x) Exit the example
1
Select which of the following 1 cameras you want to use:
1) CAMERA_UNIT_1
Enter Choice:
1
Select which of the following VF modes you want to use:
2) CAMERA_VFMODE_VIDEO
Enter Choice:
2
Do you want to modify the viewfinder configuration (y/n)?
n
Do you want to modify image attributes (y/n)?
n
Choose from the following options:
i) Modify image attributes
l) Lock 3A
v) Modify viewfinder configuration
x) Exit the example
The video at /sdcard/video.mp4 will begin to play on the monitor. Once the end of the video is reached, it will replay continuously until you press 'x' to exit the test.
Running the Multimedia Test Applications
The examples in this section are provided by the QNX® Platform for Multimedia 2.0 packages listed above. The available tests are highlighted below.
To run using pre-builts, you should use the QNX-IFS file located in the vcu_trd_dm_1\prebuilt directory of the boot files archive.
Preparing The System
Once the system is booted, run the following commands:
================================== Multimedia tests ==============================
Mount a NFS server export (e.g., "/aaa" as used in below samples) on the target so files in that location can be accessed.
-------
(1) mmrplay
#vcu-decoder-zcu106
#pps
#mkdir -p /pps/services/multimedia
#mm-renderer
#mmrplay -a "" -v "screen:/any" /aaa/bbb.mp4
-------
(2) vcu_omx_decoder
#vcu-decoder-zcu106
#vcu_omx_decoder /aaa/bbb.h264 -avc -o /aaa/bbb.nv12
-------
(3) vcu_omx_encoder
#vcu-encoder-zcu106
#vcu_omx_encoder /aaa/bbb.nv12 --fourcc nv12 --framerate 30 --width xx --height xx --out /aaa/bbb.h264
-------
(4) ctrlsw_decoder
#vcu-decoder-zcu106
#ctrlsw_decoder -i /aaa/bbb.h264 -avc -o /aaa/bbb.nv12
-------
(5) ctrlsw_encoder
#vcu-encoder-zcu106
#ctrlsw_encoder -i /aaa/bbb.nv12 --input-width xx --input-height xx --input-format NV12 -o /aaa/bbb.h264
-------
(6) video-encode
#vcu-decoder-zcu106
#vcu-encoder-zcu106
video-encode /aaa/bbb.mp4 /aaa/bbb.h264
Xilinx VCU Tests
Included in the multimedia package are four sample applications from Xilinx to exercise the VCU at the Control Software and OpenMax layers. These sample apps operate on raw video files (.hevc, .h264, . yuv, etc. ) instead of containerized formats like .mp4.
Depending on the size of the test video, these tests can take up significant disk space and bandwidth. For best results, it’s recommended the the files are accessed over NFS instead of the SD card interface. See the section “Mounting an NFS Partition” below for more details.
VCU Control Software
The VCU control software is a pair of standalone command-line executables that can be used to gain fine-grained control over the operation of the VCU:
VCU Encode: ctrlsw_encoder
VCU Decode: ctrlsw_decoder
Command Line Examples
#AVC/H.264
ctrlsw_decoder -in input_file.h264 -avc -out output_file.yuv
#HEVC/H.265
ctrlsw_decoder -in inptu_file.hevc -hevc -out output_file.yuv
Encode using ctrlsw_encoder - this takes a .cfg file as an input and generates an avc or hevc encoded output file based on the YUV formated input file. The configuration file details can be found in PG252. A sample configuration file can be found in Appendix B below.
ctrlsw_encoder -cfg /tmp/avc_1080p60.cfg
For more information on usage of the control software applications, please refer to PG252: VCU Control Software Sample Applications. The source code for the VCU Control Software is available at https://github.com/Xilinx/vcu-ctrl-sw.
VCU OpenMax Sample Applications
The OpenMax Integration Layer (OMXIL) sample applications provide example for utilizing the OpenMax Integration Layer.
VCU Encode: vcu_omx_encoder
VCU Decode: vcu_omx_decoder
Command Line Examples
Decode a encoded video to YUV:
#AVC/H.264
vcu_omx_decoder intput_file.h264 --avc -o output_file.yuv
#HEVC/H.265
vcu_omx_decoder input_file.hevc --hevc -o output_file.yuv
Encode a 1080p60 YUV video:
#AVC/H.264
vcu_omx_encoder input_file.yuv --width 1920 --height 1088 --framerate 60 --avc --out output_file.h264
#HEVC/H.265
vcu_omx_encoder input_file.yuv --width 1920 --height 1080 --framerate 60 --avc --out output_file.hevc
To play the encoded h264/hevc back on a PC for verification, you can use ffplay:
ffplay -i output_file.h264
To add a mp4 contatiner, you can use ffmpeg:
ffmpeg -i <input file in hevc or h264> -c:v copy -f mp4 <output file>.mp4
For more information on the usage of the OpenMax sample applications, please refer to PG252: VCU OpenMax Integration Layer. The source code for the OpenMax Integration Layer sample applications is available at https://github.com/Xilinx/vcu-omx-il/tree/master/exe_omx.
QNX Codec Tests
mmrplay
Used to playback .mp4 videos on the DisplayPort interface
Usage:mmrplay -a "" -v "screen:/any" <absolute path to media file>.mp4
Changing the Resolution of the Display
To change the resolution of the DisplayPort interface, you need to restart the screen service and specify a new screen configuration file. Screen configuration files have been provided for the following resolutions:
1920x1080 (default)
3840x2160
1280x720
To restart the screen service, issue the following commands:
# kill the screen process
slay screen
# start screen service up with a new configuratoin file
/sbin/screen -c /usr/lib/graphics/zcu10x/graphics_<1080p|2160p|720p>.conf
Mounting an NFS Partition
For some of the tests above, it’s beneficial to use an NFS mounted filesystem due to the size of the files and the amount of bandwidth necessary. The commands below give an example for connecting to an NFS server. It is assumed that the NFS server is already running and configured correctly.
# Enable the network inteface
ifconfig xzynq0 <target ip address>
# Connect to an NFS server, and mount it at /tmp
fs-nfs3 <nfs server ip address>:<path on server> /tmp
Other Hardware Configurations
It’s possible to use the QNX software implementation provided with this reference design with other hardware configurations. The sections below describe the modifications need to run this design on the https://xilinx-wiki.atlassian.netnull/pages/createpage.action?spaceKey=XWUC&title=Zynq%20UltraScale%EF%BC%8B%20MPSoC%20VCU%20TRD%202019.1%20-%20Multi%20stream%20Audio-Video%20Design&linkCreation=true&fromPageId=2038464517 design module #11.
Modifying the QNX BSP Project
Changes are required to the zcu106.build file to support the new hardware configuration.
Adding AXI Interrupt Controller
The ZCU106 BSP supports the use of the AXI Interrupt Controller soft IP in the PL to aggregate interrupts before sending a single interrupt to the GIC through the PL->PS interface. In order to use it, we need to enable it at startup and define the characteristics of the interrupt.
In this design, the AXI INTC is configured as follows:
Base address = 0xA0055000
Interrupt output is connected to GIC 142 (ps->pl IRQ ).
The interrupt output is active high, level triggered
In the .boostrap section of the .build file, add the following command:
# startup-xzynq-zcu10x -v -a<AXI INTC BASE ADDR>, <GIC #>
startup-xzynq-zcu10x -v -a0xa0055000,142
Updating the Sensor Service Configuration
By default, several xilinx-specific parameters used by the sensor service configuration are set to default values that match the 2020.2 VCU TRD Design Module #1 hardware settings. In order to configure the sensor service to values that don’t match DM#1, we can override the parameter settings in imx274.conf as shown below.
In zcu106.build, replace the /etc/imx274.conf section with:
/etc/imx274.conf = {
begin SENSOR_UNIT_1
type = sensor_camera
name = front-camera
position = 0, 0, 0
direction = 0, 0, 0
address = imx274, 0
xilinx_csi2_base = a00f0000
xilinx_csi2_irq = 8192
xilinx_demosaic_base = a0250000
xilinx_demosaic_gpio = 85
xilinx_gamma_base = a0270000
xilinx_gamma_gpio = 86
xilinx_csc_base = a0240000
xilinx_csc_gpio = 84
xilinx_csc_skip = 0
xilinx_scaler_base = a0200000
xilinx_scaler_gpio = 82
xilinx_scaler_skip = 0
xilinx_bufwrite_base = a0260000
xilinx_bufwrite_irq = 8193
xilinx_bufwrite_gpio = 80
end SENSOR_UNIT_1
Please refer to Appendix A: Hardware Configurations for details on the hardware configurations of DM#1,3, and 11.
Appendix A: Hardware Configurations
The following sections provide details on the PL configuration of various Vivado designs that are compatible with the QNX software libraries.
2020.2 VCU TRD Design Module #1 - Single Sensor
Image Sensor Configuration
Sensor Type: IMX274 (LI-IMX274MIPI-FMC)
Sensor I2C Interface
IP | Address | Interrupt Sink |
AXI IIC | 0xA005_1000 | pl_ps_irq1[3] == GIC[139] |
Sensor Video Pipeline
Stage | IP | Address | Interrupt Parent | EMIO Reset (QNX GPIO #) |
1 | MIPI CSI-2 Rx Subsystem | 0xA00F_0000 | pl_ps_irq1[1] == GIC[137] | 12 (90) |
2 | Sensor Demosaic | 0xA025_0000 | NA | 7 (85) |
3 | Gamma LUT | 0xA027_0000 | NA | 8 (86) |
4 | VPSS CSC | 0xA024_0000 | NA | 6 (84) |
5 | VPSS Scaler | 0xA020_0000 | NA | 4 (82) |
6 | Video Frame Buffer Write | 0xA026_0000 | pl_ps_irq1[2] == GIC[138] | 2 (80) |
Note: This EMIO for MIPI RX is an active low SPI ChipSelect
Video Codec Unit IP Parameters
IP | Address | Interrupt Sink | EMIO Reset (QNX GPIO #) |
Video Codec Unit | 0xA010_0000 | pl_ps_irq0[7] == GIC[128] | 41 (119) |
AXI Interrupt Controllers (PL Based)
IP | Base address | Interrupt Parent | Output Type |
AXI_INTC0 | 0xA005_2000 | pl_ps_irq1[4] == GIC[140] | Level High |
2020.2 VCU TRD Design Module #3
Image Sensor Configuration
Sensor Type: IMX274 (LI-IMX274MIPI-FMC)
Sensor I2C Interface
IP | Address | Interrupt Sink |
AXI IIC | 0xA005_4000 | AXI_INTC0[2] |
Sensor Video Pipeline
Stage | IP | Address | Interrupt Parent | EMIO Reset (QNX GPIO #) |
1 | MIPI CSI-2 Rx Subsystem | 0xA00F_0000 | AXI_INTC0[0] | 12 (90) |
2 | Sensor Demosaic | 0xA025_0000 | NA | 7 (85) |
3 | Gamma LUT | 0xA027_0000 | NA | 8 (86) |
4 | VPSS CSC | 0xA024_0000 | NA | 6 (84) |
5 | VPSS Scaler | 0xA020_0000 | NA | 4 (82) |
6 | Video Frame Buffer Write | 0xA026_0000 | AXI_INTC0[1] | 2 (80) |
Note: This EMIO for MIPI RX is an active low SPI ChipSelect
Video Codec Unit IP Parameters
IP | Address | Interrupt Sink | EMIO Reset (QNX GPIO #) |
Video Codec Unit | 0xA010_0000 | pl_ps_irq0[6] == GIC[127] | 41 (119) |
AXI Interrupt Controllers (PL Based)
IP | Base address | Interrupt Parent | Output Type |
AXI_INTC0 | 0xA005_5000 | pl_ps_irq1[6] == GIC[142] | Level High |
2020.2 VCU TRD Design Module #11 - Quad Sensor
Image Sensor Configuration
Sensor Type: 4 x AR0231AT (AES-FMC-MC4-AR0231AT-G)
Sensor I2C Interface
IP | Address | Interrupt Parent |
AXI IIC | 0xA024_0000 | AXI_INTC_1[5] |
Sensor Video Pipelines
Stage | IP | Address | Interrupt Parent | EMIO Reset (QNX GPIO #) |
1 | MIPI CSI-2 Rx Subsystem | 0xA000_0000 | AXI_INTC_1[4] | NA
|
Channel 0 | ||||
2 | Sensor Demosaic | 0xA019_0000 | NA | 2 (80) |
3 | Gamma LUT | 0xA018_0000 | NA | 19 (97) |
4 | VPSS CSC | 0xA0001_0000 | NA | 21 (99) |
5 | VPSS Scaler | 0xA004_0000 | NA | 3 (81) |
6 | Video Frame Buffer Write | 0xA01A_0000 | AXI_INTC_1[0] | 4 (82) |
Channel 1 | ||||
2 | Sensor Demosaic | 0xA01C_0000 | NA | 5 (83) |
3 | Gamma LUT | 0xA01B_0000 | NA | 22 (100) |
4 | VPSS CSC | 0xA002_0000 | NA | 23 (101) |
5 | VPSS Scaler | 0xA008_0000 | NA | 6 (84) |
6 | Video Frame Buffer Write | 0xA01D_0000 | AXI_INTC_1[1] | 7 (85) |
Channel 2 | ||||
2 | Sensor Demosaic | 0xA01F_0000 | NA | 8 (86) |
3 | Gamma LUT | 0xA01E_0000 | NA | 24 (102) |
4 | VPSS CSC | 0xA003_0000 | NA | 25 (103) |
5 | VPSS Scaler | 0xA00C_0000 | NA | 9 (87) |
6 | Video Frame Buffer Write | 0xA020_0000 | AXI_INTC_1[2] | 10 (88) |
Channel 3 | ||||
2 | Sensor Demosaic | 0xA022_0000 | NA | 11 (89) |
3 | Gamma LUT | 0xA021_0000 | NA | 26 (104) |
4 | VPSS CSC | 0xA010_0000 | NA | 27 (105) |
5 | VPSS Scaler | 0xA014_0000 | NA | 12 (90) |
6 | Video Frame Buffer Write | 0xA023_0000 | AXI_INTC_1[3] | 13 (91) |
Misc |
|
|
|
|
| I2C Mux | NA | NA | 34 (112) |
Video Codec Unit IP Parameters
IP | Address | Interrupt Sink | EMIO Reset (QNX GPIO #) |
Video Codec Unit | 0xA030_0000 | pl_ps_irq0[2] == GIC[123] | 41 (119) |
AXI Interrupt Controllers (PL Based)
IP | Base address | Interrupt Parent | Output Type |
AXI_INTC1 | 0xA011_0000 | pl_ps_irq0[1] == GIC[122] | Level High |
Common Platform Notes
For QNX, MIO is mapped to GPIO 0-77, EMIO is mapped to GPIO 78-173
pl_ps_irq0 = GIC 121:128, pl_ps_irq1 = GIC 136:143 . QNX uses actual GIC number.
For Interrupts connected through AXI_INTC, the logical interrupt numbers used by QNX are as follows:
1st AXI_INTC: 0x2000 to 0x0201F
2nd AXI_INTC: 0x2020 to 0x0203F
3rd AXI_INTC: 0x2040 to 0x0205F
4th AXI_INTC: 0x2060 to 0x0207F
Appendix B: Example ctrlsw_encoder Config File Format
The following example configuration file is used to a convert a 1080p YUV420 file avc/h264. For more info, refer to PG252.
ctrlsw_encoder -cfg avc_1080p60.cfg
Input Summary:
file: csw_AIR_1080p30_nv12_4B_h264.yuv
Size: 1920x1080
Color Space: I420
Output Summary:
file: csw_AIR_1080p30_nv12_4B_h264_yuv.h264
profile: AVC_MAIN Level 4
Appendix C: Test Videos
Test .mp4 Videos
Big Buck Bunny: https://download.blender.org/demo/movies/BBB/
Elephant’s Dream: https://archive.org/details/ElephantsDream
Creating avc/hevc Encoded Videos From .mp4
# convert to h.264/avc
ffmpeg -i input.mp4 output.h264
ffmpeg -i test.mp4 -c:v copy -bsf h264_mp4toannexb out.h264
# convert to h.265/hevc
ffmpeg -i test.mp4 -c:v copy -bsf hevc_mp4toannexb out.h265
Creating .mp4 From avc/hevc Encoded Videos
ffmpeg -i <input file in hevc or avc> -c:v copy -f mp4 <output file>.mp4
Raw Videos
https://media.xiph.org/video/derf/
These .y4m videos can be converted to YUV with the following ffmpeg command:
ffmpeg -i example.y4m test.yuv
Related content
© Copyright 2019 - 2022 Xilinx Inc. Privacy Policy