diff options
author | 2024-08-17 11:53:38 +0000 | |
---|---|---|
committer | 2024-08-17 11:53:38 +0000 | |
commit | 04e70e42877cb7c69c8c06a43d2d1ecfb05859c7 (patch) | |
tree | 37ee737f96e9aeda14088c8179f52a1213095e97 | |
parent | df1ba4b5ce7170821d22b31ab950f81a7ad958cb (diff) | |
parent | fa3d97373c264adb1468b5eacaf51245c4370979 (diff) |
Merge "Remove legacy offscreen layer tracking" into main
-rw-r--r-- | services/surfaceflinger/Layer.cpp | 1 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 38 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 11 |
3 files changed, 0 insertions, 50 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp index 3ca2e5b6ec..636f7bdabf 100644 --- a/services/surfaceflinger/Layer.cpp +++ b/services/surfaceflinger/Layer.cpp @@ -317,7 +317,6 @@ void Layer::addToCurrentState() { if (mRemovedFromDrawingState) { mRemovedFromDrawingState = false; mFlinger->mScheduler->registerLayer(this, FrameRateCompatibility::Default); - mFlinger->removeFromOffscreenLayers(this); } for (const auto& child : mCurrentChildren) { diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 9ef46f0680..cc236ac3ec 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -4369,13 +4369,6 @@ void SurfaceFlinger::doCommitTransactions() { l->setIsAtRoot(false); mCurrentState.layersSortedByZ.remove(l); } - - // If the layer has been removed and has no parent, then it will not be reachable - // when traversing layers on screen. Add the layer to the offscreenLayers set to - // ensure we can copy its current to drawing state. - if (!l->getParent()) { - mOffscreenLayers.emplace(l.get()); - } } mLayersPendingRemoval.clear(); } @@ -4389,7 +4382,6 @@ void SurfaceFlinger::doCommitTransactions() { } } - commitOffscreenLayers(); if (mLayerMirrorRoots.size() > 0) { std::deque<Layer*> pendingUpdates; pendingUpdates.insert(pendingUpdates.end(), mLayerMirrorRoots.begin(), @@ -4411,17 +4403,6 @@ void SurfaceFlinger::doCommitTransactions() { } } -void SurfaceFlinger::commitOffscreenLayers() { - for (Layer* offscreenLayer : mOffscreenLayers) { - offscreenLayer->traverse(LayerVector::StateSet::Drawing, [](Layer* layer) { - if (layer->clearTransactionFlags(eTransactionNeeded)) { - layer->doTransaction(0); - layer->commitChildList(); - } - }); - } -} - void SurfaceFlinger::invalidateLayerStack(const ui::LayerFilter& layerFilter, const Region& dirty) { for (const auto& [token, displayDevice] : FTL_FAKE_GUARD(mStateLock, mDisplays)) { auto display = displayDevice->getCompositionDisplay(); @@ -7901,7 +7882,6 @@ void SurfaceFlinger::onLayerFirstRef(Layer* layer) { void SurfaceFlinger::onLayerDestroyed(Layer* layer) { mNumLayers--; - removeHierarchyFromOffscreenLayers(layer); if (!layer->isRemovedFromCurrentState()) { mScheduler->deregisterLayer(layer); } @@ -7915,24 +7895,6 @@ void SurfaceFlinger::onLayerUpdate() { scheduleCommit(FrameHint::kActive); } -// WARNING: ONLY CALL THIS FROM LAYER DTOR -// Here we add children in the current state to offscreen layers and remove the -// layer itself from the offscreen layer list. Since -// this is the dtor, it is safe to access the current state. This keeps us -// from dangling children layers such that they are not reachable from the -// Drawing state nor the offscreen layer list -// See b/141111965 -void SurfaceFlinger::removeHierarchyFromOffscreenLayers(Layer* layer) { - for (auto& child : layer->getCurrentChildren()) { - mOffscreenLayers.emplace(child.get()); - } - mOffscreenLayers.erase(layer); -} - -void SurfaceFlinger::removeFromOffscreenLayers(Layer* layer) { - mOffscreenLayers.erase(layer); -} - status_t SurfaceFlinger::setGlobalShadowSettings(const half4& ambientColor, const half4& spotColor, float lightPosY, float lightPosZ, float lightRadius) { diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 71278764dc..282c8cf803 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -292,9 +292,6 @@ public: void onLayerDestroyed(Layer*); void onLayerUpdate(); - void removeHierarchyFromOffscreenLayers(Layer* layer); - void removeFromOffscreenLayers(Layer* layer); - // Called when all clients have released all their references to // this layer. The layer may still be kept alive by its parents but // the client can no longer modify this layer directly. @@ -824,8 +821,6 @@ private: // Clears and returns the masked bits. uint32_t clearTransactionFlags(uint32_t mask); - void commitOffscreenLayers(); - static LatchUnsignaledConfig getLatchUnsignaledConfig(); bool shouldLatchUnsignaled(const layer_state_t&, size_t numStates, bool firstTransaction) const; bool applyTransactionsLocked(std::vector<TransactionState>& transactions, VsyncId) @@ -1392,12 +1387,6 @@ private: // Flag used to set override desired display mode from backdoor bool mDebugDisplayModeSetByBackdoor = false; - // A set of layers that have no parent so they are not drawn on screen. - // Should only be accessed by the main thread. - // The Layer pointer is removed from the set when the destructor is called so there shouldn't - // be any issues with a raw pointer referencing an invalid object. - std::unordered_set<Layer*> mOffscreenLayers; - BufferCountTracker mBufferCountTracker; std::unordered_map<DisplayId, sp<HdrLayerInfoReporter>> mHdrLayerInfoListeners |