Design Overview


This module shows how to build a Qt video application demonstrating the following features:
  • Display via PS DP (DRM framework).
  • Video capture from USB webcam or virtual video device (vivid) (V4L2 framework) or file source
  • GUI overlay via GPU with OpenGL (using Qt framework)

btrd_dm5_2017.4.jpg



Design Components


This module requires the following components:
  • petainux_bsp
    • zynqmp_fsbl
    • pmufw
    • bl31
    • u-boot
    • kernel
    • device tree (zcu102-base-dm5.dtsi)
    • rootfs
  • video_qt2
    • video_lib
    • gst_lib



Build Flow Tutorials


This tutorial uses both SDx and PetaLinux tools. It is recommended to use separate shells for each of the tools.

Note: For consistency the SDx tool is used for all design modules. However, the SDx compiler is not called in this tutorial. SDx is just an eclipse profile that can call the ARM C/C++ compiler, just like XSDK. It is possible to use XSDK to perform the steps in this tutorial. To do so, replace sdx with xsdk in the below code snippet

PetaLinux BSP


This tutorial shows how to build the Linux image and boot image using the PetaLinux build tool. This step assumes you have run through the PetaLinux config in DM1 previously.

  • Select the device-tree matching design module 5 and build all Linux image components. If you have run petalinux-build in a previous module, the build step will be incremental.
    % cd $TRD_HOME/petalinux/bsp/project-spec/meta-user/recipes-bsp/device-tree/files
    % cp zcu102-base-dm5.dtsi system-user.dtsi
    % petalinux-build
  • Create a boot image.
    % cd $TRD_HOME/petalinux/bsp/images/linux
    % petalinux-package --boot --bif=../../project-spec/boot/dm5.bif --force
  • Copy the generated boot image and Linux image to the dm5 SD card directory.
    % mkdir -p $TRD_HOME/sd_card/dm5
    % cp BOOT.BIN image.ub $TRD_HOME/sd_card/dm5

PetaLinux SDK


This tutorial shows how to use the PetaLinux build tool to generate and install an SDK for application development in XSDK or SDx.

  • Install the pre-built SDK or skip this step to generate your own SDK
    % $TRD_HOME/petalinux/sdk.sh -y -d $TRD_HOME/petalinux/sdk
  • Generate and install an SDK for Linux application development.
    Note 1: This step can be skipped and the pre-built SDK installer can be used instead.
    Note 2: You don't have to run this step for subsequent modules. It is sufficient to generate and install the SDK once and then re-use it for other modules.
    % petalinux-build -s
    % petalinux-package --sysroot -d $TRD_HOME/petalinux/sdk

Video Qt Application


This tutorial shows how to build the video library and the video Qt application.
  • Set the build environment variables. This requires that you have previously completed the PetaLinux SDK installation step.
    Note 1: Make sure you set the env variables in the same shell that is used to launch SDx. Also make sure the env variables are set before starting SDx, otherwise close and re-start SDx.
    Note 2: The below command might ask you execute unset LD_LIBRARY_PATH and then re-execute the command. Go ahead and follow those steps.
    % source $TRD_HOME/petalinux/sdk/environment-setup-aarch64-xilinx-linux
  • Set up the Qt environment and generate a Makefile for the Qt project.
    % cd $TRD_HOME/workspaces/ws_video/video_qt2
    % qmake video_qt2-dm5.pro -r -spec linux-oe-g++
  • Create a new SDx workspace.
    % cd ..
    % sdx -workspace . &
  • Click 'Import Project' from the welcome screen, browse to the current working directory and make sure all projects are selected as shown in the figure. Click finish.
    import_dm5_2018_1.jpg
  • Right-click the video_qt2 project and click 'Build Project'.
    base-trd-2016-3-dm5-video-qt-build.png
  • Copy the generated video_qt2 executable to the dm5 SD card directory.
    % cp video_qt2/video_qt2 $TRD_HOME/sd_card/dm5



Run Flow Tutorial


  • See here for board setup instructions. Please note that we cant use HDMI monitors in this design
  • Copy all the files from the $TRD_HOME/sd_card/dm5 SD card directory to a FAT formatted SD card.
  • Power on the board to boot the images; make sure all power rail LEDs are lit green.
  • After ~30 seconds, the display will turn on and the application will start automatically, targeting the max supported resolution of the monitor (one of 3840x2160 or 1920x1080 or 1280x720).
  • To re-start the TRD application with the max supported resolution, run
    % run_video.sh
  • To re-start the TRD application with a specific supported resolution use the -r switch e.g. for 1920x1080, run
    % run_video.sh -r 1920x1080
  • The user can now control the application from the GUI's control bar (bottom) displayed on the monitor.
    dm5_2017.4.jpg
  • The following video sources are available:
    • TPG (SW): virtual video device that emulates a USB webcam purely in software
    • USB: USB webcam using the universal video class (UVC) driver
    • File: Raw video file supplied by user in YUYV format and in the same resolution as mentioned in above "run_video.sh" command
  • The user can select from the following accelerator options:
    • Passthrough (no accelerator)
  • The video info panel (top left) shows essential settings/statistics.
  • The CPU utilization graph (top right) shows CPU load for each of the four A53 cores.



Continue with Design Module 6.
Return to the Design Tutorials Overview.