Merge "Ensure pendingTransactions are applied if the VRI is torn down" into udc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
30c7bed9b9
@@ -647,11 +647,18 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
boolean mForceNextWindowRelayout;
|
boolean mForceNextWindowRelayout;
|
||||||
CountDownLatch mWindowDrawCountDown;
|
CountDownLatch mWindowDrawCountDown;
|
||||||
|
|
||||||
// Whether we have used applyTransactionOnDraw to schedule an RT
|
/**
|
||||||
// frame callback consuming a passed in transaction. In this case
|
* Value to indicate whether someone has called {@link #applyTransactionOnDraw}before the
|
||||||
// we also need to schedule a commit callback so we can observe
|
* traversal. This is used to determine whether a RT frame callback needs to be registered to
|
||||||
// if the draw was skipped, and the BBQ pending transactions.
|
* merge the transaction with the next frame. The value is cleared after the VRI has run a
|
||||||
|
* traversal pass.
|
||||||
|
*/
|
||||||
boolean mHasPendingTransactions;
|
boolean mHasPendingTransactions;
|
||||||
|
/**
|
||||||
|
* The combined transactions passed in from {@link #applyTransactionOnDraw}
|
||||||
|
*/
|
||||||
|
private Transaction mPendingTransaction = new Transaction();
|
||||||
|
|
||||||
|
|
||||||
boolean mIsDrawing;
|
boolean mIsDrawing;
|
||||||
int mLastSystemUiVisibility;
|
int mLastSystemUiVisibility;
|
||||||
@@ -4548,9 +4555,13 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void registerCallbackForPendingTransactions() {
|
private void registerCallbackForPendingTransactions() {
|
||||||
|
Transaction t = new Transaction();
|
||||||
|
t.merge(mPendingTransaction);
|
||||||
|
|
||||||
registerRtFrameCallback(new FrameDrawingCallback() {
|
registerRtFrameCallback(new FrameDrawingCallback() {
|
||||||
@Override
|
@Override
|
||||||
public HardwareRenderer.FrameCommitCallback onFrameDraw(int syncResult, long frame) {
|
public HardwareRenderer.FrameCommitCallback onFrameDraw(int syncResult, long frame) {
|
||||||
|
mergeWithNextTransaction(t, frame);
|
||||||
if ((syncResult
|
if ((syncResult
|
||||||
& (SYNC_LOST_SURFACE_REWARD_IF_FOUND | SYNC_CONTEXT_IS_STOPPED)) != 0) {
|
& (SYNC_LOST_SURFACE_REWARD_IF_FOUND | SYNC_CONTEXT_IS_STOPPED)) != 0) {
|
||||||
mBlastBufferQueue.applyPendingTransactions(frame);
|
mBlastBufferQueue.applyPendingTransactions(frame);
|
||||||
@@ -8780,6 +8791,9 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
mActiveSurfaceSyncGroup.markSyncReady();
|
mActiveSurfaceSyncGroup.markSyncReady();
|
||||||
mActiveSurfaceSyncGroup = null;
|
mActiveSurfaceSyncGroup = null;
|
||||||
}
|
}
|
||||||
|
if (mHasPendingTransactions) {
|
||||||
|
mPendingTransaction.apply();
|
||||||
|
}
|
||||||
WindowManagerGlobal.getInstance().doRemoveView(this);
|
WindowManagerGlobal.getInstance().doRemoveView(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11114,12 +11128,11 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
} else {
|
} else {
|
||||||
// Copy and clear the passed in transaction for thread safety. The new transaction is
|
// Copy and clear the passed in transaction for thread safety. The new transaction is
|
||||||
// accessed on the render thread.
|
// accessed on the render thread.
|
||||||
var localTransaction = new Transaction();
|
mPendingTransaction.merge(t);
|
||||||
localTransaction.merge(t);
|
|
||||||
mHasPendingTransactions = true;
|
mHasPendingTransactions = true;
|
||||||
registerRtFrameCallback(frame -> {
|
// Schedule the traversal to ensure there's an attempt to draw a frame and apply the
|
||||||
mergeWithNextTransaction(localTransaction, frame);
|
// pending transactions. This is also where the registerFrameCallback will be scheduled.
|
||||||
});
|
scheduleTraversals();
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -11260,6 +11273,10 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
if (DEBUG_BLAST) {
|
if (DEBUG_BLAST) {
|
||||||
Log.d(mTag, "registerCallbacksForSync syncBuffer=" + syncBuffer);
|
Log.d(mTag, "registerCallbacksForSync syncBuffer=" + syncBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Transaction t = new Transaction();
|
||||||
|
t.merge(mPendingTransaction);
|
||||||
|
|
||||||
mAttachInfo.mThreadedRenderer.registerRtFrameCallback(new FrameDrawingCallback() {
|
mAttachInfo.mThreadedRenderer.registerRtFrameCallback(new FrameDrawingCallback() {
|
||||||
@Override
|
@Override
|
||||||
public void onFrameDraw(long frame) {
|
public void onFrameDraw(long frame) {
|
||||||
@@ -11273,6 +11290,7 @@ public final class ViewRootImpl implements ViewParent,
|
|||||||
+ frame + ".");
|
+ frame + ".");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mergeWithNextTransaction(t, frame);
|
||||||
// If the syncResults are SYNC_LOST_SURFACE_REWARD_IF_FOUND or
|
// If the syncResults are SYNC_LOST_SURFACE_REWARD_IF_FOUND or
|
||||||
// SYNC_CONTEXT_IS_STOPPED it means nothing will draw. There's no need to set up
|
// SYNC_CONTEXT_IS_STOPPED it means nothing will draw. There's no need to set up
|
||||||
// any blast sync or commit callback, and the code should directly call
|
// any blast sync or commit callback, and the code should directly call
|
||||||
|
|||||||
Reference in New Issue
Block a user