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

Commit 7df723dd authored by Chavi Weingarten's avatar Chavi Weingarten Committed by Android (Google) Code Review
Browse files

Merge "Fixed a few issues with blast sync with SurfaceView"

parents 85036ff7 ad816084
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -3912,7 +3912,8 @@ public final class ViewRootImpl implements ViewParent,
            return;
        }

        final boolean fullRedrawNeeded = mFullRedrawNeeded || mReportNextDraw;
        final boolean fullRedrawNeeded =
                mFullRedrawNeeded || mReportNextDraw || mNextDrawUseBLASTSyncTransaction;
        mFullRedrawNeeded = false;

        mIsDrawing = true;
@@ -9921,6 +9922,18 @@ public final class ViewRootImpl implements ViewParent,
            } else {
                t.merge(mRtBLASTSyncTransaction);
            }

            // There's potential for the frame callback to get called even if nothing was drawn.
            // When that occurs, we remove the transaction sent to BBQ since the draw we were
            // waiting on will not happen. We can apply the transaction here but it will not contain
            // a buffer since nothing new was drawn.
            //
            // This is mainly for the case when the SurfaceView has changed and wants to synchronize
            // with the main window. If the main window doesn't need to draw anything, we can just
            // apply the transaction without the new buffer from the main window.
            if (mBlastBufferQueue != null) {
                mBlastBufferQueue.setNextTransaction(null);
            }
        }
    }

+8 −2
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.graphics;

import android.annotation.Nullable;
import android.view.Surface;
import android.view.SurfaceControl;

@@ -60,8 +61,13 @@ public final class BLASTBufferQueue {
        return nativeGetSurface(mNativeObject, true /* includeSurfaceControlHandle */);
    }

    public void setNextTransaction(SurfaceControl.Transaction t) {
        nativeSetNextTransaction(mNativeObject, t.mNativeObject);
    /**
     * Send the transaction to BBQ so the next frame can be added and not applied immediately.
     * This gives the caller a chance to apply the transaction when it's ready.
     * @param t The transaction to add the frame to. This can be null to clear the transaction.
     */
    public void setNextTransaction(@Nullable SurfaceControl.Transaction t) {
        nativeSetNextTransaction(mNativeObject, t == null ? 0 : t.mNativeObject);
    }

    public void update(SurfaceControl sc, int width, int height) {