From afa188d037bd5494347e6fd16245766b4499322e Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Thu, 28 Feb 2019 23:14:29 +0100 Subject: [PATCH] Get rid of logic that clears sync point when layer is hidden For app transitions that go to Launcher, Launcher is initially hidden, including the leash controlling it as well as the actual WSA surface. Since the barrier layer of the leash of the closing app is Launcher WSA, which is a child of the Launcher leash, the sync point will be cleared because it's not yet shown, as the showing itself is synced to WSA Launcher surface. However that destroys the synchronization, leading to jank in various ways. The justification why this code was added doesn't make sense to me: SurfaceView usually synchronizes with Activity main window surfaces. These get destroyed as soon as the activity goes away. We don't think that logic is needed at all. Test: Open app, press back, observe no jank Test: Play video in app Fixes: 126340236 Change-Id: Ib70d3bbdce1c7206487359213803e3e59d332400 --- services/surfaceflinger/Layer.cpp | 19 ------------------- services/surfaceflinger/Layer.h | 2 -- 2 files changed, 21 deletions(-) diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 5f6d2a7f98..80e15cda37 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -1111,13 +1111,6 @@ uint32_t Layer::doTransaction(uint32_t flags) { mNeedsFiltering = (!getActiveTransform(c).preserveRects() || type >= ui::Transform::SCALE); } - // If the layer is hidden, signal and clear out all local sync points so - // that transactions for layers depending on this layer's frames becoming - // visible are not blocked - if (c.flags & layer_state_t::eLayerHidden) { - clearSyncPoints(); - } - if (mCurrentState.inputInfoChanged) { flags |= eInputInfoChanged; mCurrentState.inputInfoChanged = false; @@ -1806,18 +1799,6 @@ void Layer::setParent(const sp& layer) { mCurrentParent = layer; } -void Layer::clearSyncPoints() { - for (const auto& child : mCurrentChildren) { - child->clearSyncPoints(); - } - - Mutex::Autolock lock(mLocalSyncPointMutex); - for (auto& point : mLocalSyncPoints) { - point->setFrameAvailable(); - } - mLocalSyncPoints.clear(); -} - int32_t Layer::getZ() const { return mDrawingState.z; } diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h index 8b6d4c7eae..4b607f4f56 100644 --- a/services/surfaceflinger/Layer.h +++ b/services/surfaceflinger/Layer.h @@ -750,8 +750,6 @@ protected: virtual bool applyPendingStates(State* stateToCommit); virtual uint32_t doTransactionResize(uint32_t flags, Layer::State* stateToCommit); - void clearSyncPoints(); - // Returns mCurrentScaling mode (originating from the // Client) or mOverrideScalingMode mode (originating from // the Surface Controller) if set. -- 2.11.0