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

Commit 46347820 authored by Vishnu Nair's avatar Vishnu Nair
Browse files

Update BBQ apply token before updating destination frame

BBQ will set an initial destination frame when
created. This would use the old apply token causing out of
order destination frames to be applied. Fix this by not updating
the destination frame in the constructor.

Fixes: 386289111
Test: presubmit
Flag: EXEMPT bug fix
Change-Id: Ie10345192456586dd1a30fdc25dc6a81fd1e5bd6
parent 8de4fa32
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -2411,9 +2411,10 @@ public abstract class WallpaperService extends Service {
        private Surface getOrCreateBLASTSurface(int width, int height, int format) {
            Surface ret = null;
            if (mBlastBufferQueue == null) {
                mBlastBufferQueue = new BLASTBufferQueue("Wallpaper", mBbqSurfaceControl,
                        width, height, format);
                mBlastBufferQueue = new BLASTBufferQueue("Wallpaper",
                        true /* updateDestinationFrame */);
                mBlastBufferQueue.setApplyToken(mBbqApplyToken);
                mBlastBufferQueue.update(mBbqSurfaceControl, width, height, format);
                // We only return the Surface the first time, as otherwise
                // it hasn't changed and there is no need to update.
                ret = mBlastBufferQueue.createSurface();
+5 −4
Original line number Diff line number Diff line
@@ -2769,14 +2769,15 @@ public final class ViewRootImpl implements ViewParent,
        if (mBlastBufferQueue != null) {
            mBlastBufferQueue.destroy();
        }
        mBlastBufferQueue = new BLASTBufferQueue(mTag, mSurfaceControl,
                mSurfaceSize.x, mSurfaceSize.y, mWindowAttributes.format);
        mBlastBufferQueue.setTransactionHangCallback(sTransactionHangCallback);
        mBlastBufferQueue.setWaitForBufferReleaseCallback(mChoreographer::onWaitForBufferRelease);
        mBlastBufferQueue = new BLASTBufferQueue(mTag, true /* updateDestinationFrame */);
        // If we create and destroy BBQ without recreating the SurfaceControl, we can end up
        // queuing buffers on multiple apply tokens causing out of order buffer submissions. We
        // fix this by setting the same apply token on all BBQs created by this VRI.
        mBlastBufferQueue.setApplyToken(mBbqApplyToken);
        mBlastBufferQueue.update(mSurfaceControl,  mSurfaceSize.x, mSurfaceSize.y,
                mWindowAttributes.format);
        mBlastBufferQueue.setTransactionHangCallback(sTransactionHangCallback);
        mBlastBufferQueue.setWaitForBufferReleaseCallback(mChoreographer::onWaitForBufferRelease);
        Surface blastSurface;
        if (addSchandleToVriSurface()) {
            blastSurface = mBlastBufferQueue.createSurfaceWithHandle();