summaryrefslogtreecommitdiffstats
path: root/core/java/android/view/Surface.java
diff options
context:
space:
mode:
authorDan Stoza <stoza@google.com>2014-06-20 13:01:36 -0700
committerDan Stoza <stoza@google.com>2014-06-20 15:28:31 -0700
commit5795d6408d8bf44ffe2f49a25f9f333069b59a49 (patch)
tree169113cdb2df731cbe026b0e1c5e1dd02bf9fcd7 /core/java/android/view/Surface.java
parentc6543afd6b94671c99bd7a934da010918a015286 (diff)
downloadframeworks_base-5795d6408d8bf44ffe2f49a25f9f333069b59a49.zip
frameworks_base-5795d6408d8bf44ffe2f49a25f9f333069b59a49.tar.gz
frameworks_base-5795d6408d8bf44ffe2f49a25f9f333069b59a49.tar.bz2
Surface: Add allocateBuffers to avoid render delay
This plumbs up a new call on the native Surface object that allows the client to request that BufferQueue pre-allocate all of the buffers that it might need for rendering. This hopefully prevents allocation delays during dequeuing and reduces jank. Bug: 11792166 Change-Id: Ibeaa7475492d4ac2bcacb107ef60c6240081d8b7
Diffstat (limited to 'core/java/android/view/Surface.java')
-rw-r--r--core/java/android/view/Surface.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/java/android/view/Surface.java b/core/java/android/view/Surface.java
index fdaae01..78986d9 100644
--- a/core/java/android/view/Surface.java
+++ b/core/java/android/view/Surface.java
@@ -51,6 +51,8 @@ public class Surface implements Parcelable {
private static native long nativeReadFromParcel(long nativeObject, Parcel source);
private static native void nativeWriteToParcel(long nativeObject, Parcel dest);
+ private static native void nativeAllocateBuffers(long nativeObject);
+
public static final Parcelable.Creator<Surface> CREATOR =
new Parcelable.Creator<Surface>() {
@Override
@@ -420,6 +422,17 @@ public class Surface implements Parcelable {
}
/**
+ * Allocate buffers ahead of time to avoid allocation delays during rendering
+ * @hide
+ */
+ public void allocateBuffers() {
+ synchronized (mLock) {
+ checkNotReleasedLocked();
+ nativeAllocateBuffers(mNativeObject);
+ }
+ }
+
+ /**
* Exception thrown when a Canvas couldn't be locked with {@link Surface#lockCanvas}, or
* when a SurfaceTexture could not successfully be allocated.
*/