Document History

Date
Version
Author
Description of Revisions
11/11/2016
1.0
Rajesh Gugulothu
Initial Release
21/02/2017
2.0
Rajesh Gugulothu
Updated with 2016.4 tools Release and Added design
files to support zcu102 Rev-B/Rev-D ,Rev-1.0 boards
10/07/2017
3.0
Rajesh Gugulothu
Updated with 2017.1 tools Release and Added design
files to support zcu102 Rev-D2 with production silicon ,Rev-1.0 boards with production silicon and Rev 1.0 board.
14/06/2018
4.0
Surender Polsani
Updated with 2018.1 tools Release and Added design
files to support zcu102 Rev-D2 with production silicon ,Rev-1.0 boards with production silicon and Rev 1.0 board.

Summary

  • Zynq® UltraScale+™ MPSoC delivers unprecedented levels of heterogeneous multi-processing and combines seven user programmable processors including Quad-coreARM® Cortex™-A53 Application Processing Unit (APU), Dual-core 32-bit ARM® Cortex™-R5 Real Time Processing Unit (RPU), and ARM® Mali™-400 MP2 Graphics Processing Unit (GPU). It is Industry’s First Multi-Processor SoC delivering 5x system level performance-per-watt and any-to-any connectivity.

  • The main aim of this tech tip is to provide steps by step procedure to debug a graphics applicatin on Zynq UltraSCale + MPSoC Mali GPU using ARM® DS-5 Mali graphics debugger tool.It is instructs how to capture the traced data for future analysis and the Mali Graphics Debugger allows developers to trace OpenGL ES API calls in their application and understand frame-by-frame effect on the application to help identify possible issues.

Implementation

Implementation Details
Design Type
PS Only
SW Type
Linux
CPUs
Quad-core ARM® Cortex™-A53 Application Processing Unit,ARM® Mali-400 MP2 Graphics Processing Unit.
PS Features
DDR controller,UART,SD/eMMC interface, USB 3.0,DisplayPort
Boards/Tools
ZCU102 Rev-B/Rev-D,Rev-1.0 with production silicon and Rev 1.0 board
Xilinx Tools Version
SDK 2018.1
Other Details
ARM® DS-5 Mali graphics debugger tool
Host Type
Windows 64-bit

Files Provided
Graphics_Application_Debugging.zip
Archive file contains the Design_files directory
Description

  • The Mali Graphics Debugger allows developers to trace Vulkan (1.0), OpenGL ES (1.x, 2.x, and 3.x), EGL (1.4), and OpenCL (1.x) API calls in their application and understand frame-by-frame the effect on the application to help identify possible issues.It also instructs how to capture the traced data for future analysis.It enables the user to identify draw call related issues,Visualizes an application’s texture usage, to identify opportunities to compress textures or change formats,Understand which vertex and fragment shaders are the most expensive with cycle count reporting,Highlighting of common API misusage and dynamic performance improvement advice.

  • This tech tip provides an easy steps to debug the graphics application running on the Zynq UltraSCale + MPSoC Mali GPU,using ARM Mali graphics debugger tool. It also instructs how to capture the traced data for future analysis.
  • Highlights of this Tech tip:
  • Below are the main topics covered in this tech tip :
  • Executing the tech tip with prebuilt images.
  • Installing ARM Mali graphics debugger tool on windows-64 bit machine.
  • Compiling & building Linux for different silicon versions.
  • Debugging an example graphics application.
Requirements:
  • Linux or windows Host machine
  • Xilinx ZCU102 (Rev D and above) evaluation kit with power supply.
  • Class 10 SD card (4GB or more).
  • Micro USB to Standard USB cable
  • 1080p Monitor or Full HD Monitor and DisplayPort Cable.
  • USB 3.0 connector or USB 2.0 micro cable to standard USB female adapter, USB Hub to connect USB mouse and USB keyboard or connect USB keyboard with mouse integrated etc.
  • Install any HyperTerminal like Tera term, putty, etc. for serial terminal prints. Download the Tera term application at http://download.cnet.com/Tera-Term/3000-20432_4-75766675.html and follow the instructions to install.
Block Diagram:
  • Below Block diagram depicts hardware stack and software flow diagram of debugging graphics application running on Zynq® UltraScale+™ MPSoC Mali-400 GPU using ARM Mali graphics debugger.

Gpu_debugger_block.PNG

Executing the tech tip with prebuilt images:
  • This section helps how to execute this this tech tip using the prebuilt images supplied along with this tech tip.If you want to build all the images from the source then, skip this section.
  • Download the Graphics_Application_Debugging.zip and extract it to a local directory.It will get extracted as below directories
    • Rev_1_0_Design_Files - It has images are for zcu102 Rev-1.0 board.
    • Rev_D_Prod_Design_Files - It has images are for zcu102 Rev-B/Rev-D,Rev 1.0 boards with production silicon.
  • According to the board, copy Prebuilt_SD_Images on to a SD card (4GB or above ).
  • Now copy the Mali Interceptor libraries and the Mali debugger daemons on to the SD card from the Mali installation directory of windows host machine.
    • Find the libinterceptor.so, mgddemon files under the path C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v3.3.0\target\linux\arm64 of host machine and copy them on to the SD card.
  • Make sure that following files are present on the SD card before going to execute the demo.
    • BOOT.BIN
    • image.ub
    • tri_cube
    • libinterceptor.so
    • mgddemon
  • Do the board setup by following the "ZCU102 board setup" section below in this page.
  • Once board setup is done,follow the section "Debugging an example graphics application " to execute the demo.

Installing ARM Mali Graphics Debugger tool on windows:


In this section we are going to explain step by step procedure for installing ARM Mali Graphics debugger tool on windows machine.As the host machine ( windows) and target boards are communicates through the Ethernet.
  • Download the ARM DS-5 tool chain for windows-64 bit machine from ARM Mali developer’s website. and install it on your windows host machine.ARM Mali Graphics debugger tool comes along with this installation.
Note:It is remanded to install ARM DS-5 5.26.2 version.
  • Follow the below link to set the tool for 30 days evaluation license.
https://developer.arm.com/products/software-development-tools/ds-5-development-studio/resources/tutorials/getting-started-with-ds-5-development-studio

Compiling & building Linux Images:

This section goes through the procedure to compile and build the Linux with profiling option enabled.it covers the following topics
  • Follow the section "compiling and builidng Linux with profiling options" from the GPU profiling using ARM Streamline performance analyzer tech tip to build all the images and prepare the SD card.
  • Copy the example graphics application from the Prebuilt_SD_Images directory which are supplied along with this tech tip.
    • Find the libinterceptor.so, mgddemon files under the path C:\Program Files\ARM\Mali Developer Tools\Mali Graphics Debugger v3.3.0\target\linux\arm64 of host machine and copy them on to the SD card.
    • BOOT.BIN
    • image.ub
    • tri_cube
    • libinterceptor.so
    • mgddemon

ZCU102 Board Setup:
Before going to execute the demo , make sure the proper connections between the host system and board.Bellow are the steps to do the same
  • Connect the Micro USB cable into the ZCU102 Board Micro USB port J83, and the other end into an open USB port on the host PC. This cable will be used for UART over USB communication.
  • Connect one end of Ethernet cable into the ZCU102 connector J73, and other end connect to the Ethernet socket of the host machine.
  • As target board and host machines are connected locally in the above step, set the host machine address as to 192.168.1.110 by following below steps
    • In the Windows machine, click on the start button and select the option control Panel-->Network and Internet -->Network and Sharing Center.
    • At the left side pane select the option Change adapter settings.
    • Right click on the Local Area Connection and select properties option.
    • A user access control dialog box will appear, select yes in that.
    • In the Local Area Connection Properties wizard select the internet protocol version 4 ( TCP/IPv4 )option and click on properties tab as marked in the below figure.
    • A properties wizard opens, select the Use the following IP address option and give the IP address as 192.168.1.110 and subnet mask as 255.255.255.0 as following

host_ip_address_1.PNG
Fig: Setting host IP address


  • Insert SD card into the SD card slot J100.
  • Set the SW6 switches as shown. This configures the boot settings to boot from SD:
sw6_setup.JPG
  • Connect 12V Power to the ZCU102 6-Pin Molex connector.
  • Connect the monitor using DisplayPort cable to U50.
  • The following figure shows the ZCU102 board with connections
board_setup.JPG

Debugging an example graphics application:

This section walks through the steps how to execute and debug a graphics application using ARM Mali graphics debugger.
  • Now power on the board.
  • Setup the Tera term application with following configuration
    • Baud rate 115200
    • Stop 1 bit
    • Data 8bit
    • Parity none
    Note: In the serial communication port selection, select the Interface 0 as marked yellow in the below figure
  • Once the Tera term is connected to the target, Linux booting logs will appear on the terminal. After few second, it will asks for linux username and password. Type username and password as “root “.
    • Set the IP address as 192.168.1.111 on the target side with the following command
      • $ ifconfig eth0 192.168.1.111
    Note: setting the IP address for target is of user choice but make sure that both host and target IP addresses are in same network domine and Make sure that host and target are connected properly by doing ping form either side.
  • mount the SD card
    • $ mount /dev/<device_name> /media
  • copy the Mali interceptor.so and mgddaemon from the SD card to /usr/malidebug by entering following commands on the Linux prompt
    • $mkdir /usr/malidebug
    • $cp /media/libinterceptor.so /usr/malidebug
    • $cp /media/mgddaemon /usr/malidebug
  • set the soft links for interceptor libraries by entering following commands on the Linux prompt
    • ln -s /usr/malidebug/libinterceptor.so /usr/malidebug/libEGL.so
    • ln -s /usr/malidebug/libinterceptor.so /usr/malidebug/libGLESv1_CM.so
    • ln -s /usr/malidebug/libinterceptor.so /usr/malidebug/libGLESv2.so
    • ln -s /usr/malidebug/libinterceptor.so /usr/malidebug/libOpenCL.so
  • Set the Interceptor Libraries path.
    • $LD_LIBRARY_PATH=/usr/malidebug/:
    • $MGD_LIBRARY_PATH=/usr/lib/
  • Start the Mali debugger daemon process in the background with the command
    • $ cd /usr/malidebug
    • $ ./mgddaemon &
  • After running the mgddaemon, observer the prints on the Tera term as show in in below figure

mgddaemon_running.PNG
Fig: MGD daemon running log


  • Now run the application on the target side
    • $cd /media
    • $ ln -s /usr/lib/libMali.so.8 /usr/lib/libMali.so.1
    • $LD_PRELOAD=/usr/malidebug/libinterceptor.so ./tricube &
  • Observer the application running on the monitor connected to the boad.
  • Now open the Mali Graphics Debugger application in host machine .After the application is opened it looks like as shown

Mali_Debugger_2.PNG
Fig: Mali Graphics debugger

  • Connect the Mali Graphics debugger application to the target the IP address 192.168.1.111 as following
  • In menu bar of Mali Graphics debugger application ,select Debug->Connect to target option as shown
connect_debugger_target.PNG
Fig: Connecting Debugger with target


  • After selectioning above option following error dialog box will appear. Select Set Target IP option in that

setting_ip.PNG
Fig:Selecting Set Target IP option
  • Set the Target IP address and Port number wizard will open ,in that give the IP address of target in the IP Address option like as shown in the below figure and don’t change the Port number option

writing_ip.PNG
Fig:Writing IP address


  • With the above steps Mali graphics debugger is connected with the target board. Now you are ready to debug the graphics application.

frame_analysis
Fig:Single Frame capture
Appendix A:File Description in Design directory

    • Graphics_Application_Debugging.zip is extracted as
      • Rev_1_0_Design_Files
        • Prebuilt_SD_Images
          • BOOT.BIN
          • image.ub
          • tri_cube

      • Rev_D_Prod_Design_Files
        • Prebuilt_SD_Images
          • BOOT.BIN
          • image.ub
          • tri_cube