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

Commit dd7bcafc authored by Vishnu Nair's avatar Vishnu Nair Committed by Automerger Merge Worker
Browse files

Merge "Honor the BlastSync request from WM until a frame is drawn" into sc-dev am: c9fb5406

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/14164168

Change-Id: I5ec8b9e44ced71a60d00edcc66f0b50b9105366c
parents ed548430 c9fb5406
Loading
Loading
Loading
Loading
+10 −6
Original line number Original line Diff line number Diff line
@@ -722,6 +722,13 @@ public final class ViewRootImpl implements ViewParent,
     */
     */
    private boolean mNextDrawUseBlastSync = false;
    private boolean mNextDrawUseBlastSync = false;


    /**
     * Wait for the blast sync transaction complete callback before drawing and queuing up more
     * frames. This will prevent out of order buffers submissions when WM has requested to
     * synchronize with the client.
     */
    private boolean mWaitForBlastSyncComplete = false;

    /**
    /**
     * Keeps track of whether a traverse was triggered while the UI thread was paused. This can
     * Keeps track of whether a traverse was triggered while the UI thread was paused. This can
     * occur when the client is waiting on another process to submit the transaction that
     * occur when the client is waiting on another process to submit the transaction that
@@ -2463,7 +2470,7 @@ public final class ViewRootImpl implements ViewParent,
        //
        //
        // When the callback is invoked, it will trigger a traversal request if
        // When the callback is invoked, it will trigger a traversal request if
        // mRequestedTraverseWhilePaused is set so there's no need to attempt a retry here.
        // mRequestedTraverseWhilePaused is set so there's no need to attempt a retry here.
        if (mNextDrawUseBlastSync) {
        if (mWaitForBlastSyncComplete) {
            if (DEBUG_BLAST) {
            if (DEBUG_BLAST) {
                Log.w(mTag, "Can't perform draw while waiting for a transaction complete");
                Log.w(mTag, "Can't perform draw while waiting for a transaction complete");
            }
            }
@@ -3244,10 +3251,6 @@ public final class ViewRootImpl implements ViewParent,
                    pendingDrawFinished();
                    pendingDrawFinished();
                }
                }
            }
            }

            // We were unable to draw this traversal. Unset this flag since we'll block without
            // ever being able to draw again
            mNextDrawUseBlastSync = false;
        }
        }


        if (mAttachInfo.mContentCaptureEvents != null) {
        if (mAttachInfo.mContentCaptureEvents != null) {
@@ -3990,7 +3993,7 @@ public final class ViewRootImpl implements ViewParent,
                    + " reportNextDraw=" + reportNextDraw
                    + " reportNextDraw=" + reportNextDraw
                    + " hasBlurUpdates=" + hasBlurUpdates);
                    + " hasBlurUpdates=" + hasBlurUpdates);
        }
        }

        mWaitForBlastSyncComplete = nextDrawUseBlastSync;
        final BackgroundBlurDrawable.BlurRegion[] blurRegionsForFrame =
        final BackgroundBlurDrawable.BlurRegion[] blurRegionsForFrame =
                needsCallbackForBlur ?  mBlurRegionAggregator.getBlurRegionsCopyForRT() : null;
                needsCallbackForBlur ?  mBlurRegionAggregator.getBlurRegionsCopyForRT() : null;


@@ -4025,6 +4028,7 @@ public final class ViewRootImpl implements ViewParent,
                    }
                    }
                    mHandler.postAtFrontOfQueue(() -> {
                    mHandler.postAtFrontOfQueue(() -> {
                        mNextDrawUseBlastSync = false;
                        mNextDrawUseBlastSync = false;
                        mWaitForBlastSyncComplete = false;
                        if (DEBUG_BLAST) {
                        if (DEBUG_BLAST) {
                            Log.d(mTag, "Scheduling a traversal=" + mRequestedTraverseWhilePaused
                            Log.d(mTag, "Scheduling a traversal=" + mRequestedTraverseWhilePaused
                                    + " due to a previous skipped traversal.");
                                    + " due to a previous skipped traversal.");