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

Commit 4a10b38a authored by chaviw's avatar chaviw
Browse files

Removed separate SurfaceControl for Blast

If Blast was enabled, WindowStateAnimator would create a container layer
and then a blast layer as a child. This caused some issues with
reparentChildren and relative Z, so instead of trying to continously fix
those issues, just use one layer. If blast is enabled, it will create a
single SurfaceControl with type blast. Otherwise, it will create a
BufferQueueLayer.

This means that we have to be careful with setting any properties on
the layer since the blast adapter could also be modifying the layer.
This is in the right direction since we will move all transactions for
the layer to the client, eventually.

Test: YT and Chrome with and without Blast
Change-Id: I43efc37663696ba8e54d341a03531f0048ee6a14
parent 343b8725
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -135,7 +135,6 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase
        final int mHeight;
        final Point mOutSurfaceSize = new Point();
        final SurfaceControl mOutSurfaceControl;
        final SurfaceControl mOutBlastSurfaceControl = new SurfaceControl();

        final IntSupplier mViewVisibility;

@@ -158,7 +157,7 @@ public class RelayoutPerfTest extends WindowManagerPerfTestBase
                session.relayout(mWindow, mParams, mWidth, mHeight,
                        mViewVisibility.getAsInt(), mFlags, mFrameNumber, mOutFrames,
                        mOutMergedConfiguration, mOutSurfaceControl, mOutInsetsState, mOutControls,
                        mOutSurfaceSize, mOutBlastSurfaceControl);
                        mOutSurfaceSize);
            }
        }
    }
+1 −4
Original line number Diff line number Diff line
@@ -227,9 +227,6 @@ public abstract class WallpaperService extends Service {

        SurfaceControl mSurfaceControl = new SurfaceControl();

        // Unused relayout out-param
        SurfaceControl mTmpSurfaceControl = new SurfaceControl();

        final BaseSurfaceHolder mSurfaceHolder = new BaseSurfaceHolder() {
            {
                mRequestedFormat = PixelFormat.RGBX_8888;
@@ -905,7 +902,7 @@ public abstract class WallpaperService extends Service {
                    final int relayoutResult = mSession.relayout(
                            mWindow, mLayout, mWidth, mHeight,
                            View.VISIBLE, 0, -1, mWinFrames, mMergedConfiguration, mSurfaceControl,
                            mInsetsState, mTempControls, mSurfaceSize, mTmpSurfaceControl);
                            mInsetsState, mTempControls, mSurfaceSize);
                    if (mSurfaceControl.isValid()) {
                        mSurfaceHolder.mSurface.copyFrom(mSurfaceControl);
                    }
+1 −4
Original line number Diff line number Diff line
@@ -98,9 +98,6 @@ interface IWindowSession {
     * @param outSurface Object in which is placed the new display surface.
     * @param insetsState The current insets state in the system.
     * @param outSurfaceSize The width and height of the surface control
     * @param outBlastSurfaceControl A BLAST SurfaceControl allocated by the WindowManager
     * the SurfaceControl willl be managed by the client side, but the WindowManager
     * may use it as a deferTransaction barrier.
     *
     * @return int Result flags: {@link WindowManagerGlobal#RELAYOUT_SHOW_FOCUS},
     * {@link WindowManagerGlobal#RELAYOUT_FIRST_TIME}.
@@ -110,7 +107,7 @@ interface IWindowSession {
            int flags, long frameNumber, out ClientWindowFrames outFrames,
            out MergedConfiguration outMergedConfiguration, out SurfaceControl outSurfaceControl,
            out InsetsState insetsState, out InsetsSourceControl[] activeControls,
            out Point outSurfaceSize, out SurfaceControl outBlastSurfaceControl);
            out Point outSurfaceSize);

    /*
     * Notify the window manager that an application is relaunching and
+4 −4
Original line number Diff line number Diff line
@@ -467,7 +467,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
                                Transaction t = new SurfaceControl.Transaction();
                                t.setAlpha(mSurfaceControl, alpha);
                                t.deferTransactionUntil(mSurfaceControl,
                                        viewRoot.getRenderSurfaceControl(), frame);
                                        viewRoot.getSurfaceControl(), frame);
                                t.apply();
                            }
                        }
@@ -827,7 +827,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
                        final SurfaceControl.Transaction t = new SurfaceControl.Transaction();
                        updateRelativeZ(t);
                        t.deferTransactionUntil(mSurfaceControl,
                                viewRoot.getRenderSurfaceControl(), frame);
                                viewRoot.getSurfaceControl(), frame);
                        t.apply();
                    }
                }
@@ -1352,7 +1352,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
            Rect position, long frameNumber) {
        final ViewRootImpl viewRoot = getViewRootImpl();
        if (frameNumber > 0 && viewRoot != null && !viewRoot.useBLAST()) {
            t.deferTransactionUntil(surface, viewRoot.getRenderSurfaceControl(),
            t.deferTransactionUntil(surface, viewRoot.getSurfaceControl(),
                    frameNumber);
        }

@@ -1470,7 +1470,7 @@ public class SurfaceView extends View implements ViewRootImpl.SurfaceChangedCall
                } else {
                    if (frameNumber > 0 && viewRoot != null && viewRoot.mSurface.isValid()) {
                        mRtTransaction.deferTransactionUntil(mSurfaceControl,
                                viewRoot.getRenderSurfaceControl(), frameNumber);
                                viewRoot.getSurfaceControl(), frameNumber);
                    }
                    mRtTransaction.hide(mSurfaceControl);
                    if (mRtReleaseSurfaces) {
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,7 @@ public class SyncRtSurfaceTransactionApplier {
        if (mTargetViewRootImpl == null) {
            return;
        }
        mTargetSc = mTargetViewRootImpl.getRenderSurfaceControl();
        mTargetSc = mTargetViewRootImpl.getSurfaceControl();
        mTargetViewRootImpl.registerRtFrameCallback(frame -> {
            if (mTargetSc == null || !mTargetSc.isValid()) {
                return;
Loading