This blog post intends to be a replacement for the “PVRTrace.Quick Start Guide for Android Rooted” document included in the latest PowerVR Graphics SDK v3.2. My article aims to better reflect the current content of this SDK and get you up to speed with PVRTrace on Android in just a few minutes.
- You have installed the PowerVR Graphics SDK v3.2
- You have a rooted Android device (Android 4.4 “KitKat” is not yet supported)
Notice that a device with a PowerVR GPU is not needed in order to trace the graphics API calls. On the other hand, we don’t usually test our tools on non-PowerVR devices.
If your target device cannot be rooted just check this older blog post of mine on PVRTrace and rootless recording on Android.
(Recommended) Further reading
- Joe’s blog post introducing PVRTrace
- Joe’s follow-up blog posts covering the PVRTrace GUI in detail:
Step 1: Installing PVRHub
PVRHub is the Android application used to install the PVRTrace recording libraries in our device. It can be installed using ADB.
adb install /path/to/PowerVR_SDK/PVRHub/Android_armeabi_armeabi-v7a_x86_mips/PVRHub.apk
Step 2: Installing the PVRTrace recording libraries in the device
The installation can be done both manually (adb push) or by using PVRHub. The manual installation is out of the scope of this blog post, you can find the detailed instructions in the PVRTrace User Manual.
Simply click the “Install” (A) button.
Step 3: Tracing an application
Click on “Trace an application…” (B)
and choose the app of your choice (C).
The logcat output should display something like:
I/ActivityManager(247): Displayed com.powervr.OGLES2Water/.OGLES2Water: +337ms I/PVRTrace(I)(3818): The current working directory is / I/PVRTrace(I)(3818): Config file found: /data/data/com.powervr.PVRHub/pvrtrace.cfg I/PVRTrace(I)(3818): Config File HostEs1LibPath: /system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so I/PVRTrace(I)(3818): Config File HostEs2LibPath: /system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so I/PVRTrace(I)(3818): Config File HostEs3LibPath: I/PVRTrace(I)(3818): Processes excluded from recording: com.powervr.PVRHub I/PVRTrace(I)(3818): Processes included for recording: com.powervr.OGLES2Water; I/PVRTrace(I)(3818): Recorder enabled for current process: com.powervr.OGLES2Water I/PVRTrace(I)(3818): Opening trace file to record: /data/data/com.powervr.PVRHub/recordings/com.powervr.OGLES2Water.pvrt D/libEGL(3818): loaded /vendor/lib/egl/libEGL_PVRTRACE.so I/PVRTrace(I)(3818): Loading host library '/system/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so' I/PVRTrace(I)(3818): Host library '/system/vendor/lib/egl/libEGL_POWERVR_SGX540_120.so' loaded I/PVRTrace(I)(3818): Loading host library '/system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so' I/PVRTrace(I)(3818): Host library '/system/vendor/lib/egl/libGLESv1_CM_POWERVR_SGX540_120.so' loaded I/PVRTrace(I)(3818): Loading host library '/system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so' I/PVRTrace(I)(3818): Host library '/system/vendor/lib/egl/libGLESv2_POWERVR_SGX540_120.so' loaded D/libEGL(3818): loaded /vendor/lib/egl/libGLESv1_CM_PVRTRACE.so D/libEGL(3818): loaded /vendor/lib/egl/libGLESv2_PVRTRACE.so I/com.powervr.OGLES2Water(3818): PVRShell: EGL 1.4 initialized I/PVRTrace(I)(3818): Recording... Current frame: 1 I/PVRTrace(I)(3818): Recording... Current frame: 2 I/PVRTrace(I)(3818): Recording... Current frame: 3 I/PVRTrace(I)(3818): Recording... Current frame: 4 I/PVRTrace(I)(3818): Recording... Current frame: 5 I/PVRTrace(I)(3818): Recording... Current frame: 6 I/PVRTrace(I)(3818): Recording... Current frame: 7
Congratulations, you are now tracing all API calls! Let your app run for as many frames as you consider necessary.
Step 4: Getting the trace back from the device
Due to a known bug, PVRHub does not change the recorded trace file permissions so in order to pull it you’ll need to manually change the permissions:
adb shell "su -c chmod 7777 /data/data/com.powervr.PVRHub/recordings/com.powervr.OGLES2Water.pvrt"
Then you can pull it back:
adb pull /data/data/com.powervr.PVRHub/recordings/com.powervr.OGLES2Water.pvrt
You can change the name and location of the recording from the “Options” menu. Notice that writing to the SD card requires the permission:
Now you are all set up and ready to analyse the trace using the PVRTrace GUI. As you’ve seen, it only takes a couple of minutes. We are preparing similar quickstart tutorials for other tools so if you have any questions or requests, please use the comment section to let us know. Make sure you follow us on Twitter (@PowerVRInsider) and come back to our blog for more articles from the PowerVR Developer Technology team.