summaryrefslogtreecommitdiff
path: root/graphics/java
diff options
context:
space:
mode:
author chaviw <chaviw@google.com> 2022-02-08 11:19:37 -0600
committer chaviw <chaviw@google.com> 2022-02-08 11:22:57 -0600
commite12e51892aee86b3ca4e7e268afed63006215010 (patch)
tree642d01326419679e5abef9daf991663b5aa7b157 /graphics/java
parent083297ec6b392920831da2d29f62c32ca3463f33 (diff)
Add gatherPendingTransactions in BBQ
Instead of applying the pending transactions when a frame wasn't rendered, we gather the transactions and merge them with the transaction that will be used to sync. This is to ensure these frames are sent to the caller that requested the sync so they can ensure it's applied at the correct time. Test: Builds and run Bug: 200284684 Change-Id: I087c67138f31cc93e79df42c29464ab4f7989d52
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/BLASTBufferQueue.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/BLASTBufferQueue.java b/graphics/java/android/graphics/BLASTBufferQueue.java
index a9e730d58e65..2678c79d1454 100644
--- a/graphics/java/android/graphics/BLASTBufferQueue.java
+++ b/graphics/java/android/graphics/BLASTBufferQueue.java
@@ -39,6 +39,8 @@ public final class BLASTBufferQueue {
private static native long nativeGetLastAcquiredFrameNum(long ptr);
private static native void nativeApplyPendingTransactions(long ptr, long frameNumber);
private static native boolean nativeIsSameSurfaceControl(long ptr, long surfaceControlPtr);
+ private static native SurfaceControl.Transaction nativeGatherPendingTransactions(long ptr,
+ long frameNumber);
/** Create a new connection with the surface flinger. */
public BLASTBufferQueue(String name, SurfaceControl sc, int width, int height,
@@ -159,4 +161,17 @@ public final class BLASTBufferQueue {
public boolean isSameSurfaceControl(SurfaceControl sc) {
return nativeIsSameSurfaceControl(mNativeObject, sc.mNativeObject);
}
+
+ /**
+ * Get any transactions that were passed to {@link #mergeWithNextTransaction} with the
+ * specified frameNumber. This is intended to ensure transactions don't get stuck as pending
+ * if the specified frameNumber is never drawn.
+ *
+ * @param frameNumber The frameNumber used to determine which transactions to apply.
+ * @return a Transaction that contains the merge of all the transactions that were sent to
+ * mergeWithNextTransaction
+ */
+ public SurfaceControl.Transaction gatherPendingTransactions(long frameNumber) {
+ return nativeGatherPendingTransactions(mNativeObject, frameNumber);
+ }
}