Merge "Async BLAST Sync [2/N]: Introduce seqId" into tm-dev am: 3e6bd44753
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/17100718 Change-Id: I427bbdd1a1af5d6425e6d88ba3484a8dba3acbc9
This commit is contained in:
@@ -853,7 +853,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
* integer back over relayout.
|
||||
*/
|
||||
private Bundle mRelayoutBundle = new Bundle();
|
||||
private int mSyncSeqId;
|
||||
private int mSyncSeqId = 0;
|
||||
private int mLastSyncSeqId = 0;
|
||||
|
||||
private String mTag = TAG;
|
||||
|
||||
@@ -2924,7 +2925,8 @@ public final class ViewRootImpl implements ViewParent,
|
||||
final boolean dockedResizing = (relayoutResult
|
||||
& RELAYOUT_RES_DRAG_RESIZING_DOCKED) != 0;
|
||||
final boolean dragResizing = freeformResizing || dockedResizing;
|
||||
if ((relayoutResult & WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC) != 0) {
|
||||
if (mSyncSeqId > mLastSyncSeqId) {
|
||||
mLastSyncSeqId = mSyncSeqId;
|
||||
if (DEBUG_BLAST) {
|
||||
Log.d(mTag, "Relayout called with blastSync");
|
||||
}
|
||||
@@ -7974,6 +7976,7 @@ public final class ViewRootImpl implements ViewParent,
|
||||
insetsPending ? WindowManagerGlobal.RELAYOUT_INSETS_PENDING : 0,
|
||||
mTmpFrames, mPendingMergedConfiguration, mSurfaceControl, mTempInsets,
|
||||
mTempControls, mRelayoutBundle);
|
||||
mSyncSeqId = mRelayoutBundle.getInt("seqid");
|
||||
|
||||
final int transformHint = SurfaceControl.rotationToBufferTransform(
|
||||
(mDisplayInstallOrientation + mDisplay.getRotation()) % 4);
|
||||
|
||||
@@ -96,14 +96,6 @@ public final class WindowManagerGlobal {
|
||||
*/
|
||||
public static final int RELAYOUT_RES_CONSUME_ALWAYS_SYSTEM_BARS = 1 << 5;
|
||||
|
||||
/**
|
||||
* This flag indicates the client should not directly submit it's next frame,
|
||||
* but instead should pass it in the postDrawTransaction of
|
||||
* {@link WindowManagerService#finishDrawing}. This is used by the WM
|
||||
* BLASTSyncEngine to synchronize rendering of multiple windows.
|
||||
*/
|
||||
public static final int RELAYOUT_RES_BLAST_SYNC = 1 << 6;
|
||||
|
||||
/**
|
||||
* Flag for relayout: the client will be later giving
|
||||
* internal insets; as a result, the window will not impact other window
|
||||
|
||||
@@ -89,7 +89,6 @@ import static android.view.WindowManager.REMOVE_CONTENT_MODE_UNDEFINED;
|
||||
import static android.view.WindowManager.TRANSIT_NONE;
|
||||
import static android.view.WindowManager.TRANSIT_RELAUNCH;
|
||||
import static android.view.WindowManagerGlobal.ADD_OKAY;
|
||||
import static android.view.WindowManagerGlobal.RELAYOUT_RES_BLAST_SYNC;
|
||||
import static android.view.WindowManagerGlobal.RELAYOUT_RES_SURFACE_CHANGED;
|
||||
import static android.view.WindowManagerPolicyConstants.NAV_BAR_INVALID;
|
||||
import static android.view.WindowManagerPolicyConstants.TYPE_LAYER_MULTIPLIER;
|
||||
@@ -2508,11 +2507,14 @@ public class WindowManagerService extends IWindowManager.Stub
|
||||
win.mInRelayout = false;
|
||||
|
||||
if (mUseBLASTSync && win.useBLASTSync() && viewVisibility != View.GONE
|
||||
&& win.mNextRelayoutUseSync) {
|
||||
&& (win.mSyncSeqId > win.mLastSeqIdSentToRelayout)) {
|
||||
win.prepareDrawHandlers();
|
||||
win.markRedrawForSyncReported();
|
||||
win.mNextRelayoutUseSync = false;
|
||||
result |= RELAYOUT_RES_BLAST_SYNC;
|
||||
|
||||
win.mLastSeqIdSentToRelayout = win.mSyncSeqId;
|
||||
outSyncIdBundle.putInt("seqid", win.mSyncSeqId);
|
||||
} else {
|
||||
outSyncIdBundle.putInt("seqid", -1);
|
||||
}
|
||||
|
||||
if (configChanged) {
|
||||
|
||||
@@ -369,7 +369,8 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
private boolean mDragResizingChangeReported = true;
|
||||
private int mResizeMode;
|
||||
private boolean mRedrawForSyncReported;
|
||||
boolean mNextRelayoutUseSync;
|
||||
int mSyncSeqId = 0;
|
||||
int mLastSeqIdSentToRelayout = 0;
|
||||
|
||||
/**
|
||||
* {@code true} when the client was still drawing for sync when the sync-set was finished or
|
||||
@@ -5926,7 +5927,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
// to draw even if the children draw first or don't need to sync, so we start
|
||||
// in WAITING state rather than READY.
|
||||
mSyncState = SYNC_STATE_WAITING_FOR_DRAW;
|
||||
mNextRelayoutUseSync = true;
|
||||
mSyncSeqId++;
|
||||
requestRedrawForSync();
|
||||
return true;
|
||||
}
|
||||
@@ -6069,7 +6070,7 @@ class WindowState extends WindowContainer<WindowState> implements WindowManagerP
|
||||
*/
|
||||
void applyWithNextDraw(Consumer<SurfaceControl.Transaction> consumer) {
|
||||
mPendingDrawHandlers.add(consumer);
|
||||
mNextRelayoutUseSync = true;
|
||||
mSyncSeqId++;
|
||||
requestRedrawForSync();
|
||||
|
||||
mWmService.mH.sendNewMessageDelayed(WINDOW_STATE_BLAST_SYNC_TIMEOUT, this,
|
||||
|
||||
Reference in New Issue
Block a user