summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/java/android/view/ViewRootImpl.java15
-rw-r--r--graphics/java/android/graphics/BLASTBufferQueue.java10
2 files changed, 22 insertions, 3 deletions
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 9d24dff13175..ffb43b774199 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -3912,7 +3912,8 @@ public final class ViewRootImpl implements ViewParent,
return;
}
- final boolean fullRedrawNeeded = mFullRedrawNeeded || mReportNextDraw;
+ final boolean fullRedrawNeeded =
+ mFullRedrawNeeded || mReportNextDraw || mNextDrawUseBLASTSyncTransaction;
mFullRedrawNeeded = false;
mIsDrawing = true;
@@ -9921,6 +9922,18 @@ public final class ViewRootImpl implements ViewParent,
} else {
t.merge(mRtBLASTSyncTransaction);
}
+
+ // There's potential for the frame callback to get called even if nothing was drawn.
+ // When that occurs, we remove the transaction sent to BBQ since the draw we were
+ // waiting on will not happen. We can apply the transaction here but it will not contain
+ // a buffer since nothing new was drawn.
+ //
+ // This is mainly for the case when the SurfaceView has changed and wants to synchronize
+ // with the main window. If the main window doesn't need to draw anything, we can just
+ // apply the transaction without the new buffer from the main window.
+ if (mBlastBufferQueue != null) {
+ mBlastBufferQueue.setNextTransaction(null);
+ }
}
}
diff --git a/graphics/java/android/graphics/BLASTBufferQueue.java b/graphics/java/android/graphics/BLASTBufferQueue.java
index 94bfdc9dbad6..4309ab24cc22 100644
--- a/graphics/java/android/graphics/BLASTBufferQueue.java
+++ b/graphics/java/android/graphics/BLASTBufferQueue.java
@@ -16,6 +16,7 @@
package android.graphics;
+import android.annotation.Nullable;
import android.view.Surface;
import android.view.SurfaceControl;
@@ -60,8 +61,13 @@ public final class BLASTBufferQueue {
return nativeGetSurface(mNativeObject, true /* includeSurfaceControlHandle */);
}
- public void setNextTransaction(SurfaceControl.Transaction t) {
- nativeSetNextTransaction(mNativeObject, t.mNativeObject);
+ /**
+ * Send the transaction to BBQ so the next frame can be added and not applied immediately.
+ * This gives the caller a chance to apply the transaction when it's ready.
+ * @param t The transaction to add the frame to. This can be null to clear the transaction.
+ */
+ public void setNextTransaction(@Nullable SurfaceControl.Transaction t) {
+ nativeSetNextTransaction(mNativeObject, t == null ? 0 : t.mNativeObject);
}
public void update(SurfaceControl sc, int width, int height) {