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

Commit cef9a28a authored by Robert Carr's avatar Robert Carr
Browse files

Replace deferTransactionUntilSurface with deferTransactionUntil

In the case of the BLASTBufferQueue adapter the IGBP assosciated with
the Surface will not be known to SurfaceFlinger. This means passing it
as a handle for deferring transacations will fail. This is a first step
at making deferred transactions work with BLAST for migration purposes.

Bug: 146598493
Test: Builds, existing tests pass.
Change-Id: I2e1f9d7a7bc079c18d0e4f4fbde3541022b15f1f
parent 57b07254
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -2528,6 +2528,7 @@ public final class SurfaceControl implements Parcelable {
        /**
         * @hide
         */
        @Deprecated
        @UnsupportedAppUsage
        public Transaction deferTransactionUntilSurface(SurfaceControl sc, Surface barrierSurface,
                long frameNumber) {
+5 −4
Original line number Diff line number Diff line
@@ -407,7 +407,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
                            }
                            t.setAlpha(mSurfaceControl, alpha);
                            if (!useBLAST) {
                                t.deferTransactionUntilSurface(mSurfaceControl, parent, frame);
                                t.deferTransactionUntil(mSurfaceControl,
                                        viewRoot.getRenderSurfaceControl(), frame);
                            }
                        }
                        // It's possible that mSurfaceControl is released in the UI thread before
@@ -1110,7 +1111,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
        if (frameNumber > 0 && !WindowManagerGlobal.USE_BLAST_ADAPTER) {
            final ViewRootImpl viewRoot = getViewRootImpl();

            t.deferTransactionUntilSurface(surface, viewRoot.mSurface,
            t.deferTransactionUntil(surface, viewRoot.getRenderSurfaceControl(),
                    frameNumber);
        }

@@ -1205,8 +1206,8 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall

            if (frameNumber > 0 && viewRoot !=  null && !useBLAST) {
                if (viewRoot.mSurface.isValid()) {
                    mRtTransaction.deferTransactionUntilSurface(mSurfaceControl, viewRoot.mSurface,
                            frameNumber);
                    mRtTransaction.deferTransactionUntil(mSurfaceControl,
                            viewRoot.getRenderSurfaceControl(), frameNumber);
                }
            }
            t.hide(mSurfaceControl);
+4 −4
Original line number Diff line number Diff line
@@ -38,7 +38,7 @@ public class SyncRtSurfaceTransactionApplier {
    public static final int FLAG_CORNER_RADIUS = 1 << 4;
    public static final int FLAG_VISIBILITY = 1 << 5;

    private final Surface mTargetSurface;
    private SurfaceControl mTargetSc;
    private final ViewRootImpl mTargetViewRootImpl;
    private final float[] mTmpFloat9 = new float[9];

@@ -47,7 +47,6 @@ public class SyncRtSurfaceTransactionApplier {
     */
    public SyncRtSurfaceTransactionApplier(View targetView) {
        mTargetViewRootImpl = targetView != null ? targetView.getViewRootImpl() : null;
        mTargetSurface = mTargetViewRootImpl != null ? mTargetViewRootImpl.mSurface : null;
    }

    /**
@@ -60,15 +59,16 @@ public class SyncRtSurfaceTransactionApplier {
        if (mTargetViewRootImpl == null) {
            return;
        }
        mTargetSc = mTargetViewRootImpl.getRenderSurfaceControl();
        mTargetViewRootImpl.registerRtFrameCallback(frame -> {
            if (mTargetSurface == null || !mTargetSurface.isValid()) {
            if (mTargetSc == null || !mTargetSc.isValid()) {
                return;
            }
            Transaction t = new Transaction();
            for (int i = params.length - 1; i >= 0; i--) {
                SurfaceParams surfaceParams = params[i];
                SurfaceControl surface = surfaceParams.surface;
                t.deferTransactionUntilSurface(surface, mTargetSurface, frame);
                t.deferTransactionUntil(surface, mTargetSc, frame);
                applyParams(t, surfaceParams, mTmpFloat9);
            }
            t.setEarlyWakeup();
+10 −2
Original line number Diff line number Diff line
@@ -1699,8 +1699,8 @@ public final class ViewRootImpl implements ViewParent,
    private void updateBoundsLayer() {
        if (mBoundsLayer != null) {
            setBoundsLayerCrop();
            mTransaction.deferTransactionUntilSurface(mBoundsLayer,
                    mSurface, mSurface.getNextFrameNumber())
            mTransaction.deferTransactionUntil(mBoundsLayer,
                    getRenderSurfaceControl(), mSurface.getNextFrameNumber())
                    .apply();
        }
    }
@@ -9465,4 +9465,12 @@ public final class ViewRootImpl implements ViewParent,
    SurfaceControl.Transaction getBLASTSyncTransaction() {
        return mRtBLASTSyncTransaction;
    }

    SurfaceControl getRenderSurfaceControl() {
        if (WindowManagerGlobal.USE_BLAST_ADAPTER) {
            return mBlastSurfaceControl;
        } else {
            return mSurfaceControl;
        }
    }
}