diff options
| author | 2021-12-06 16:45:54 -0800 | |
|---|---|---|
| committer | 2021-12-14 19:34:02 +0000 | |
| commit | fce5b2becedb011d85650ab7aae71669b6863732 (patch) | |
| tree | 391cf7a41471c03af0d747be68032f6b333f0ed8 /graphics/java | |
| parent | e805f2b12fd63d8838a07009593d679d155d1152 (diff) | |
SurfaceView: Synchronize initial destframe change from BBQ
Fixes a case where the SurfaceView is stuck with a wrong
scale.
Destination frame scales the buffer to the SurfaceView
fixed size. Currently the initial destination frame is
applied when the first buffer is acquired by BBQ. The
transaction is sent via the BBQ apply token.
Meanwhile if the client updates the SurfaceView fixed
size, the SurfaceView will apply the transaction via
the SCC apply token.
This can cause destframe changes to be applied out of
order causing the app to be stuck with the wrong
scale.
Bug: 195443440
Test: atest BLASTBufferQueueTest
Test: repro steps from bug
Change-Id: Ibf53a0efdebb87291d081e48633c373a98d347b1
Merged-In: Ibf53a0efdebb87291d081e48633c373a98d347b1
Diffstat (limited to 'graphics/java')
| -rw-r--r-- | graphics/java/android/graphics/BLASTBufferQueue.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/BLASTBufferQueue.java b/graphics/java/android/graphics/BLASTBufferQueue.java index 2393eaf32e9a..2faa532a241d 100644 --- a/graphics/java/android/graphics/BLASTBufferQueue.java +++ b/graphics/java/android/graphics/BLASTBufferQueue.java @@ -27,8 +27,9 @@ public final class BLASTBufferQueue { // Note: This field is accessed by native code. public long mNativeObject; // BLASTBufferQueue* - private static native long nativeCreate(String name, long surfaceControl, long width, + private static native long nativeCreateAndUpdate(String name, long surfaceControl, long width, long height, int format); + private static native long nativeCreate(String name); private static native void nativeDestroy(long ptr); private static native Surface nativeGetSurface(long ptr, boolean includeSurfaceControlHandle); private static native void nativeSetNextTransaction(long ptr, long transactionPtr); @@ -54,7 +55,11 @@ public final class BLASTBufferQueue { /** Create a new connection with the surface flinger. */ public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height, @PixelFormat.Format int format) { - mNativeObject = nativeCreate(name, sc.mNativeObject, width, height, format); + mNativeObject = nativeCreateAndUpdate(name, sc.mNativeObject, width, height, format); + } + + public BLASTBufferQueue(String name) { + mNativeObject = nativeCreate(name); } public void destroy() { |