summaryrefslogtreecommitdiff
path: root/services/surfaceflinger/Layer.cpp
diff options
context:
space:
mode:
author Vishnu Nair <vishnun@google.com> 2023-02-24 18:08:51 +0000
committer Vishnu Nair <vishnun@google.com> 2023-02-24 18:08:51 +0000
commitd47bceea5a8da823b38eb5ca71bb8206b95c1958 (patch)
tree2a3af01cf6cf4f5970aee757ba54cd5b6436ff48 /services/surfaceflinger/Layer.cpp
parent7c41bf2e08cf331dbd1319fe91a0d26a7304d00e (diff)
SF: Frontend fixes for issues surfaced by SurfaceFlinger_test
- separate color and bgcolor in layer state so we don't set a color on a layer without a buffer - avoid using legacy layer state when latching a buffer - fix callback issue where invisible or offscreen layers were not invoking the callbacks - pass in layer snapshot for trusted presentation state - fix a screenshot issue where the root layer was skipped - pass in framerate changes to layer history Test: presubmit Test: atest SurfaceFlinger_test with new fe Bug: 238781169 Change-Id: Id9ff8a036dc283e21a05985c1c01ebd070b1df24
Diffstat (limited to 'services/surfaceflinger/Layer.cpp')
-rw-r--r--services/surfaceflinger/Layer.cpp30
1 files changed, 23 insertions, 7 deletions
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index dac09169c8..5ee701d617 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2512,7 +2512,20 @@ bool Layer::hasInputInfo() const {
compositionengine::OutputLayer* Layer::findOutputLayerForDisplay(
const DisplayDevice* display) const {
if (!display) return nullptr;
- return display->getCompositionDisplay()->getOutputLayerForLayer(getCompositionEngineLayerFE());
+ if (!mFlinger->mLayerLifecycleManagerEnabled) {
+ return display->getCompositionDisplay()->getOutputLayerForLayer(
+ getCompositionEngineLayerFE());
+ }
+ sp<LayerFE> layerFE;
+ frontend::LayerHierarchy::TraversalPath path{.id = static_cast<uint32_t>(sequence)};
+ for (auto& [p, layer] : mLayerFEs) {
+ if (p == path) {
+ layerFE = layer;
+ }
+ }
+
+ if (!layerFE) return nullptr;
+ return display->getCompositionDisplay()->getOutputLayerForLayer(layerFE);
}
Region Layer::getVisibleRegion(const DisplayDevice* display) const {
@@ -3275,11 +3288,11 @@ bool Layer::hasFrameUpdate() const {
(c.buffer != nullptr || c.bgColorLayer != nullptr);
}
-void Layer::updateTexImage(nsecs_t latchTime) {
+void Layer::updateTexImage(nsecs_t latchTime, bool bgColorOnly) {
const State& s(getDrawingState());
if (!s.buffer) {
- if (s.bgColorLayer) {
+ if (bgColorOnly) {
for (auto& handle : mDrawingState.callbackHandles) {
handle->latchTime = latchTime;
}
@@ -3476,7 +3489,7 @@ bool Layer::simpleBufferUpdate(const layer_state_t& s) const {
}
if (s.what & layer_state_t::eBackgroundColorChanged) {
- if (mDrawingState.bgColorLayer || s.bgColorAlpha != 0) {
+ if (mDrawingState.bgColorLayer || s.bgColor.a != 0) {
ALOGV("%s: false [eBackgroundColorChanged changed]", __func__);
return false;
}
@@ -3800,6 +3813,11 @@ void Layer::onPostComposition(const DisplayDevice* display,
}
bool Layer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime) {
+ const bool bgColorOnly = mDrawingState.bgColorLayer != nullptr;
+ return latchBufferImpl(recomputeVisibleRegions, latchTime, bgColorOnly);
+}
+
+bool Layer::latchBufferImpl(bool& recomputeVisibleRegions, nsecs_t latchTime, bool bgColorOnly) {
ATRACE_FORMAT_INSTANT("latchBuffer %s - %" PRIu64, getDebugName(),
getDrawingState().frameNumber);
@@ -3816,8 +3834,7 @@ bool Layer::latchBuffer(bool& recomputeVisibleRegions, nsecs_t latchTime) {
mFlinger->onLayerUpdate();
return false;
}
-
- updateTexImage(latchTime);
+ updateTexImage(latchTime, bgColorOnly);
if (mDrawingState.buffer == nullptr) {
return false;
}
@@ -4021,7 +4038,6 @@ void Layer::updateSnapshot(bool updateGeometry) {
snapshot->bufferSize = getBufferSize(mDrawingState);
snapshot->externalTexture = mBufferInfo.mBuffer;
snapshot->hasReadyFrame = hasReadyFrame();
- snapshot->isInternalDisplayOverlay = isInternalDisplayOverlay();
preparePerFrameCompositionState();
}