summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVishnu Nair <vishnun@google.com>2021-08-02 23:35:38 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2021-08-02 23:35:38 +0000
commit40ddf958e692bb9147ccafe96a62d993242b7623 (patch)
tree01db0a757f119ef2d25ad4d3836312866ef609c8
parent308cc9919e1dffde75723a1595aa1547e2295b95 (diff)
parentf13eac9f7e0231f3cfe52dafd4bb3e96893e9f9c (diff)
Merge "SurfaceView: Synchronize destframe updates with SurfaceView size changes" into sc-dev
-rw-r--r--core/java/android/view/SurfaceView.java2
-rw-r--r--core/jni/android_graphics_BLASTBufferQueue.cpp8
-rw-r--r--graphics/java/android/graphics/BLASTBufferQueue.java10
3 files changed, 14 insertions, 6 deletions
diff --git a/core/java/android/view/SurfaceView.java b/core/java/android/view/SurfaceView.java
index f21d855ddcf9..6c2d6a1c3f2e 100644
--- a/core/java/android/view/SurfaceView.java
+++ b/core/java/android/view/SurfaceView.java
@@ -1242,7 +1242,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
mBlastSurfaceControl.setTransformHint(mTransformHint);
if (mBlastBufferQueue != null) {
mBlastBufferQueue.update(mBlastSurfaceControl, mSurfaceWidth, mSurfaceHeight,
- mFormat);
+ mFormat, transaction);
}
} else {
transaction.setBufferSize(mSurfaceControl, mSurfaceWidth, mSurfaceHeight);
diff --git a/core/jni/android_graphics_BLASTBufferQueue.cpp b/core/jni/android_graphics_BLASTBufferQueue.cpp
index b46b5a23e3fb..d4ae6d769cf7 100644
--- a/core/jni/android_graphics_BLASTBufferQueue.cpp
+++ b/core/jni/android_graphics_BLASTBufferQueue.cpp
@@ -105,9 +105,11 @@ static void nativeSetNextTransaction(JNIEnv* env, jclass clazz, jlong ptr, jlong
}
static void nativeUpdate(JNIEnv* env, jclass clazz, jlong ptr, jlong surfaceControl, jlong width,
- jlong height, jint format) {
+ jlong height, jint format, jlong transactionPtr) {
sp<BLASTBufferQueue> queue = reinterpret_cast<BLASTBufferQueue*>(ptr);
- queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, format);
+ auto transaction = reinterpret_cast<SurfaceComposerClient::Transaction*>(transactionPtr);
+ queue->update(reinterpret_cast<SurfaceControl*>(surfaceControl), width, height, format,
+ transaction);
}
static void nativeFlushShadowQueue(JNIEnv* env, jclass clazz, jlong ptr) {
@@ -144,7 +146,7 @@ static const JNINativeMethod gMethods[] = {
{"nativeGetSurface", "(JZ)Landroid/view/Surface;", (void*)nativeGetSurface},
{"nativeDestroy", "(J)V", (void*)nativeDestroy},
{"nativeSetNextTransaction", "(JJ)V", (void*)nativeSetNextTransaction},
- {"nativeUpdate", "(JJJJI)V", (void*)nativeUpdate},
+ {"nativeUpdate", "(JJJJIJ)V", (void*)nativeUpdate},
{"nativeFlushShadowQueue", "(J)V", (void*)nativeFlushShadowQueue},
{"nativeMergeWithNextTransaction", "(JJJ)V", (void*)nativeMergeWithNextTransaction},
{"nativeSetTransactionCompleteCallback",
diff --git a/graphics/java/android/graphics/BLASTBufferQueue.java b/graphics/java/android/graphics/BLASTBufferQueue.java
index 6c1c2ee1ee57..36215ecc1403 100644
--- a/graphics/java/android/graphics/BLASTBufferQueue.java
+++ b/graphics/java/android/graphics/BLASTBufferQueue.java
@@ -33,7 +33,7 @@ public final class BLASTBufferQueue {
private static native Surface nativeGetSurface(long ptr, boolean includeSurfaceControlHandle);
private static native void nativeSetNextTransaction(long ptr, long transactionPtr);
private static native void nativeUpdate(long ptr, long surfaceControl, long width, long height,
- int format);
+ int format, long transactionPtr);
private static native void nativeFlushShadowQueue(long ptr);
private static native void nativeMergeWithNextTransaction(long ptr, long transactionPtr,
long frameNumber);
@@ -92,9 +92,15 @@ public final class BLASTBufferQueue {
* @param width The new width for the buffer.
* @param height The new height for the buffer.
* @param format The new format for the buffer.
+ * @param t Adds destination frame changes to the passed in transaction.
*/
+ public void update(SurfaceControl sc, int width, int height, @PixelFormat.Format int format,
+ SurfaceControl.Transaction t) {
+ nativeUpdate(mNativeObject, sc.mNativeObject, width, height, format, t.mNativeObject);
+ }
+
public void update(SurfaceControl sc, int width, int height, @PixelFormat.Format int format) {
- nativeUpdate(mNativeObject, sc.mNativeObject, width, height, format);
+ nativeUpdate(mNativeObject, sc.mNativeObject, width, height, format, 0);
}
/**