Arm Mali Graphics Debugger

About

Mali Graphics Debugger (MGD) enables developers to trace OpenGL ES and Vulkan API calls made by their application. MGD users can see a frame-by-frame overview of the work submitted to the graphics API, and can capture specific frames to visualize and inspect the input and output of the rendering commands.

As a graphics API debugger with a Mali GPU focus, MGD can provide GPU architecture-specific analysis and warn users when their API call usage is not optimal. Mali-specific features include:

  • Shader statistics

    • Understand which vertex and fragment shaders are most expensive with cycle count reporting

  • Dynamic optimization advice

    • Automatic highlighting of common API misuse and dynamic performance improvement advice

  • Overdraw histograms

    • Analyse the impact of pixel overdraw

You can learn more about the tool on Arm's Mali Graphics Debugger overview page.

Gallery

Arm Mali Graphics Debugger

Arm Mali Graphics Debugger

Arm Mali Graphics Debugger

Arm Mali Graphics Debugger

Quick Start Guide

(Guide written for Mali Graphics Debugger v4.7.0)

OpenGL ES
  • Download Mali Graphics Debugger

  • Extract the package

    • In this guide, the unpack location will be referred to as $MGD_DIR

    • $PROJ_DIR refers to the directory of your Android project

  • Install the MGD daemon APK

    • adb install -r $MGD_DIR/target/android/arm/MGD.apk

  • Package the interceptor in your APK

    • build.gradle

      android {
      	sourceSets {
      		main {
      		jniLibs.srcDirs += $MGD_DIR/target/android/arm/unrooted/']
      		}
      	}
      }
      
  • Enable the interceptor

    • Create a new Java activity that extends android.app.NativeActivity

    • Reference the activity in your AndroidManifest.xml as android:name attribute of the activity element. Check the android:has Code attribute of the application element is set to true

    • Add the following to the beginning of your project's main Activity class:

      
      static {
      	try {
      	System.loadLibrary("MGD");
      	}
      	catch (UnsatisfiedLinkError e)
      	{
      	Log.e("[ MGD ]", "MGD not loaded: " + e.getMessage());
      	Log.d("[ MGD ]", Log.getStackTraceString(e));
      	}
      }
      
  • Build & install your APK package

  • MGD GUI: Connect to the MGD daemon running on your connected Galaxy device

  • Run your game

  • Capture!

Vulkan
  • Download Mali Graphics Debugger

  • Extract the package

    • In this guide, the unpack location will be referred to as $MGD_DIR

    • $PROJ_DIR refers to the directory of your Android project

  • Install the MGD daemon APK

    • adb install -r $MGD_DIR/target/android/arm/MGD.apk

  • Prepare 32-bit and 64-bit Vulkan MGD layers

    • cp $MGD_DIR/target/android/arm/rooted/armeabi-v7a/libGLES_mgd.so libVkLayerMGD.so

    • cp $MGD_DIR/target/android/arm/rooted/arm64-v8a/libGLES_mgd.so libVkLayerMGD64.so

  • Package Vulkan layers in your APK

    • mv libVkLayerMGD.so $PROJ_DIR/src/main/jniLibs/arm64-v8a/

    • mv libVkLayerMGD64.so $PROJ_DIR/src/main/jniLibs/arm64-v8a/

  • Enable the VK_LAYER_ARM_MGD layer

    • Programmatically

      • Set the layer name via VkInstanceCreateInfo.ppEnabledLayerNames

    • Via adb

      • adb shell setprop "debug.vulkan.layers" VK_LAYER_ARM_MGD layer":"

      • adb reboot

  • Build & install your APK package

  • MGD GUI: Connect to the MGD daemon running on your connected Galaxy device

  • Run your game

  • Capture!