SyncRtSurfaceTransactionApplier: Use BLASTSync

Helps us down the path of deprecating deferred transaction. BLASTSync
should also be easier to debug and produce less overhead on the server.

Bug: 168505645
Test: Existing tests pass
Change-Id: I1f1375f4ddfe84f724109d1c1b601260cef0ba6c
This commit is contained in:
Robert Carr
2021-02-02 13:17:22 -08:00
committed by Rob Carr
parent fb59b6880f
commit 1f96f3cd28
4 changed files with 21 additions and 7 deletions

View File

@@ -85,12 +85,13 @@ public class SyncRtSurfaceTransactionApplier {
for (int i = params.length - 1; i >= 0; i--) {
SurfaceParams surfaceParams = params[i];
SurfaceControl surface = surfaceParams.surface;
if (frame > 0) {
t.deferTransactionUntil(surface, mTargetSc, frame);
}
applyParams(t, surfaceParams, mTmpFloat9);
}
t.apply();
if (mTargetViewRootImpl != null) {
mTargetViewRootImpl.mergeWithNextTransaction(t, frame);
} else {
t.apply();
}
}
public static void applyParams(Transaction t, SurfaceParams params, float[] tmpFloat9) {

View File

@@ -10137,9 +10137,11 @@ public final class ViewRootImpl implements ViewParent,
* Merges the transaction passed in with the next transaction in BLASTBufferQueue. This ensures
* you can add transactions to the upcoming frame.
*/
void mergeWithNextTransaction(Transaction t, long frameNumber) {
public void mergeWithNextTransaction(Transaction t, long frameNumber) {
if (mBlastBufferQueue != null) {
mBlastBufferQueue.mergeWithNextTransaction(t, frameNumber);
} else {
t.apply();
}
}
}

View File

@@ -114,10 +114,13 @@ public class SyncRtSurfaceTransactionApplierCompat {
for (int i = params.length - 1; i >= 0; i--) {
SyncRtSurfaceTransactionApplierCompat.SurfaceParams surfaceParams =
params[i];
t.deferTransactionUntil(surfaceParams.surface, mBarrierSurfaceControl, frame);
surfaceParams.applyTo(t);
}
t.apply();
if (mTargetViewRootImpl != null) {
mTargetViewRootImpl.mergeWithNextTransaction(t, frame);
} else {
t.apply();
}
Trace.traceEnd(Trace.TRACE_TAG_VIEW);
Message.obtain(mApplyHandler, MSG_UPDATE_SEQUENCE_NUMBER, toApplySeqNo, 0)
.sendToTarget();

View File

@@ -56,4 +56,12 @@ public class ViewRootImplCompat {
});
}
}
public void mergeWithNextTransaction(SurfaceControl.Transaction t, long frame) {
if (mViewRoot != null) {
mViewRoot.mergeWithNextTransaction(t, frame);
} else {
t.apply();
}
}
}