OSDN Git Service

Get rid of logic that clears sync point when layer is hidden
authorJorim Jaggi <jjaggi@google.com>
Thu, 28 Feb 2019 22:14:29 +0000 (23:14 +0100)
committerJorim Jaggi <jjaggi@google.com>
Thu, 28 Feb 2019 23:19:45 +0000 (00:19 +0100)
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
services/surfaceflinger/Layer.h

index 5f6d2a7..80e15cd 100644 (file)
@@ -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>& 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;
 }
index 8b6d4c7..4b607f4 100644 (file)
@@ -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.