summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2023-03-11 10:16:07 -0800
committer Vishnu Nair <vishnun@google.com> 2023-03-12 20:23:36 +0000
commit191eeb8f65c9d16620847b4f40c81d8f55b59bc0 (patch)
tree395caff0733ee7e79c1649010c8f2e346d1727aa
parent817506258641f149256fc038b4f3830546d87bbd (diff)
[LayerTraceGenerator] Ignore unknown handles
Ignore unknown handles when iteroping with legacy front end. In the old world, we would create child layers which are not necessary with the new front end. This means we will get notified for handle changes that dont exist in the new front end. Test: presubmit Bug: 255901752 Change-Id: I669bcd7d635db6fa86cd3a64fc260178c2a85580
-rw-r--r--services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp6
-rw-r--r--services/surfaceflinger/FrontEnd/LayerLifecycleManager.h5
-rw-r--r--services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp2
3 files changed, 9 insertions, 4 deletions
diff --git a/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp b/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp
index fe42422f6f..3706225228 100644
--- a/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp
+++ b/services/surfaceflinger/FrontEnd/LayerLifecycleManager.cpp
@@ -71,12 +71,14 @@ void LayerLifecycleManager::addLayers(std::vector<std::unique_ptr<RequestedLayer
}
}
-void LayerLifecycleManager::onHandlesDestroyed(const std::vector<uint32_t>& destroyedHandles) {
+void LayerLifecycleManager::onHandlesDestroyed(const std::vector<uint32_t>& destroyedHandles,
+ bool ignoreUnknownHandles) {
std::vector<uint32_t> layersToBeDestroyed;
for (const auto& layerId : destroyedHandles) {
auto it = mIdToLayer.find(layerId);
if (it == mIdToLayer.end()) {
- LOG_ALWAYS_FATAL("%s Layerid not found %d", __func__, layerId);
+ LOG_ALWAYS_FATAL_IF(!ignoreUnknownHandles, "%s Layerid not found %d", __func__,
+ layerId);
continue;
}
RequestedLayerState& layer = it->second.owner;
diff --git a/services/surfaceflinger/FrontEnd/LayerLifecycleManager.h b/services/surfaceflinger/FrontEnd/LayerLifecycleManager.h
index 25d27ee373..3d9a74c843 100644
--- a/services/surfaceflinger/FrontEnd/LayerLifecycleManager.h
+++ b/services/surfaceflinger/FrontEnd/LayerLifecycleManager.h
@@ -40,7 +40,10 @@ public:
// External state changes should be updated in the following order:
void addLayers(std::vector<std::unique_ptr<RequestedLayerState>>);
void applyTransactions(const std::vector<TransactionState>&);
- void onHandlesDestroyed(const std::vector<uint32_t>&);
+ // Ignore unknown handles when iteroping with legacy front end. In the old world, we
+ // would create child layers which are not necessary with the new front end. This means
+ // we will get notified for handle changes that don't exist in the new front end.
+ void onHandlesDestroyed(const std::vector<uint32_t>&, bool ignoreUnknownHandles = false);
// Detaches the layer from its relative parent to prevent a loop in the
// layer hierarchy. This overrides the RequestedLayerState and leaves
diff --git a/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp b/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp
index 915a689fbd..0a7101ccce 100644
--- a/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp
+++ b/services/surfaceflinger/Tracing/tools/LayerTraceGenerator.cpp
@@ -105,7 +105,7 @@ bool LayerTraceGenerator::generate(const proto::TransactionTraceFile& traceFile,
// apply updates
lifecycleManager.addLayers(std::move(addedLayers));
lifecycleManager.applyTransactions(transactions);
- lifecycleManager.onHandlesDestroyed(destroyedHandles);
+ lifecycleManager.onHandlesDestroyed(destroyedHandles, /*ignoreUnknownHandles=*/true);
if (lifecycleManager.getGlobalChanges().test(
frontend::RequestedLayerState::Changes::Hierarchy)) {