SlideShare a Scribd company logo
1 of 160
Download to read offline
G(PU) force
Hardware acceleration
By Royi Benyossef (+royiby)
G(PU)-force by Royi Benyossef (+royiby)
Android developer since 2009.
GDG Herzliya co-founder.
Android speaker and lecturer.
Android Mentor for Google Launchpad.
Android GDE 2013, 2014, 2015.
Android group leader at Vidmind.
Royi Benyossef
Motivation
Why are we here?
G(PU)-force by Royi Benyossef (+royiby)
Motivation
With a little help from my libs by Royi Benyossef (+royiby)
Motivation
Great UX
With a little help from my libs by Royi Benyossef (+royiby)
Motivation
Great UX Sleek transitions
With a little help from my libs by Royi Benyossef (+royiby)
Motivation
Great UX Sleek transitions
Smooth animations
G(PU)-force by Royi Benyossef (+royiby)
HOW?
G(PU)-force by Royi Benyossef (+royiby)
Hardware
accelerationHOW?
Prolog
What is hardware acceleration?
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
Definition
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
Definition Graphics rendered by the GPU
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
- Definition
In Android
Graphics rendered by the GPU
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
- Definition
In Android
Graphics rendered by the GPU
Canvas drawn by the GPU
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
- Definition
In Android
Graphics rendered by the GPU
Canvas drawn by the GPU
(= HW drawing model)
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
- Definition
In Android
Graphics rendered by the GPU
Canvas drawn by the GPU
(= HW drawing model)
NOT Canvas drawn by the CPU
With a little help from my libs by Royi Benyossef (+royiby)
Prolog
- Definition
In Android
Graphics rendered by the GPU
Canvas drawn by the GPU
(= HW drawing model)
NOT Canvas drawn by the CPU
(!= SW drawing model)
?
??
?
? ?
?
?
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
(Let me dig deeper… please)
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
SW model
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
SW model Invalidate hierarchy
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
SW model Invalidate hierarchy
Draw hierarchy
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
- SW model
HW model
Invalidate hierarchy
Draw hierarchy
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
- SW model
HW model
Invalidate hierarchy
Draw hierarchy
Invalidate hierarchy
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
- SW model
HW model
Invalidate hierarchy
Draw hierarchy
Invalidate hierarchy
Record & update display lists
With a little help from my libs by Royi Benyossef (+royiby)
Android drawing models
- SW model
HW model
Invalidate hierarchy
Draw hierarchy
Invalidate hierarchy
Record & update display lists
Draw hierarchy
Not sure ifstupid...
Or didn’tmake hispoint yet...
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
(How it differs between the SW and HW models)
(P.S. also point #1)
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
SW model
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
SW model Calling item is redrawn
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
SW model Calling item is redrawn
All affiliated items are
redrawn
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
SW model Calling item is redrawn
All affiliated items are
redrawn
* Executed immediately
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
- SW model
HW model
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
- SW model
HW model
Calling item is saved to the
display list
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
- SW model
HW model
Calling item is saved to the
display list
Display list is updated
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
- SW model
HW model
Calling item is saved to the
display list
Display list is updated
Diff is drawn
With a little help from my libs by Royi Benyossef (+royiby)
OnInvalidate()
- SW model
HW model
Calling item is saved to the
display list
Display list is updated
Diff is drawn
* Executed on V-sync
With a little help from my libs by Royi Benyossef (+royiby)
Resources
(Expertise & availability)
(P.S. also points #2 & #3)
With a little help from my libs by Royi Benyossef (+royiby)
Resources
Expertise
With a little help from my libs by Royi Benyossef (+royiby)
Resources
Expertise Specifically designed HW&SW
With a little help from my libs by Royi Benyossef (+royiby)
Resources
- Expertise
Availability
With a little help from my libs by Royi Benyossef (+royiby)
Resources
- Expertise
Availability
Separate resource repo
Benefits
When is it good?
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
OnInvalidate()
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
OnInvalidate() Refresh ONLY what was asked
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
OnInvalidate() Refresh ONLY what was asked
* Not always good
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
OnInvalidate() Refresh ONLY what was asked
* Not always good
Timing is better
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
- OnInvalidate()
Res. expertise
Refresh ONLY what was asked
* Not always good
Timing is better
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
- OnInvalidate()
Res. expertise
Refresh ONLY what was asked
* Not always good
Timing is better
Faster
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
- OnInvalidate()
Res. expertise
Refresh ONLY what was asked
* Not always good
Timing is better
Faster
Better quality
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
- OnInvalidate()
- Res. expertise
Res. avail.
Refresh ONLY what was asked
* Not always good
Timing is better
Faster
Better quality
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
- OnInvalidate()
Res. expertise
Res. avail.
Refresh ONLY what was asked
* Not always good
Timing is better
Faster
Better quality
No waiting
With a little help from my libs by Royi Benyossef (+royiby)
Benefits
- OnInvalidate()
Res. expertise
Res. avail.
Refresh ONLY what was asked
* Not always good
Timing is better
Faster
Better quality
No waiting (OK, less waiting)
Conclusion?
Accelerate all
the things?!?
Impediments
When could it hurt you?
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
API avail.
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
API avail. API < 11 N/A
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
API avail. API < 11 N/A
API >= 11 (3.x) Available, off
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
API avail. API < 11 N/A
API >= 11 (3.x) Available, off
API >= 14(4.x) Available, on
G(PU)-force by Royi Benyossef (+royiby)
There’s a
disable API!
If it’s so
good?
W
hy
isn’t it
alw
ays on?
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
Impediments
Increased RAM usage
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
Impediments
Increased RAM usage
Not all op.s are supported
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
Impediments
Increased RAM usage
Not all op.s are supported
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
Impediments
Increased RAM usage
Not all op.s are supported
Possible sick strange things!
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
- Impediments
Examples
Possible sick strange things:
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
- Impediments
Examples
Invisible UI elements
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
- Impediments
Examples
Badly rendered pixels
With a little help from my libs by Royi Benyossef (+royiby)
Impediments
- API avail.
- Impediments
Examples
Possible sick strange things:
> Invisible UI elements
> Badly rendered pixels
> Exceptions
Is no one
safe?
Analyzing
Know when you have a problem.
With a little help from my libs by Royi Benyossef (+royiby)
Safe!
(As in when are you...)
With a little help from my libs by Royi Benyossef (+royiby)
When is it safe?
When using only standard views
With a little help from my libs by Royi Benyossef (+royiby)
When is it safe?
- When using only standard views
When Min API level >= 17
What if that means nomore custom views?!?!
B* please!
So…?What to do?
With a little help from my libs by Royi Benyossef (+royiby)
Check, test & verify
(Oh my!)
With a little help from my libs by Royi Benyossef (+royiby)
Check, test & verify
Check
With a little help from my libs by Royi Benyossef (+royiby)
Check DAC/guide/topics/graphics/hardware-accel.
html#drawing-support
Check, test & verify
With a little help from my libs by Royi Benyossef (+royiby)
Check, test & verify
- Check
Test
With a little help from my libs by Royi Benyossef (+royiby)
Check, test & verify
- Check
Test All the
devices!!!
With a little help from my libs by Royi Benyossef (+royiby)
- Check
Test
All the devices
Systrace
Check, test & verify
With a little help from my libs by Royi Benyossef (+royiby)
- Check
Test
All the devices
Systrace
Dumpsys gfxinfo
Check, test & verify
With a little help from my libs by Royi Benyossef (+royiby)
- Check
Test
All the devices
Systrace
Dumpsys gfxinfo
*Tracer
Check, test & verify
With a little help from my libs by Royi Benyossef (+royiby)
- Check
Test
** Ran Nachmany’s great session
https://www.youtube.com/watch?
v=aEFxqdPgHJk
Check, test & verify
And...
If bugs were found:And...
Troubleshooting
Making the best of every situation
With a little help from my libs by Royi Benyossef (+royiby)
Reduce, reuse, recycle
(Things you need less of)
With a little help from my libs by Royi Benyossef (+royiby)
Reduce, reuse, recycle
No. of views
With a little help from my libs by Royi Benyossef (+royiby)
No. of views
Reduce, reuse, recycle
Less views
With a little help from my libs by Royi Benyossef (+royiby)
No. of views
Reduce, reuse, recycle
Less views
Smaller display lists
With a little help from my libs by Royi Benyossef (+royiby)
No. of views
Reduce, reuse, recycle
Less views
Smaller display lists
Less to draw
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Test:
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Test:
> Developer options
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Test:
Developer options
> Down. hierarchyViewer
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Test:
Developer options
Down. hierarchyViewer
(Screen layers)
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Fix:
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Fix:
> Merge/remove layers
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Never draw more than x2 the
no. of pixels
Fix:
Merge/remove layers
> Crop unseen pixels
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Tip:
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
Overdraw
Reduce, reuse, recycle
Tip:
Transparent pixels in
bitmaps count!
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
Objects in rendering func.
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
Objects in rendering func.
Cause GC (very expensive)
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
Objects in rendering func.
Cause GC (very expensive)
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
Objects in rendering func.
Cause GC (very expensive)
Examples:
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
Objects in rendering func.
Cause GC (very expensive)
Examples:
> Paint
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
New
Reduce, reuse, recycle
Objects in rendering func.
Cause GC (very expensive)
Examples:
Paint
>Path
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
- New
Modifications
Reduce, reuse, recycle
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
- New
Modifications
Reduce, reuse, recycle
Shape/Circle/Path create a
new text. when altered
With a little help from my libs by Royi Benyossef (+royiby)
- No. of views
- Overdraw
- New
Modifications
Reduce, reuse, recycle
Shape/Circle/Path create a
new text. when altered
Bitmaps are reloaded when
altered (to the GPU)
With a little help from my libs by Royi Benyossef (+royiby)
Use. Differently.
(Pro-tips for better usage)
With a little help from my libs by Royi Benyossef (+royiby)
Alpha anim.
Use. Differently.
With a little help from my libs by Royi Benyossef (+royiby)
Alpha anim.
Use. Differently.
Created in an off-screen
buffer
With a little help from my libs by Royi Benyossef (+royiby)
Alpha anim.
Use. Differently.
Created in an off-screen
buffer
Should be dealt in a hardware
layer type
With a little help from my libs by Royi Benyossef (+royiby)
- Alpha animation
Custom view
Use. Differently.
With a little help from my libs by Royi Benyossef (+royiby)
- Alpha animation
Custom view
Use. Differently.
private class PieView extends View {
public PieView(Context context) {
super(context);
if (!isInEditMode()) {
setLayerType(
View.
LAYER_TYPE_HARDWARE,
null);}}}
With a little help from my libs by Royi Benyossef (+royiby)
Set the scope
(One size does not fit all)
With a little help from my libs by Royi Benyossef (+royiby)
Application
Set the scope
<application android:hardwareAccelerated="true"
…
>
With a little help from my libs by Royi Benyossef (+royiby)
- Application
Activity
<application android:hardwareAccelerated="true">
<activity
android:hardwareAccelerated="false"
/>
</application>
Set the scope
With a little help from my libs by Royi Benyossef (+royiby)
- Application
- Activity
Window
Set the scope
getWindow().setFlags(
WindowManager.LayoutParams
.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams
.FLAG_HARDWARE_ACCELERATED
);
With a little help from my libs by Royi Benyossef (+royiby)
- Application
- Activity
Window
Set the scope
getWindow().setFlags(
WindowManager.LayoutParams
.FLAG_HARDWARE_ACCELERATED,
WindowManager.LayoutParams
.FLAG_HARDWARE_ACCELERATED
);
Note: You currently cannot disable
hardware acceleration at the window level.
With a little help from my libs by Royi Benyossef (+royiby)
- Application
- Activity
- Window
View&layer
Set the scope
myView.setLayerType(
View.LAYER_TYPE_SOFTWARE, null
);
With a little help from my libs by Royi Benyossef (+royiby)
- Application
- Activity
- Window
View&layer
Set the scope
myView.setLayerType(
View.LAYER_TYPE_SOFTWARE, null
);
Note:You currently cannot enable hardware
acceleration at the view level. View layers
have other functions besides disabling
hardware acceleration. See View layers for
more information about their uses.
With a little help from my libs by Royi Benyossef (+royiby)
Layer up
(All layers are NOT created equal)
With a little help from my libs by Royi Benyossef (+royiby)
None
Layer up
LAYER_TYPE_NONE
With a little help from my libs by Royi Benyossef (+royiby)
None
Layer up
LAYER_TYPE_NONE
not backed by any off screen buffer,
rendered in the SW model.
With a little help from my libs by Royi Benyossef (+royiby)
- None
Hardware
Layer up
LAYER_TYPE_HARDWARE
With a little help from my libs by Royi Benyossef (+royiby)
- None
Hardware
Layer up
LAYER_TYPE_HARDWARE
if HW accel. is on, layer is backed by HW
texture buffer and rendered in the HW
model, else it is the same as in the case of
LAYER_TYPE_SOFTWARE.
With a little help from my libs by Royi Benyossef (+royiby)
- None
Hardware
Layer up
Best for performance
With a little help from my libs by Royi Benyossef (+royiby)
- None
Hardware
Layer up
Best for performance:
> V-sync
With a little help from my libs by Royi Benyossef (+royiby)
- None
Hardware
Layer up
Best for performance:
V-sync
> Anim. added to the hardware
texture w/o redrawing.
With a little help from my libs by Royi Benyossef (+royiby)
- None
-Hardware
Software
Layer up
LAYER_TYPE_SOFTWARE - backed by a
Bitmap as if it was a buffer, rendered in the
SW model.
With a little help from my libs by Royi Benyossef (+royiby)
- None
-Hardware
Software
Layer up
Best for compatibility
With a little help from my libs by Royi Benyossef (+royiby)
- None
-Hardware
Software
Layer up
Best for compatibility:
> Min API < 11
With a little help from my libs by Royi Benyossef (+royiby)
- None
-Hardware
Software
Layer up
Best for compatibility:
Min API < 11
> Fixes different behaviour on
different devices (GPUs)
With a little help from my libs by Royi Benyossef (+royiby)
Be informed
(Which getter can’t be trusted)
With a little help from my libs by Royi Benyossef (+royiby)
View.isHardwareAccelerated()
Be informed
With a little help from my libs by Royi Benyossef (+royiby)
- View.isHardwareAccelerated()
Canvas.isHardwareAccelerated()
Be informed
With a little help from my libs by Royi Benyossef (+royiby)
- View.isHardwareAccelerated()
- Canvas.isHardwareAccelerated()
Be informed
With a little help from my libs by Royi Benyossef (+royiby)
- View.isHardwareAccelerated()
- Canvas.isHardwareAccelerated()
Be informed
With a little help from my libs by Royi Benyossef (+royiby)
- View.isHardwareAccelerated()
- Canvas.isHardwareAccelerated()
A view attached to a hardware accel. window can still be
drawn in the SW model
Be informed
With a little help from my libs by Royi Benyossef (+royiby)
- View.isHardwareAccelerated()
- Canvas.isHardwareAccelerated()
A view attached to a hardware accel. window can still be
drawn in the SW model (like when it’s drawn to a bitmap
for caching).
Be informed
With a little help from my libs by Royi Benyossef (+royiby)
Summary
(What did we have here?)
With a little help from my libs by Royi Benyossef (+royiby)
Generally
Summery
With a little help from my libs by Royi Benyossef (+royiby)
Generally
Summery
HW accel is good but it has
issues
With a little help from my libs by Royi Benyossef (+royiby)
- Generally
GPUs
Summery
Are not created equally
With a little help from my libs by Royi Benyossef (+royiby)
- Generally
- GPUs
Less is more
Summery
Take only what you need
With a little help from my libs by Royi Benyossef (+royiby)
- Generally
- GPUs
Less is more
Summery
Take only what you need
Reduce, reuse, recycle
With a little help from my libs by Royi Benyossef (+royiby)
- Generally
- GPUs
- Less is more
Analyze&adapt
Summery
Wait for it...
With a little help from my libs by Royi Benyossef (+royiby)
- Generally
- GPUs
- Less is more
Analyze&adapt
Summery
ALWAYS!
“We should be building great
things. Things that Don’t yet
exist”
I Hope You Liked It
Thank you for listening
By Royi Benyossef (+royiby)

More Related Content

Recently uploaded

哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...wyqazy
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPsychicRuben LoveSpells
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceanilsa9823
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Pooja Nehwal
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceanilsa9823
 
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Niamh verma
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceDelhi Call girls
 
9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7Pooja Nehwal
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRnishacall1
 

Recently uploaded (9)

哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
哪里有卖的《俄亥俄大学学历证书+俄亥俄大学文凭证书+俄亥俄大学学位证书》Q微信741003700《俄亥俄大学学位证书复制》办理俄亥俄大学毕业证成绩单|购买...
 
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost LoverPowerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
Powerful Love Spells in Arkansas, AR (310) 882-6330 Bring Back Lost Lover
 
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual serviceCALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
CALL ON ➥8923113531 🔝Call Girls Saharaganj Lucknow best sexual service
 
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
Call US Pooja 9892124323 ✓Call Girls In Mira Road ( Mumbai ) secure service,
 
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun serviceCALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
CALL ON ➥8923113531 🔝Call Girls Gomti Nagar Lucknow best Night Fun service
 
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
Chandigarh Call Girls Service ❤️🍑 9115573837 👄🫦Independent Escort Service Cha...
 
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort ServiceBDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
BDSM⚡Call Girls in Sector 71 Noida Escorts >༒8448380779 Escort Service
 
9892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x79892124323 | Book Call Girls in Juhu and escort services 24x7
9892124323 | Book Call Girls in Juhu and escort services 24x7
 
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Learn to accel(erate)

  • 1. G(PU) force Hardware acceleration By Royi Benyossef (+royiby)
  • 2. G(PU)-force by Royi Benyossef (+royiby) Android developer since 2009. GDG Herzliya co-founder. Android speaker and lecturer. Android Mentor for Google Launchpad. Android GDE 2013, 2014, 2015. Android group leader at Vidmind. Royi Benyossef
  • 4. G(PU)-force by Royi Benyossef (+royiby) Motivation
  • 5. With a little help from my libs by Royi Benyossef (+royiby) Motivation Great UX
  • 6. With a little help from my libs by Royi Benyossef (+royiby) Motivation Great UX Sleek transitions
  • 7. With a little help from my libs by Royi Benyossef (+royiby) Motivation Great UX Sleek transitions Smooth animations
  • 8. G(PU)-force by Royi Benyossef (+royiby) HOW?
  • 9. G(PU)-force by Royi Benyossef (+royiby) Hardware accelerationHOW?
  • 10. Prolog What is hardware acceleration?
  • 11. With a little help from my libs by Royi Benyossef (+royiby) Prolog Definition
  • 12. With a little help from my libs by Royi Benyossef (+royiby) Prolog Definition Graphics rendered by the GPU
  • 13. With a little help from my libs by Royi Benyossef (+royiby) Prolog - Definition In Android Graphics rendered by the GPU
  • 14. With a little help from my libs by Royi Benyossef (+royiby) Prolog - Definition In Android Graphics rendered by the GPU Canvas drawn by the GPU
  • 15. With a little help from my libs by Royi Benyossef (+royiby) Prolog - Definition In Android Graphics rendered by the GPU Canvas drawn by the GPU (= HW drawing model)
  • 16. With a little help from my libs by Royi Benyossef (+royiby) Prolog - Definition In Android Graphics rendered by the GPU Canvas drawn by the GPU (= HW drawing model) NOT Canvas drawn by the CPU
  • 17. With a little help from my libs by Royi Benyossef (+royiby) Prolog - Definition In Android Graphics rendered by the GPU Canvas drawn by the GPU (= HW drawing model) NOT Canvas drawn by the CPU (!= SW drawing model)
  • 19. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models (Let me dig deeper… please)
  • 20. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models SW model
  • 21. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models SW model Invalidate hierarchy
  • 22. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models SW model Invalidate hierarchy Draw hierarchy
  • 23. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models - SW model HW model Invalidate hierarchy Draw hierarchy
  • 24. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models - SW model HW model Invalidate hierarchy Draw hierarchy Invalidate hierarchy
  • 25. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models - SW model HW model Invalidate hierarchy Draw hierarchy Invalidate hierarchy Record & update display lists
  • 26. With a little help from my libs by Royi Benyossef (+royiby) Android drawing models - SW model HW model Invalidate hierarchy Draw hierarchy Invalidate hierarchy Record & update display lists Draw hierarchy
  • 27. Not sure ifstupid... Or didn’tmake hispoint yet...
  • 28. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() (How it differs between the SW and HW models) (P.S. also point #1)
  • 29. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() SW model
  • 30. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() SW model Calling item is redrawn
  • 31. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() SW model Calling item is redrawn All affiliated items are redrawn
  • 32. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() SW model Calling item is redrawn All affiliated items are redrawn * Executed immediately
  • 33. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() - SW model HW model
  • 34. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() - SW model HW model Calling item is saved to the display list
  • 35. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() - SW model HW model Calling item is saved to the display list Display list is updated
  • 36. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() - SW model HW model Calling item is saved to the display list Display list is updated Diff is drawn
  • 37. With a little help from my libs by Royi Benyossef (+royiby) OnInvalidate() - SW model HW model Calling item is saved to the display list Display list is updated Diff is drawn * Executed on V-sync
  • 38. With a little help from my libs by Royi Benyossef (+royiby) Resources (Expertise & availability) (P.S. also points #2 & #3)
  • 39. With a little help from my libs by Royi Benyossef (+royiby) Resources Expertise
  • 40. With a little help from my libs by Royi Benyossef (+royiby) Resources Expertise Specifically designed HW&SW
  • 41. With a little help from my libs by Royi Benyossef (+royiby) Resources - Expertise Availability
  • 42. With a little help from my libs by Royi Benyossef (+royiby) Resources - Expertise Availability Separate resource repo
  • 44. With a little help from my libs by Royi Benyossef (+royiby) Benefits OnInvalidate()
  • 45. With a little help from my libs by Royi Benyossef (+royiby) Benefits OnInvalidate() Refresh ONLY what was asked
  • 46. With a little help from my libs by Royi Benyossef (+royiby) Benefits OnInvalidate() Refresh ONLY what was asked * Not always good
  • 47. With a little help from my libs by Royi Benyossef (+royiby) Benefits OnInvalidate() Refresh ONLY what was asked * Not always good Timing is better
  • 48. With a little help from my libs by Royi Benyossef (+royiby) Benefits - OnInvalidate() Res. expertise Refresh ONLY what was asked * Not always good Timing is better
  • 49. With a little help from my libs by Royi Benyossef (+royiby) Benefits - OnInvalidate() Res. expertise Refresh ONLY what was asked * Not always good Timing is better Faster
  • 50. With a little help from my libs by Royi Benyossef (+royiby) Benefits - OnInvalidate() Res. expertise Refresh ONLY what was asked * Not always good Timing is better Faster Better quality
  • 51. With a little help from my libs by Royi Benyossef (+royiby) Benefits - OnInvalidate() - Res. expertise Res. avail. Refresh ONLY what was asked * Not always good Timing is better Faster Better quality
  • 52. With a little help from my libs by Royi Benyossef (+royiby) Benefits - OnInvalidate() Res. expertise Res. avail. Refresh ONLY what was asked * Not always good Timing is better Faster Better quality No waiting
  • 53. With a little help from my libs by Royi Benyossef (+royiby) Benefits - OnInvalidate() Res. expertise Res. avail. Refresh ONLY what was asked * Not always good Timing is better Faster Better quality No waiting (OK, less waiting)
  • 56.
  • 58. With a little help from my libs by Royi Benyossef (+royiby) Impediments API avail.
  • 59. With a little help from my libs by Royi Benyossef (+royiby) Impediments API avail. API < 11 N/A
  • 60. With a little help from my libs by Royi Benyossef (+royiby) Impediments API avail. API < 11 N/A API >= 11 (3.x) Available, off
  • 61. With a little help from my libs by Royi Benyossef (+royiby) Impediments API avail. API < 11 N/A API >= 11 (3.x) Available, off API >= 14(4.x) Available, on
  • 62. G(PU)-force by Royi Benyossef (+royiby) There’s a disable API!
  • 64. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. Impediments Increased RAM usage
  • 65. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. Impediments Increased RAM usage Not all op.s are supported
  • 66. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. Impediments Increased RAM usage Not all op.s are supported
  • 67. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. Impediments Increased RAM usage Not all op.s are supported Possible sick strange things!
  • 68. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. - Impediments Examples Possible sick strange things:
  • 69. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. - Impediments Examples Invisible UI elements
  • 70. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. - Impediments Examples Badly rendered pixels
  • 71. With a little help from my libs by Royi Benyossef (+royiby) Impediments - API avail. - Impediments Examples Possible sick strange things: > Invisible UI elements > Badly rendered pixels > Exceptions
  • 73.
  • 74. Analyzing Know when you have a problem.
  • 75. With a little help from my libs by Royi Benyossef (+royiby) Safe! (As in when are you...)
  • 76. With a little help from my libs by Royi Benyossef (+royiby) When is it safe? When using only standard views
  • 77. With a little help from my libs by Royi Benyossef (+royiby) When is it safe? - When using only standard views When Min API level >= 17
  • 78. What if that means nomore custom views?!?!
  • 81. With a little help from my libs by Royi Benyossef (+royiby) Check, test & verify (Oh my!)
  • 82. With a little help from my libs by Royi Benyossef (+royiby) Check, test & verify Check
  • 83. With a little help from my libs by Royi Benyossef (+royiby) Check DAC/guide/topics/graphics/hardware-accel. html#drawing-support Check, test & verify
  • 84. With a little help from my libs by Royi Benyossef (+royiby) Check, test & verify - Check Test
  • 85. With a little help from my libs by Royi Benyossef (+royiby) Check, test & verify - Check Test All the devices!!!
  • 86. With a little help from my libs by Royi Benyossef (+royiby) - Check Test All the devices Systrace Check, test & verify
  • 87. With a little help from my libs by Royi Benyossef (+royiby) - Check Test All the devices Systrace Dumpsys gfxinfo Check, test & verify
  • 88. With a little help from my libs by Royi Benyossef (+royiby) - Check Test All the devices Systrace Dumpsys gfxinfo *Tracer Check, test & verify
  • 89. With a little help from my libs by Royi Benyossef (+royiby) - Check Test ** Ran Nachmany’s great session https://www.youtube.com/watch? v=aEFxqdPgHJk Check, test & verify
  • 91. If bugs were found:And...
  • 92. Troubleshooting Making the best of every situation
  • 93. With a little help from my libs by Royi Benyossef (+royiby) Reduce, reuse, recycle (Things you need less of)
  • 94. With a little help from my libs by Royi Benyossef (+royiby) Reduce, reuse, recycle No. of views
  • 95. With a little help from my libs by Royi Benyossef (+royiby) No. of views Reduce, reuse, recycle Less views
  • 96. With a little help from my libs by Royi Benyossef (+royiby) No. of views Reduce, reuse, recycle Less views Smaller display lists
  • 97. With a little help from my libs by Royi Benyossef (+royiby) No. of views Reduce, reuse, recycle Less views Smaller display lists Less to draw
  • 98. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle
  • 99. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels
  • 100. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Test:
  • 101. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Test: > Developer options
  • 102. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Test: Developer options > Down. hierarchyViewer
  • 103. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Test: Developer options Down. hierarchyViewer (Screen layers)
  • 104. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Fix:
  • 105. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Fix: > Merge/remove layers
  • 106. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Never draw more than x2 the no. of pixels Fix: Merge/remove layers > Crop unseen pixels
  • 107. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Tip:
  • 108. With a little help from my libs by Royi Benyossef (+royiby) - No. of views Overdraw Reduce, reuse, recycle Tip: Transparent pixels in bitmaps count!
  • 109. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle
  • 110. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle Objects in rendering func.
  • 111. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle Objects in rendering func. Cause GC (very expensive)
  • 112. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle Objects in rendering func. Cause GC (very expensive)
  • 113. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle Objects in rendering func. Cause GC (very expensive) Examples:
  • 114. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle Objects in rendering func. Cause GC (very expensive) Examples: > Paint
  • 115. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw New Reduce, reuse, recycle Objects in rendering func. Cause GC (very expensive) Examples: Paint >Path
  • 116. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw - New Modifications Reduce, reuse, recycle
  • 117. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw - New Modifications Reduce, reuse, recycle Shape/Circle/Path create a new text. when altered
  • 118. With a little help from my libs by Royi Benyossef (+royiby) - No. of views - Overdraw - New Modifications Reduce, reuse, recycle Shape/Circle/Path create a new text. when altered Bitmaps are reloaded when altered (to the GPU)
  • 119. With a little help from my libs by Royi Benyossef (+royiby) Use. Differently. (Pro-tips for better usage)
  • 120. With a little help from my libs by Royi Benyossef (+royiby) Alpha anim. Use. Differently.
  • 121. With a little help from my libs by Royi Benyossef (+royiby) Alpha anim. Use. Differently. Created in an off-screen buffer
  • 122. With a little help from my libs by Royi Benyossef (+royiby) Alpha anim. Use. Differently. Created in an off-screen buffer Should be dealt in a hardware layer type
  • 123. With a little help from my libs by Royi Benyossef (+royiby) - Alpha animation Custom view Use. Differently.
  • 124. With a little help from my libs by Royi Benyossef (+royiby) - Alpha animation Custom view Use. Differently. private class PieView extends View { public PieView(Context context) { super(context); if (!isInEditMode()) { setLayerType( View. LAYER_TYPE_HARDWARE, null);}}}
  • 125. With a little help from my libs by Royi Benyossef (+royiby) Set the scope (One size does not fit all)
  • 126. With a little help from my libs by Royi Benyossef (+royiby) Application Set the scope <application android:hardwareAccelerated="true" … >
  • 127. With a little help from my libs by Royi Benyossef (+royiby) - Application Activity <application android:hardwareAccelerated="true"> <activity android:hardwareAccelerated="false" /> </application> Set the scope
  • 128. With a little help from my libs by Royi Benyossef (+royiby) - Application - Activity Window Set the scope getWindow().setFlags( WindowManager.LayoutParams .FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams .FLAG_HARDWARE_ACCELERATED );
  • 129. With a little help from my libs by Royi Benyossef (+royiby) - Application - Activity Window Set the scope getWindow().setFlags( WindowManager.LayoutParams .FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams .FLAG_HARDWARE_ACCELERATED ); Note: You currently cannot disable hardware acceleration at the window level.
  • 130. With a little help from my libs by Royi Benyossef (+royiby) - Application - Activity - Window View&layer Set the scope myView.setLayerType( View.LAYER_TYPE_SOFTWARE, null );
  • 131. With a little help from my libs by Royi Benyossef (+royiby) - Application - Activity - Window View&layer Set the scope myView.setLayerType( View.LAYER_TYPE_SOFTWARE, null ); Note:You currently cannot enable hardware acceleration at the view level. View layers have other functions besides disabling hardware acceleration. See View layers for more information about their uses.
  • 132. With a little help from my libs by Royi Benyossef (+royiby) Layer up (All layers are NOT created equal)
  • 133. With a little help from my libs by Royi Benyossef (+royiby) None Layer up LAYER_TYPE_NONE
  • 134. With a little help from my libs by Royi Benyossef (+royiby) None Layer up LAYER_TYPE_NONE not backed by any off screen buffer, rendered in the SW model.
  • 135. With a little help from my libs by Royi Benyossef (+royiby) - None Hardware Layer up LAYER_TYPE_HARDWARE
  • 136. With a little help from my libs by Royi Benyossef (+royiby) - None Hardware Layer up LAYER_TYPE_HARDWARE if HW accel. is on, layer is backed by HW texture buffer and rendered in the HW model, else it is the same as in the case of LAYER_TYPE_SOFTWARE.
  • 137. With a little help from my libs by Royi Benyossef (+royiby) - None Hardware Layer up Best for performance
  • 138. With a little help from my libs by Royi Benyossef (+royiby) - None Hardware Layer up Best for performance: > V-sync
  • 139. With a little help from my libs by Royi Benyossef (+royiby) - None Hardware Layer up Best for performance: V-sync > Anim. added to the hardware texture w/o redrawing.
  • 140. With a little help from my libs by Royi Benyossef (+royiby) - None -Hardware Software Layer up LAYER_TYPE_SOFTWARE - backed by a Bitmap as if it was a buffer, rendered in the SW model.
  • 141. With a little help from my libs by Royi Benyossef (+royiby) - None -Hardware Software Layer up Best for compatibility
  • 142. With a little help from my libs by Royi Benyossef (+royiby) - None -Hardware Software Layer up Best for compatibility: > Min API < 11
  • 143. With a little help from my libs by Royi Benyossef (+royiby) - None -Hardware Software Layer up Best for compatibility: Min API < 11 > Fixes different behaviour on different devices (GPUs)
  • 144. With a little help from my libs by Royi Benyossef (+royiby) Be informed (Which getter can’t be trusted)
  • 145. With a little help from my libs by Royi Benyossef (+royiby) View.isHardwareAccelerated() Be informed
  • 146. With a little help from my libs by Royi Benyossef (+royiby) - View.isHardwareAccelerated() Canvas.isHardwareAccelerated() Be informed
  • 147. With a little help from my libs by Royi Benyossef (+royiby) - View.isHardwareAccelerated() - Canvas.isHardwareAccelerated() Be informed
  • 148. With a little help from my libs by Royi Benyossef (+royiby) - View.isHardwareAccelerated() - Canvas.isHardwareAccelerated() Be informed
  • 149. With a little help from my libs by Royi Benyossef (+royiby) - View.isHardwareAccelerated() - Canvas.isHardwareAccelerated() A view attached to a hardware accel. window can still be drawn in the SW model Be informed
  • 150. With a little help from my libs by Royi Benyossef (+royiby) - View.isHardwareAccelerated() - Canvas.isHardwareAccelerated() A view attached to a hardware accel. window can still be drawn in the SW model (like when it’s drawn to a bitmap for caching). Be informed
  • 151. With a little help from my libs by Royi Benyossef (+royiby) Summary (What did we have here?)
  • 152. With a little help from my libs by Royi Benyossef (+royiby) Generally Summery
  • 153. With a little help from my libs by Royi Benyossef (+royiby) Generally Summery HW accel is good but it has issues
  • 154. With a little help from my libs by Royi Benyossef (+royiby) - Generally GPUs Summery Are not created equally
  • 155. With a little help from my libs by Royi Benyossef (+royiby) - Generally - GPUs Less is more Summery Take only what you need
  • 156. With a little help from my libs by Royi Benyossef (+royiby) - Generally - GPUs Less is more Summery Take only what you need Reduce, reuse, recycle
  • 157. With a little help from my libs by Royi Benyossef (+royiby) - Generally - GPUs - Less is more Analyze&adapt Summery Wait for it...
  • 158. With a little help from my libs by Royi Benyossef (+royiby) - Generally - GPUs - Less is more Analyze&adapt Summery ALWAYS!
  • 159. “We should be building great things. Things that Don’t yet exist”
  • 160. I Hope You Liked It Thank you for listening By Royi Benyossef (+royiby)