summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/ViewRootImpl.java
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-05-19 15:00:13 -0700
committerJohn Reck <jreck@google.com>2015-05-19 15:00:13 -0700
commit63005e6e5b1ee6d32a217ce8b4d8f0d13987fc39 (patch)
tree9dda4d7d6503ef7735debe7ca19816549e2faea8 /core/java/android/view/ViewRootImpl.java
parent95ba62f8d0e753bc7905b915d0b2b510d09c320c (diff)
downloadframeworks_base-63005e6e5b1ee6d32a217ce8b4d8f0d13987fc39.zip
frameworks_base-63005e6e5b1ee6d32a217ce8b4d8f0d13987fc39.tar.gz
frameworks_base-63005e6e5b1ee6d32a217ce8b4d8f0d13987fc39.tar.bz2
Reduce wasted buffer allocations
Bug: 20170924 Don't pre-allocate buffers if there is a SurfaceView or other View that has requested transparent regions. This doesn't fully address the problem of allocating buffers when there's a full screen SurfaceView but it at least gets back to KitKat levels of only having 1 wasted buffer instead of 3 (the 1 being a result of the fact that it will still draw one frame of emptiness forcing a buffer dequeue). Change-Id: Ied9553186bc7b111d180b63f87b92bd317cb4b97
Diffstat (limited to 'core/java/android/view/ViewRootImpl.java')
-rw-r--r--core/java/android/view/ViewRootImpl.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index b7d902c..39818d9 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1708,10 +1708,19 @@ public final class ViewRootImpl implements ViewParent,
mFullRedrawNeeded = true;
mPreviousTransparentRegion.setEmpty();
+ // Only initialize up-front if transparent regions are not
+ // requested, otherwise defer to see if the entire window
+ // will be transparent
if (mAttachInfo.mHardwareRenderer != null) {
try {
hwInitialized = mAttachInfo.mHardwareRenderer.initialize(
mSurface);
+ if (hwInitialized && (host.mPrivateFlags
+ & View.PFLAG_REQUEST_TRANSPARENT_REGIONS) == 0) {
+ // Don't pre-allocate if transparent regions
+ // are requested as they may not be needed
+ mSurface.allocateBuffers();
+ }
} catch (OutOfResourcesException e) {
handleOutOfResourcesException(e);
return;