Using the PowerVR SDK to Optimize your...
Transcript of Using the PowerVR SDK to Optimize your...
© Imagination Technologies p1 www.imgtec.com
March, 2013
Using the PowerVR SDK to Optimize your Renderer
© Imagination Technologies p2 www.imgtec.com
First, an Introduction
© Imagination Technologies p3
Who are we?
Who?
Joe Davis, Developer Technology Engineer
Bob Gardner, Developer Technology Engineer
Both from Imagination Technologies
© Imagination Technologies p4
Who are Imagination?
Leading silicon, software & cloud IP supplier
Multimedia: graphics; GPU compute; video; vision
Communications: demodulation; connectivity; sensors
Processors: applications CPUs; embedded MCUs
Cloud: device and user management; services
Targeting high volume, high growth markets
Top semis and OEMs for mobile, connected home consumer
automotive and more
Pure: our strategic product division
Digital radio, internet connected audio, home automation
Established technology powerhouse
Founded 1985; London FTSE 250 (IMG.L); ~1,500 employees
UK HQ; global operations
Comprehensive IP
portfolio for SoCs
& cloud connectivity
IP business pathfinder
Market maker/driver
© Imagination Technologies p5 www.imgtec.com
What’s the Focus?
© Imagination Technologies p6
The Focus
Optimisation Tools Stability, functionality and GUI of PVRTune and PVRTrace
+
A Live Demo of the new features
© Imagination Technologies p7
The Focus
But First…
© Imagination Technologies p8 www.imgtec.com
What is the PowerVR SDK?
© Imagination Technologies p9
What is the PowerVR Insider SDK?
Asset creation Development Debugging and profiling
+ PVRTexTool
PVRGeoPOD
+ PVRVFrame
PVRShaman
PVRShaderEditor
+ PVRTune
PVRTrace
PVRScope
© Imagination Technologies p10
What is the PowerVR Insider SDK?
Assists in rapid application development, debugging, and performance analysis
Educational resource for embedded graphics techniques
Develop on…
Develop for…
Windows OSX Linux
Windows OSX Linux BB10 iOS Android
© Imagination Technologies p11 www.imgtec.com
Asset Optimization
Utilities
© Imagination Technologies p12
PVRGeoPOD
Geometry exporter and optimizer
Provided as…
Plug-in (Blender, Maya and 3D Studio)
Standalone GUI
Standalone command-line tool
Features
Triangle sorting
Vertex sorting
Data stripping
© Imagination Technologies p13
What is POD?
POD is the PowerVR Object Data format
Optimized deployment format for 3D geometry and animation with a public specification
De facto standard format used in successful AAA mobile games
Minigore 2: Zombies Bike Baron
© Imagination Technologies p14
Shout out to Mountain
Sheep for the awesome
screenshots
© Imagination Technologies p15
PVRTexTool
Texture compressor and converter
Provided as…
Stand-alone GUI & Command-line tool
PVRTexLib
Photoshop plugin
Features
Support for all core file formats for OpenGL
ES 1.x/2.0/3.0 as well as DirectX 9/10/11
Primary tool for converting to PVRTC
© Imagination Technologies p16
What is PVRTC?
What is PVRTC?
High quality, high ratio texture compression format,
designed for PowerVR hardware
Lowest, widely available, bitrate of any texture
compression format
Two variations
4 bits and 2bits per pixel
Both variations support alpha channels
Stored in .PVR files by default
Public file format specification
© Imagination Technologies p17 www.imgtec.com
Development
Utilities
© Imagination Technologies p18
PVRShaderEditor
Syntax highlighted shader & kernel editor
Also useful for shader verification and profiling
Provided as…
Stand-alone GUI
Features
Error output for PowerVR hardware
Profiling with overall and per line cycle counts for
GLSL ES
© Imagination Technologies p19
GLSL Profiling Compilers
Provided as…
Command-line tool
Exposes GLSL ES shader profiling information
Estimated per-line & total cycle counts
Compiler provided for every family of PowerVR GPU
Note: Profiling compilers don’t generate binaries
Disassembly compilers available under NDA
Built in to PVRShaderEditor
© Imagination Technologies p20
PVRShaman
Shader Development Environment
Provided as…
Stand-alone GUI
Features
Integrated PVRShaderEditor & Profiler
Works with POD scenes and can import Collada
files
Immediate scene visualisation
Support for OpenGL and OpenGL ES graphics
APIs.
© Imagination Technologies p21
PVRVFrame
PowerVR OpenGL ES emulator
Supports ES 1.1, 2.0, 3.0
Provided as…
Dynamic library, with control GUI
Features
IMG extensions
Hardware profiles
Debugging output
© Imagination Technologies p22 www.imgtec.com
Debugging and Profiling
Utilities
© Imagination Technologies p23
PVRTrace
OpenGL ES API Tracer
Provided as…
Analysis GUI with Recording Libraries and Control
APK
Features:
Records GL Calls, data, and render state for any
number of frames
Playback whole traces, frames, ranges of calls, or
single calls
Edit traces, and playback the newly edited traces on
device
© Imagination Technologies p24
PVRTune
PowerVR GPU Performance Analyser
Provided as…
Analysis GUI with Server on device
Features:
Real-time hardware data using hardware level
registers and counter
Negligible impact on performance
Counters are enabled by default on most devices
No special builds of application required to do
performance analysis
© Imagination Technologies p25
PVRScope
Interface to the performance analysis stats
found in PowerVR hardware
Provided as…
Static library
Features
Provides access in any application to
PVRTunes statistics
OR:
Can be used to send custom counters &
custom markers to PVRTune
© Imagination Technologies p26 www.imgtec.com
Source Code
© Imagination Technologies p27
PVRShell
Graphics-focused OS abstraction framework
Allows application development without worrying
about the platform underneath
Enables quick and easy application porting with
a consistent implementation across each API
and OS
Supports all PowerVR platform configurations
© Imagination Technologies p28
PVRTools
Tackles common functionality required during
graphics development
Texture, model and shader runtimes
Vector, matrix, and Quaternion maths
3D text display functions
Extension retrieval
Etc.
Cross platform tools library
Tested to work on all PowerVR platforms
Consistent implementation across APIs
© Imagination Technologies p29
Examples
Step by step guide from the basics of computer
graphics to advanced effects tailored for mobile
devices
PVRShell and PVRTools used consistently
across all the examples
Same examples across all APIs (OpenGL,
OGLES 1.1, 2.0 and 3.0)
© Imagination Technologies p30
Documentation
Wide range of documentation to support
development
Architecture Guide
Performance recommendations
User Manuals
Etc.
Whitepapers for specific technologies &
techniques
Water effects
UI Render
Etc.
© Imagination Technologies p31 www.imgtec.com
What’s New in SDK 3.1
© Imagination Technologies p32
Just A Reminder
Focus on Optimisation Tools Stability, functionality and GUI of PVRTune and PVRTrace
© Imagination Technologies p33 www.imgtec.com
PVRTune
© Imagination Technologies p34
Initial Rogue Support
Initial Series6 support
Series6 specific counters
Series6 specific timing data
Timing data colouration coming soon
Also includes better compute support
© Imagination Technologies p35
Render State Override
PVRTune now includes render state
override capability
See the effect on performance, in real
time of disabling and changing various
states.
Makes it much easier to test hypotheses
quickly
Even more so if you’re using PVRScope to
remotely edit your app
© Imagination Technologies p36
Improved GUI
SDK 3.0 ported all our applications to Qt
SDK 3.1 includes considerable GUI improvements
Improved counter description panel
Improved group selection
Improved state saving
Many more
© Imagination Technologies p37
Improved Counter Descriptions
… they will tell you:
What the counter represents
What a high value of the counter means
How you can try to solve the problem
© Imagination Technologies p38 www.imgtec.com
PVRTrace
© Imagination Technologies p39
OpenGL ES 3.0 Tracing
SDK 3.0 allowed ES 3.0 recording but
could only display the call list
SDK 3.1 now includes full functionality
for ES 3.0
…and any IMG extensions
© Imagination Technologies p40
Pixel Picker
User can select a pixel from the Image
Analysis panel
See what shaders affected that pixel
Double click a shader to open it in the
shaders tab
…then edit it…more on this later
© Imagination Technologies p41
Shader Analysis
Displays the following for the current frame:
Fragment Cost
Num. times shader is ran * cycle count of shader returned by profiling compiler
Fragment Count
Num. times shader is ran
Fragment Texture Reads
Num. times shader is ran * num. texture reads
© Imagination Technologies p42
Editing & Splitting
Trace files can be edited & saved
Shaders changed
Calls disabled
Quickly see if something fixes a bug
before committing a change
Trace files can be split
Save sub-sections of traces
Useful for repeatedly playing back or
examining traces
© Imagination Technologies p43
Playback
Play a trace file, even one that has been edited
Record calls on one platform, play them back on another
Change things in the PVRTrace GUI, play them back on platform
Identify problems, find solutions, test them, all without having to touch your code
First public iteration
Find it in the PVRTrace package in the SDK
© Imagination Technologies p44
Time for a demo
Let’s see how it all works
© Imagination Technologies p45 www.imgtec.com
Using PVRTune – A Practical Approach
© Imagination Technologies p46
What is PVRTune?
PowerVR GPU Performance Analyser
Provided as…
Analysis GUI with Server on device
Features:
Real-time hardware data using hardware level
registers and counter
Negligible impact in performance
Counters are enabled by default on most devices
No special builds of application required to do
performance analysis
© Imagination Technologies p47
Installing & Running PVRTune
Install the PVRPerfServer
adb install
PVRPerfServerDeveloper.apk
Using ADB on Android
Forward the 6520 port
adb forward tcp:6520 tcp:6520
Run PVRTune
Connect to ‘localhost’
© Imagination Technologies p48
The PVRTune GUI What does it all mean?
Counter List
Renderstate
Override
Counter
Description
Remote
Editor
Active Counter List
Counter Graphs
Timing Data
© Imagination Technologies p49 www.imgtec.com
The Five Basic Bottlenecks
Reading PVRTune
© Imagination Technologies p50
Identifying Bottlenecks
Bottlenecks usually fall into one of five categories:
CPU limited,
Vertex limited,
V-Sync limited,
Fragment limited, or
Bandwidth limited.
We’ll show you how to spot these
For everything else…
A.K.A. Why is my application running so slow?
© Imagination Technologies p51
Identifying Bottlenecks
…read the counter descriptions…
A.K.A. Why is my application running so slow?
© Imagination Technologies p52
Identifying Bottlenecks
… they will tell you:
What the counter represents
What a high value of the counter means
How you can try to solve the problem
A.K.A. Why is my application running so slow?
© Imagination Technologies p53
CPU Limited
Gaps between TA & 3D Blocks
Gaps in the USSE Load
One or more
CPUs at max
load
© Imagination Technologies p54
Vertex Limited
High TA Load
Very little gap between TA Tasks
Gaps between
3D tasks
High USSE Load: Vertex
© Imagination Technologies p55
Fragment Limited
High USSE Load: Pixel
Very large gaps between TA Tasks
No gaps
between 3D
tasks
High USSE clock cycles per pixel
© Imagination Technologies p56
Bandwidth Limited
No direct way for PVRTune to show bandwidth information
Will often appear as other bottlenecks but with illogical data
There are two main giveaways that you are bandwidth limited:
‘TA/3D’ shows the application to be fragment limited but the ‘USSE Load: Pixel’ is low
‘TA/3D’ shows the application to be vertex limited but the ‘USSE Load: Vertex’ and ‘TA load’
are low
As a rule of thumb, whenever possible, optimise for bandwidth usage
© Imagination Technologies p57
V-Sync Limited
Easy to determine…you’ll probably have turned it on
If you haven’t, look out for the following:
GPU goes to sleep intermittently
Frame rate hovers around a set number
Turn it off to profile, or it’ll add noise to your readings
© Imagination Technologies p58 www.imgtec.com
Using PVRTrace – A Practical Approach
© Imagination Technologies p59
What is PVRTrace?
OpenGL ES API Tracer
Provided as…
Analysis GUI with Recording Libraries and Control
APK
Features:
Records GL Calls, data, and render state for any
number of frames
Playback whole traces, frames, ranges of calls, or
single calls
Edit traces, and playback the newly edited traces on
device
© Imagination Technologies p60
Installing & Running PVRTrace
Install the PVRTrace Installer
adb install PVRTraceApp.apk
Using ADB on Android on a rooted device
Install the recording libraries
Set up the recording libraries
Trace the application
© Imagination Technologies p61
The PVRTune GUI What does it all mean?
Call Summary &
Frame Summary
Trace modification
information, search
output, emulator
output
Render state
information Pixel Analysis
Texture Viewer
and Shader
Viewer
Image Analysis
& Playback
Function Call List
Frame Scrubber
© Imagination Technologies p62 www.imgtec.com
Using PVRTrace – Without Root
© Imagination Technologies p63
Tracing without Root on Android
It is possible to run PVRTrace without rooting the device
1. Tell the Native Activity to
load the recording libraries
2. Tell the Android.mk to point
to the correct libraries
3. Perform an NDK Build then copy the recording libraries to
‘<build_output>/libs/armeabi-v7a/’
© Imagination Technologies p64
Tracing without Root on Android
4. Install your application
5. Create ‘pvrtrace.cfg’ in the root of /sdcard
6. Make sure ‘pvrtrace.cfg’ points to the Android
‘shim’ drivers, not the actual drivers
7. Run the application, and analyse the trace
pvrtrace.cfg example:
© Imagination Technologies p65 www.imgtec.com
March, 2013
Getting the SDK
© Imagination Technologies p66
Download it now! How to get it?
http://bit.ly/PVR_SDK
Download the installer
Next, next, next…
Done!
Or grab a DVD
Booth 512
We also have T-Shirts
© Imagination Technologies p67
PowerVR Insider
http://bit.ly/PVR_SDK
Benefits of being a PowerVR Insider
PowerVR Insider SDK downloads
Open developer forums
Email support from our Dev. Tech. team
Documentation & FAQs
Training (web based, our site, or your site)
Early access
NDA only tools (on request)
© Imagination Technologies p68 www.imgtec.com
March, 2013
What’s New in SDK 3.1