Async BLAST Sync[3/N]: Push sync-id around

We push the syncId around via MSG_RESIZED and via
finishDrawing. We can see the finishDrawing change
is no-op, as it's not used on the server side. Likewise
we can see the MSG_RESIZED change is noop, since even if it
is received, it wont be used unless we call relayoutWindow
in which case it will be overwritten by the one used there. This
change is thus a noop until we actually remove relayout window.

Bug: 161810301
Bug: 175861051
Bug: 175861127
Bug: 200285149
Change-Id: I30627ddad805731109aebeeaf6c74867dcd1ecca
This commit is contained in:
Robert Carr
2022-02-20 20:15:19 -08:00
parent 48cda45ffa
commit 7b5408d87a
2 changed files with 17 additions and 13 deletions

View File

@@ -595,6 +595,9 @@ public final class ViewRootImpl implements ViewParent,
*/
private boolean mSyncBuffer = false;
int mSyncSeqId = 0;
int mLastSyncSeqId = 0;
boolean mFullRedrawNeeded;
boolean mNewSurfaceNeeded;
boolean mForceNextWindowRelayout;
@@ -855,8 +858,6 @@ public final class ViewRootImpl implements ViewParent,
* integer back over relayout.
*/
private Bundle mRelayoutBundle = new Bundle();
private int mSyncSeqId = 0;
private int mLastSyncSeqId = 0;
private String mTag = TAG;
@@ -2660,7 +2661,6 @@ public final class ViewRootImpl implements ViewParent,
private void performTraversals() {
// cache mView since it is used so much below...
final View host = mView;
if (DBG) {
System.out.println("======================================");
System.out.println("performTraversals");
@@ -3499,13 +3499,15 @@ public final class ViewRootImpl implements ViewParent,
}
Consumer<Transaction> syncConsumer = null;
final int seqId = mSyncSeqId;
if (mBLASTDrawConsumer != null) {
syncConsumer = mBLASTDrawConsumer;
mBLASTDrawConsumer = null;
} else if (mReportNextDraw) {
syncConsumer = transaction -> {
mSurfaceChangedTransaction.merge(transaction);
reportDrawFinished();
reportDrawFinished(seqId);
};
}
@@ -4133,13 +4135,13 @@ public final class ViewRootImpl implements ViewParent,
}
}
private void reportDrawFinished() {
private void reportDrawFinished(int seqId) {
if (DEBUG_BLAST) {
Log.d(mTag, "reportDrawFinished " + Debug.getCallers(5));
}
try {
mWindowSession.finishDrawing(mWindow, mSurfaceChangedTransaction, Integer.MAX_VALUE);
mWindowSession.finishDrawing(mWindow, mSurfaceChangedTransaction, seqId);
} catch (RemoteException e) {
Log.e(mTag, "Unable to report draw finished", e);
mSurfaceChangedTransaction.apply();
@@ -4212,6 +4214,7 @@ public final class ViewRootImpl implements ViewParent,
final BackgroundBlurDrawable.BlurRegion[] blurRegionsForFrame =
mBlurRegionAggregator.getBlurRegionsCopyForRT();
// The callback will run on the render thread.
registerRtFrameCallback((frame) -> mBlurRegionAggregator
.dispatchBlurTransactionIfNeeded(frame, blurRegionsForFrame, hasBlurUpdates));
@@ -7955,7 +7958,6 @@ public final class ViewRootImpl implements ViewParent,
private int relayoutWindow(WindowManager.LayoutParams params, int viewVisibility,
boolean insetsPending) throws RemoteException {
mRelayoutRequested = true;
float appScale = mAttachInfo.mApplicationScale;
boolean restore = false;
@@ -8528,7 +8530,8 @@ public final class ViewRootImpl implements ViewParent,
@UnsupportedAppUsage(maxTargetSdk = Build.VERSION_CODES.R, trackingBug = 170729553)
private void dispatchResized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {
Message msg = mHandler.obtainMessage(reportDraw ? MSG_RESIZED_REPORT : MSG_RESIZED);
SomeArgs args = SomeArgs.obtain();
final boolean sameProcessCall = (Binder.getCallingPid() == android.os.Process.myPid());
@@ -8538,8 +8541,9 @@ public final class ViewRootImpl implements ViewParent,
args.argi1 = forceLayout ? 1 : 0;
args.argi2 = alwaysConsumeSystemBars ? 1 : 0;
args.argi3 = displayId;
args.argi4 = seqId;
args.argi4 = syncSeqId;
args.argi5 = resizeMode;
msg.obj = args;
mHandler.sendMessage(msg);
}
@@ -9929,11 +9933,11 @@ public final class ViewRootImpl implements ViewParent,
@Override
public void resized(ClientWindowFrames frames, boolean reportDraw,
MergedConfiguration mergedConfiguration, boolean forceLayout,
boolean alwaysConsumeSystemBars, int displayId, int seqId, int resizeMode) {
boolean alwaysConsumeSystemBars, int displayId, int syncSeqId, int resizeMode) {
final ViewRootImpl viewAncestor = mViewAncestor.get();
if (viewAncestor != null) {
viewAncestor.dispatchResized(frames, reportDraw, mergedConfiguration, forceLayout,
alwaysConsumeSystemBars, displayId, seqId, resizeMode);
alwaysConsumeSystemBars, displayId, syncSeqId, resizeMode);
}
}

View File

@@ -3962,8 +3962,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
try {
mClient.resized(mClientWindowFrames, reportDraw, mLastReportedConfiguration,
forceRelayout, alwaysConsumeSystemBars, displayId, Integer.MAX_VALUE,
resizeMode);
forceRelayout, alwaysConsumeSystemBars, displayId, mSyncSeqId, resizeMode);
if (drawPending && reportOrientation && mOrientationChanging) {
mOrientationChangeRedrawRequestTime = SystemClock.elapsedRealtime();
ProtoLog.v(WM_DEBUG_ORIENTATION,