Design Overview


This module combines all the previous modules by:
  • adding the heartbeat component running on RPU0
  • adding the perfapm-server component running on RPU1
  • adding the perfapm-client library integrated into the video_qt2 application

The perfapm-client and perfapm-server components communicate via RPMsg on the master side and OpenAMP on the remote side.
The remoteproc framework is used by the master to download the perfapm-server firmware on the remote.
Instead of printing the throughput numbers on the serial console as done in module 4, the numbers are now plotted as graph in the Qt GUI.
The perfapm-server and heartbeat applications demonstrate simultaneous, independent execution on both RPU cores configured in split mode.

btrd_dm10_2017.4.jpg



Design Components


This module requires the following components:
  • zcu102_base_trd (SDSoC)
  • petalinux_bsp
    • zynqmp_fsbl
    • pmufw
    • bl31
    • u-boot
    • kernel
    • device tree
    • rootfs
  • filter2d_optflow (accelerators)
  • sdxfilter2d (gstreamer plugin)
  • sdxopticalflow (gstreamer plugin)
  • video_qt2
    • video_lib
    • gst_lib
    • perfapm-client
  • perfapm-server
    • perfapm
  • heartbeat



Build Flow Tutorials


2D Filter and Optical Flow Combined Sample and GStreamer Plugins


There is no need to rebuild the filter2d_optflow SDx project and the GStreamer libraries and plugins if you have already built it in module 9, otherwise follow the instructions from module 9.

  • Copy the dm9 bitstream to the PetaLinux project and the matching library to the dm10 SD card directory.
    % mkdir -p $TRD_HOME/sd_card/dm10-new/lib $TRD_HOME/sd_card/dm10-new/gstreamer-1.0
    % cd $TRD_HOME/workspaces/ws_f2dof/
    % cp filter2d_optflow/Release/libfilter2d_optflow.so.bit $TRD_HOME/petalinux/bsp/images/linux
    % cp filter2d_optflow/Release/libfilter2d_optflow.so $TRD_HOME/sd_card/dm10-new/lib
  • Copy the dm9 GStreamer libraries and plugins to the dm10 SD card directory.
    % cp gst/allocators/Debug/libgstsdxallocator.so gst/base/Debug/libgstsdxbase.so $TRD_HOME/sd_card/dm10-new/lib
    % cp gst/plugins/filter2d/Debug/libgstsdxfilter2d.so gst/plugins/optical_flow/Debug/libgstsdxopticalflow.so $TRD_HOME/sd_card/dm10-new/gstreamer-1.0

Video Qt Application


This tutorial shows how to build the video library and the video Qt application

  • Make sure the build environment is set (see DM5 tutorial). Generate a Makefile for the Qt project for DM10.
    % cd $TRD_HOME/workspaces/ws_video/video_qt2
    % qmake video_qt2-dm10.pro -r -spec linux-oe-g++
  • If not already open from a previous module, browse to the Qt workspace and open it.
    % cd ..
    % sdx -workspace . &
  • 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 dm10 SD card directory.
    % cp $TRD_HOME/workspaces/ws_video/video_qt2/video_qt2 $TRD_HOME/sd_card/dm10-new

Heartbeat Application


Please refer to design module 2 Heartbeat Application for instructions or skip this step if you have built the heartbeat application in a previous module.

  • Copy the heartbeat executable into the PetaLinux BSP.
    % cd $TRD_HOME/workspaces/ws_heartbeat
    % cp heartbeat/Debug/heartbeat.elf $TRD_HOME/petalinux/bsp/images/linux

Perfapm-Server Application


Please refer to design module 4 Perfapm-server Application for instructions or skip this step if you have built the perfapm-server application in a previous module.

  • Copy the perfapm-server firmware to the DM10 SD card directory.
    % cd $TRD_HOME/workspaces/ws_perfapm-server
    % cp perfapm-server/Debug/perfapm-server.elf $TRD_HOME/sd_card/dm10-new

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 10 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-dm10.dtsi system-user.dtsi
    % petalinux-build
  • Create a boot image.
    % cd $TRD_HOME/petalinux/bsp/images/linux
    % petalinux-package --boot --bif=../../project-spec/boot/dm10.bif --force
  • Copy the generated boot image and Linux image to the dm10 SD card directory.
    % cp BOOT.BIN image.ub $TRD_HOME/sd_card/dm10-new



Run Flow Tutorial


  • See here for board setup instructions.
  • Copy all the files from the $TRD_HOME/sd_card/dm10 SD card directory to a FAT formatted SD card.
  • Power on the board to boot the image; make sure INIT_B, done and 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).The application will detect whether DP Tx or HDMI Tx is connected and output on the corresponding display device.
  • 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.
    dm10_2017.4.jpg
  • The user can select from the following video source options:
    • TPG (SW): virtual video device that emulates a USB webcam purely in software
    • USB: USB Webcam using the universal video class (UVC) driver
    • TPG (PL): Test Pattern Generator implemented in the PL
    • HDMI: HDMI input implemented in the PL
    • CSI: MIPI CSI image sensor pipeline in the PL
    • File: Read input from a raw video file
  • The user can select from the following accelerator options:
    • Passthrough (no accelerator)
    • 2D convolution filter with configurable coefficients
    • Dense optical flow algorithm
  • The supported accelerator modes depend on the selected filter:
    • SW - accelerator is run on A53 (filter2d only)
    • HW - accelerator is run on PL
  • 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.
  • The memory throughput graph (bottom right) shows memory traffic generated by video source, accelerator and display.
  • The TPG settings panel gives access to advanced TPG controls:
    tpg_settings.jpg
  • The CSI settings panel gives access to advanced CSI controls including:
    • Sony IMX274 image sensor
    • Gamma control IP
    • Color Correction IP (CSC)
    csi_panel_2017.4.jpg
  • The 2D filter settings panel gives access to advanced filter controls:
    2dfilter_settings.jpg
  • The demo mode settings panel allows the user to create a demo sequence combining video sources, accelerators, and modes:
    GUI_demo.jpg
  • The file browser allows the user to select a video file for play back when file source is selected:
    file_browser.jpg

Raw Video File Capture


To capture a raw video file for playback, use the serial console and the gst-launch utility e.g.
% gst-launch-1.0 videotestsrc pattern=ball num-buffers=240 ! "video/x-raw, width=1920, height=1080, format=YUY2" ! filesink location=/home/root/test.yuv
Parameters:
  • num-buffers is the number of video frames to be captured
  • width and height define the video resolution and should be matched with the display resolution
  • format should always be set to YUY2 as that is the expected format by the display and accelerator devices

In the above example, 240 buffers equals to 4 seconds of video playback at 1080p60. The amount of memory required is about 1GB as the frames are raw. In this example the file is stored directly on the ramdisk i.e. in DDR memory. For best performance it is advised to store the file in DDR, or a USB3 or SATA drive. The SD card read performance will be slow.



Return to the Design Tutorials Overview.