Merge "Remove legacy offscreen layer tracking" into main
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 3ca2e5b..636f7bd 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -317,7 +317,6 @@
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 9ef46f0..cc236ac 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -4369,13 +4369,6 @@
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 @@
}
}
- commitOffscreenLayers();
if (mLayerMirrorRoots.size() > 0) {
std::deque<Layer*> pendingUpdates;
pendingUpdates.insert(pendingUpdates.end(), mLayerMirrorRoots.begin(),
@@ -4411,17 +4403,6 @@
}
}
-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::onLayerDestroyed(Layer* layer) {
mNumLayers--;
- removeHierarchyFromOffscreenLayers(layer);
if (!layer->isRemovedFromCurrentState()) {
mScheduler->deregisterLayer(layer);
}
@@ -7915,24 +7895,6 @@
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 7127876..282c8cf 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -292,9 +292,6 @@
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 @@
// 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 @@
// 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