For this blog post I will assume that you are somewhat familiar with the PowerVR architecture and even played a bit with PVRTune, our GPU profiler.

PVRScopeDeveloper is included in our public PowerVR Graphics SDK. It is distributed as a set of headers (.h) and a static library (.a) for every major architecture.

PVRScope overview

PVRScope: HWperfPVRScopeDeveloper is a utility library which has twofold functionality, illustrated below:

  1. PVRScopeStats – Access the hardware performance counters in PowerVR hardware via a driver library called PVRScopeServices.
  2. PVRScopeComms – Send user defined information to PVRTune via PVRPerfServer as counters, timing data, and marks, or editable data that can be passed back to the application.

In this blog post I will focus only on PVRScopeStats, while I’ll tackle PVRScopeComms in an upcoming article.

PVRScopeServices, the man behind the curtain

PVRScopeServices is part of our user-space driver. We actively encourage all our Android and Linux customers to include PVRScopeServices in their release devices as it enables PVRTune graphics performance analysis. This means that we can assume pretty safely that any Android/Linux PowerVR device will also have PVRScopeServices built-in.

It lives along with the rest of our user space driver (i.e. /system/vendor/lib/libPVRScopeServices.so).

A closer look to the data:

PVRScopeDeveloper exposes the PowerVR hardware performance data (“HWPerf data” from now on) to any user-space application. Let’s look at the data closely:

PVRScope

Where does the HWPerf data come from?

PowerVR, due to its unique TBDR architecture featuring a MicroKernel, dumps all the performance counter values into a circular buffer in the kernel memory space (we call it the HWPerf CB).

That data is read by the kernel driver and pushed to the user-space when requested by PVRScopeServices.

Note: Once that data is read, it gets “consumed” so is no longer available in the kernel. This prevents more than one “PVRScope enabled” applications (including PVRPerfServer) to run at the same time.

What stats are we exposing in PVRScopeDeveloper?

The full counter list depends on the device but most counters are common to all devices. An exhaustive list can be found in the PVRTune user manual.

For example, the counters on the Active Group 0 (for SGX540 running the 1.8 DDK) are:

  • Frame time
  • Frames per second (FPS)
  • GPU task load: 2D core
  • GPU task load: 3D core
  • GPU task load: CDM core
  • GPU task load: TA core
  • TA load
  • Texture unit(s) load
  • USSE clock cycles per pixel
  • USSE clock cycles per vertex
  • USSE load: Pixel
  • USSE load: Vertex
  • Vertices per frame
  • Vertices per second

What can you do with this data?

There are many reasons to include PVRScopeDeveloper on any application you are profiling. For example you could graph the data to find any performance spikes, generate reports to plot them afterwards or simply feed that data to any other custom tool.

PVRScope: example

The PowerVR SDK includes two PVRScopeDeveloper examples:

  • PVRScopeExample (uses PVRScopeStats) – Demonstrates the use of pvrscope and the example graphing code that allows an application to return performance statistics from the GPU in real time.
  • PVRScopeRemote (uses PVRScopeComms) – Demonstrates the use of PVRScope’s remote communication features, this example shows how to use the editable data and custom mark functionality. PVRTune must be running and connected to an instance of PVRPerfServer running on the target device for this demo to function.

Don’t forget to check our PVRScopeDeveloper examples included in the PowerVR SDK and follow us on Twitter (@ImaginationPR and @PowerVRInsider) for the latest news and announcements for PowerVR developers!

About the author: Guillem Vinals Gangolells

Profile photo of GuillemV

I'm a Developer Technologies Engineer for the PowerVR division in Imagination Technologies, company in which I've been working since early 2011.My main task consists in the design of developer tools as well as in the integration of the PowerVR graphics in the Android ecosystem. Leaving the technical part aside, I also travel to some international events in order to collect feedback, give technical talks and meet with other companies

View all posts by Guillem Vinals Gangolells