Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3e6bd447 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Async BLAST Sync [2/N]: Introduce seqId" into tm-dev

parents ad03eb31 5109c0da
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -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);
+0 −8
Original line number Diff line number Diff line
@@ -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
+6 −4
Original line number Diff line number Diff line
@@ -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) {
+4 −3
Original line number Diff line number Diff line
@@ -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,