summaryrefslogtreecommitdiff
path: root/graphics/java
diff options
context:
space:
mode:
authorVishnu Nair <vishnun@google.com>2021-07-30 16:07:47 -0700
committerVishnu Nair <vishnun@google.com>2021-07-30 16:18:21 -0700
commitf13eac9f7e0231f3cfe52dafd4bb3e96893e9f9c (patch)
tree3511b932007305097ace3e42c600f4d4d9c24bdb /graphics/java
parent95e50fed2068dbdcc0d68a58033d83f6f120e71b (diff)
SurfaceView: Synchronize destframe updates with SurfaceView size changes
This CL fixes one of the issues with SurfaceView parent frame and content syncing. With BLAST, we have two surface controls each setting a scale. The parent surface control sets a scale based on the requested surface size and the SurfaceView layout size. The BlastBufferQueue surface control scales the buffer to the requested buffer size if the buffer has the appropriate scale mode. The destination frame controls the second scaling and it must be applied with the parent surface scale changes. This cl fixes flickers where the requested fixed surface size changes without any view size changes. This cl allows the caller to pass in a transaction to BLASTBufferQueue#update which is updated with the destination frame changes. This transaction can then be applied with the parent surface changes. This also fixes an issue where destination Frame was being set on every buffer update and when we updated the BlastBufferQueue size. Since buffer transactions can be queued up on the server side, a stale value maybe applied for a few frames causing flickers. Fixes: 194458377 Test: bug repro steps Test: atest SurfaceViewSyncTest#testSurfaceViewSetFixedSize Change-Id: I118bd1c3942b389e3951c3fd7389403895fc7b31
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/BLASTBufferQueue.java10
1 files changed, 8 insertions, 2 deletions
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);
}
/**