summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2023-05-22 15:10:20 -0700
committer Vishnu Nair <vishnun@google.com> 2023-05-22 15:10:20 -0700
commitfa9e2ef3d6ece2fef67ef460cbdfca009fb330fb (patch)
tree581c6eb5be4136eaa787bc39ded7c30cc815f7e4
parentbb319326a6a8235e0227d404e428f9fcd23cfaec (diff)
[sf] Update snapshots after screenshots
Screenshots can be taken for a partial hierarchy and may require some of the layers to be temporarily reparented and their geometry to be updated. Sceenshots use a copy of the layer snapshots and another instance of the composition engine to render the contents to a buffer. There was an issue where the snapshots were updated before they were copied and if the screenshot was taken during a period where there were no visible region changes (and no reason to rebuild the snapshots) we would pass invalid snapshot data when compositing to the display. With legacy frontend, its harder to split the screenshot path and the display composition path, so as a fix, update the snapshots after screenshots are taken. Bug: 282884552 Test: instrumented load to verify snapshots are updated correctly Test: repro steps in bug Change-Id: Ie778b02b57c5b1ddf0f09afe82675e04c5535ee5
-rw-r--r--services/surfaceflinger/Layer.h3
-rw-r--r--services/surfaceflinger/LayerRenderArea.cpp2
2 files changed, 3 insertions, 2 deletions
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 38590e6f20..f7596e20e5 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -877,6 +877,7 @@ public:
// TODO(b/238781169) Remove direct calls to RenderEngine::drawLayers that don't go through
// CompositionEngine to create a single path for composing layers.
void updateSnapshot(bool updateGeometry);
+ void updateChildrenSnapshots(bool updateGeometry);
void updateMetadataSnapshot(const LayerMetadata& parentMetadata);
void updateRelativeMetadataSnapshot(const LayerMetadata& relativeLayerMetadata,
std::unordered_set<Layer*>& visited);
@@ -1134,8 +1135,6 @@ private:
bool hasSomethingToDraw() const { return hasEffect() || hasBufferOrSidebandStream(); }
- void updateChildrenSnapshots(bool updateGeometry);
-
// Fills the provided vector with the currently available JankData and removes the processed
// JankData from the pending list.
void transferAvailableJankData(const std::deque<sp<CallbackHandle>>& handles,
diff --git a/services/surfaceflinger/LayerRenderArea.cpp b/services/surfaceflinger/LayerRenderArea.cpp
index d606cffe40..51d4ff854f 100644
--- a/services/surfaceflinger/LayerRenderArea.cpp
+++ b/services/surfaceflinger/LayerRenderArea.cpp
@@ -116,6 +116,8 @@ void LayerRenderArea::render(std::function<void()> drawLayers) {
mLayer->setChildrenDrawingParent(mLayer);
}
}
+ mLayer->updateSnapshot(/*updateGeometry=*/true);
+ mLayer->updateChildrenSnapshots(/*updateGeometry=*/true);
}
} // namespace android