CE: Remove compositionengine::Layer
This was a mostly straightforward refactor that restructures the
interface between SurfaceFlinger and CompositionEngine.
1) Instead of each SurfaceFlinger Layer creating and owning a
compositionengine::Layer, each Layer instead creates and owns a
compositionengine::LayerFECompositionState structure. Containing this
state structure was the only real purpose for
compositionengine::Layer.
2) Use the compositionengine::LayerFE interface in CompositionEngine in
place of compositionengine::Layer. This includes passing a
std::vector for the layers when SurfaceFlinger calls into
CompositionEngine.
3) Alters the LayerFE interface to add the ability to get the state, as
well as changing the existing "latchCompositionState" calls taking a
state reference as the first argument into "prepareCompositionState"
calls that do not need it, as the target of the call owns the state.
4) Alters the SurfaceFlinger Layer implementations to match the LayerFE
interface changes.
Test: atest libcompositionengine_test libsurfaceflinger_unittest
Test: atest CtsColorModeTestCases
Test: atest CtsDisplayTestCases
Test: atest CtsGraphicsTestCases
Test: atest CtsUiRenderingTestCases
Test: atest CtsViewTestCases
Test: atest android.media.cts.EncodeVirtualDisplayWithCompositionTest
Test: go/wm-smoke
Bug: 144117494
Change-Id: Id45df7c9cc389c8fd834ba379bc0d6360a984dac
diff --git a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
index aeaa18a..6203dc6 100644
--- a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
@@ -16,10 +16,10 @@
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/LayerFE.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/OutputLayer.h>
#include <compositionengine/impl/CompositionEngine.h>
#include <compositionengine/impl/Display.h>
-#include <compositionengine/impl/Layer.h>
#include <renderengine/RenderEngine.h>
#include <utils/Trace.h>
@@ -51,9 +51,9 @@
return compositionengine::impl::createDisplay(*this, args);
}
-std::shared_ptr<compositionengine::Layer> CompositionEngine::createLayer(
- const LayerCreationArgs& args) {
- return compositionengine::impl::createLayer(args);
+std::unique_ptr<compositionengine::LayerFECompositionState>
+CompositionEngine::createLayerFECompositionState() {
+ return std::make_unique<compositionengine::LayerFECompositionState>();
}
HWComposer& CompositionEngine::getHwComposer() const {
@@ -120,8 +120,7 @@
for (auto* layer : output->getOutputLayersOrderedByZ()) {
if (layer->isHardwareCursor()) {
// Latch the cursor composition state from each front-end layer.
- layer->getLayerFE().latchCursorCompositionState(layer->getLayer().editFEState());
-
+ layer->getLayerFE().prepareCompositionState(LayerFE::StateSubset::Cursor);
layer->writeCursorPositionToHWC();
}
}
@@ -137,8 +136,7 @@
mRefreshStartTime = systemTime(SYSTEM_TIME_MONOTONIC);
for (auto& layer : args.layers) {
- sp<compositionengine::LayerFE> layerFE = layer->getLayerFE();
- if (layerFE && layerFE->onPreComposition(mRefreshStartTime)) {
+ if (layer->onPreComposition(mRefreshStartTime)) {
needsAnotherUpdate = true;
}
}
diff --git a/services/surfaceflinger/CompositionEngine/src/Display.cpp b/services/surfaceflinger/CompositionEngine/src/Display.cpp
index ccd6572..1d8a23f 100644
--- a/services/surfaceflinger/CompositionEngine/src/Display.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Display.cpp
@@ -147,9 +147,8 @@
}
std::unique_ptr<compositionengine::OutputLayer> Display::createOutputLayer(
- const std::shared_ptr<compositionengine::Layer>& layer,
const sp<compositionengine::LayerFE>& layerFE) const {
- auto result = impl::createOutputLayer(*this, layer, layerFE);
+ auto result = impl::createOutputLayer(*this, layerFE);
if (result && mId) {
auto& hwc = getCompositionEngine().getHwComposer();
@@ -184,16 +183,18 @@
// Any non-null entries in the current list of layers are layers that are no
// longer going to be visible
- for (auto* layer : getOutputLayersOrderedByZ()) {
- if (!layer) {
+ for (auto* outputLayer : getOutputLayersOrderedByZ()) {
+ if (!outputLayer) {
continue;
}
- sp<compositionengine::LayerFE> layerFE(&layer->getLayerFE());
+ compositionengine::LayerFE* layerFE = &outputLayer->getLayerFE();
const bool hasQueuedFrames =
- std::find(refreshArgs.layersWithQueuedFrames.cbegin(),
- refreshArgs.layersWithQueuedFrames.cend(),
- &layer->getLayer()) != refreshArgs.layersWithQueuedFrames.cend();
+ std::any_of(refreshArgs.layersWithQueuedFrames.cbegin(),
+ refreshArgs.layersWithQueuedFrames.cend(),
+ [layerFE](sp<compositionengine::LayerFE> layerWithQueuedFrames) {
+ return layerFE == layerWithQueuedFrames.get();
+ });
if (hasQueuedFrames) {
releasedLayers.emplace_back(layerFE);
diff --git a/services/surfaceflinger/CompositionEngine/src/Layer.cpp b/services/surfaceflinger/CompositionEngine/src/Layer.cpp
deleted file mode 100644
index ecacaee..0000000
--- a/services/surfaceflinger/CompositionEngine/src/Layer.cpp
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * Copyright 2019 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include <android-base/stringprintf.h>
-#include <compositionengine/LayerFE.h>
-#include <compositionengine/LayerFECompositionState.h>
-#include <compositionengine/impl/Layer.h>
-
-namespace android::compositionengine {
-
-Layer::~Layer() = default;
-
-namespace impl {
-
-std::shared_ptr<Layer> createLayer(const LayerCreationArgs& args) {
- return compositionengine::impl::createLayerTemplated<Layer>(args);
-}
-
-Layer::~Layer() = default;
-
-void Layer::dump(std::string& out) const {
- auto layerFE = getLayerFE();
- android::base::StringAppendF(&out, "* compositionengine::Layer %p (%s)\n", this,
- layerFE ? layerFE->getDebugName() : "<unknown>");
- out.append(" frontend:\n");
- dumpFEState(out);
-}
-
-} // namespace impl
-} // namespace android::compositionengine
diff --git a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp
index 016084f..3e0f803 100644
--- a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp
@@ -32,6 +32,8 @@
} // namespace
+LayerFECompositionState::~LayerFECompositionState() = default;
+
void LayerFECompositionState::dump(std::string& out) const {
out.append(" ");
dumpVal(out, "isSecure", isSecure);
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 55371df..47704ec 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -20,7 +20,6 @@
#include <compositionengine/CompositionEngine.h>
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/DisplayColorProfile.h>
-#include <compositionengine/Layer.h>
#include <compositionengine/LayerFE.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/RenderSurface.h>
@@ -265,31 +264,26 @@
(!internalOnly || outputState.layerStackInternal);
}
-bool Output::belongsInOutput(const compositionengine::Layer* layer) const {
- if (!layer) {
- return false;
- }
-
- const auto& layerFEState = layer->getFEState();
- return belongsInOutput(layerFEState.layerStackId, layerFEState.internalOnly);
+bool Output::belongsInOutput(const sp<compositionengine::LayerFE>& layerFE) const {
+ const auto* layerFEState = layerFE->getCompositionState();
+ return layerFEState && belongsInOutput(layerFEState->layerStackId, layerFEState->internalOnly);
}
std::unique_ptr<compositionengine::OutputLayer> Output::createOutputLayer(
- const std::shared_ptr<compositionengine::Layer>& layer, const sp<LayerFE>& layerFE) const {
- return impl::createOutputLayer(*this, layer, layerFE);
+ const sp<LayerFE>& layerFE) const {
+ return impl::createOutputLayer(*this, layerFE);
}
-compositionengine::OutputLayer* Output::getOutputLayerForLayer(
- compositionengine::Layer* layer) const {
- auto index = findCurrentOutputLayerForLayer(layer);
+compositionengine::OutputLayer* Output::getOutputLayerForLayer(const sp<LayerFE>& layerFE) const {
+ auto index = findCurrentOutputLayerForLayer(layerFE);
return index ? getOutputLayerOrderedByZByIndex(*index) : nullptr;
}
std::optional<size_t> Output::findCurrentOutputLayerForLayer(
- compositionengine::Layer* layer) const {
+ const sp<compositionengine::LayerFE>& layer) const {
for (size_t i = 0; i < getOutputLayerCount(); i++) {
auto outputLayer = getOutputLayerOrderedByZByIndex(i);
- if (outputLayer && &outputLayer->getLayer() == layer) {
+ if (outputLayer && &outputLayer->getLayerFE() == layer.get()) {
return i;
}
}
@@ -352,7 +346,7 @@
// Evaluate the layers from front to back to determine what is visible. This
// also incrementally calculates the coverage information for each layer as
// well as the entire output.
- for (auto& layer : reversed(refreshArgs.layers)) {
+ for (auto layer : reversed(refreshArgs.layers)) {
// Incrementally process the coverage for each layer
ensureOutputLayerIfVisible(layer, coverage);
@@ -371,28 +365,29 @@
}
}
-void Output::ensureOutputLayerIfVisible(std::shared_ptr<compositionengine::Layer> layer,
+void Output::ensureOutputLayerIfVisible(sp<compositionengine::LayerFE>& layerFE,
compositionengine::Output::CoverageState& coverage) {
- // Note: Converts a wp<LayerFE> to a sp<LayerFE>
- auto layerFE = layer->getLayerFE();
- if (layerFE == nullptr) {
- return;
- }
-
// Ensure we have a snapshot of the basic geometry layer state. Limit the
// snapshots to once per frame for each candidate layer, as layers may
// appear on multiple outputs.
if (!coverage.latchedLayers.count(layerFE)) {
coverage.latchedLayers.insert(layerFE);
- layerFE->latchCompositionState(layer->editFEState(),
- compositionengine::LayerFE::StateSubset::BasicGeometry);
+ layerFE->prepareCompositionState(compositionengine::LayerFE::StateSubset::BasicGeometry);
}
- // Obtain a read-only reference to the front-end layer state
- const auto& layerFEState = layer->getFEState();
-
// Only consider the layers on the given layer stack
- if (!belongsInOutput(layer.get())) {
+ if (!belongsInOutput(layerFE)) {
+ return;
+ }
+
+ // Obtain a read-only pointer to the front-end layer state
+ const auto* layerFEState = layerFE->getCompositionState();
+ if (CC_UNLIKELY(!layerFEState)) {
+ return;
+ }
+
+ // handle hidden surfaces by setting the visible region to empty
+ if (CC_UNLIKELY(!layerFEState->isVisible)) {
return;
}
@@ -430,23 +425,18 @@
*/
Region shadowRegion;
- // handle hidden surfaces by setting the visible region to empty
- if (CC_UNLIKELY(!layerFEState.isVisible)) {
- return;
- }
-
- const ui::Transform& tr = layerFEState.geomLayerTransform;
+ const ui::Transform& tr = layerFEState->geomLayerTransform;
// Get the visible region
// TODO(b/121291683): Is it worth creating helper methods on LayerFEState
// for computations like this?
- const Rect visibleRect(tr.transform(layerFEState.geomLayerBounds));
+ const Rect visibleRect(tr.transform(layerFEState->geomLayerBounds));
visibleRegion.set(visibleRect);
- if (layerFEState.shadowRadius > 0.0f) {
+ if (layerFEState->shadowRadius > 0.0f) {
// if the layer casts a shadow, offset the layers visible region and
// calculate the shadow region.
- const auto inset = static_cast<int32_t>(ceilf(layerFEState.shadowRadius) * -1.0f);
+ const auto inset = static_cast<int32_t>(ceilf(layerFEState->shadowRadius) * -1.0f);
Rect visibleRectWithShadows(visibleRect);
visibleRectWithShadows.inset(inset, inset, inset, inset);
visibleRegion.set(visibleRectWithShadows);
@@ -458,10 +448,10 @@
}
// Remove the transparent area from the visible region
- if (!layerFEState.isOpaque) {
+ if (!layerFEState->isOpaque) {
if (tr.preserveRects()) {
// transform the transparent region
- transparentRegion = tr.transform(layerFEState.transparentRegionHint);
+ transparentRegion = tr.transform(layerFEState->transparentRegionHint);
} else {
// transformation too complex, can't do the
// transparent region optimization.
@@ -471,7 +461,7 @@
// compute the opaque region
const auto layerOrientation = tr.getOrientation();
- if (layerFEState.isOpaque && ((layerOrientation & ui::Transform::ROT_INVALID) == 0)) {
+ if (layerFEState->isOpaque && ((layerOrientation & ui::Transform::ROT_INVALID) == 0)) {
// If we one of the simple category of transforms (0/90/180/270 rotation
// + any flip), then the opaque region is the layer's footprint.
// Otherwise we don't try and compute the opaque region since there may
@@ -495,7 +485,7 @@
// Get coverage information for the layer as previously displayed,
// also taking over ownership from mOutputLayersorderedByZ.
- auto prevOutputLayerIndex = findCurrentOutputLayerForLayer(layer.get());
+ auto prevOutputLayerIndex = findCurrentOutputLayerForLayer(layerFE);
auto prevOutputLayer =
prevOutputLayerIndex ? getOutputLayerOrderedByZByIndex(*prevOutputLayerIndex) : nullptr;
@@ -509,7 +499,7 @@
// compute this layer's dirty region
Region dirty;
- if (layerFEState.contentDirty) {
+ if (layerFEState->contentDirty) {
// we need to invalidate the whole region
dirty = visibleRegion;
// as well, as the old visible region
@@ -556,7 +546,7 @@
// The layer is visible. Either reuse the existing outputLayer if we have
// one, or create a new one if we do not.
- auto result = ensureOutputLayer(prevOutputLayerIndex, layer, layerFE);
+ auto result = ensureOutputLayer(prevOutputLayerIndex, layerFE);
// Store the layer coverage information into the layer state as some of it
// is useful later.
@@ -575,10 +565,9 @@
void Output::updateLayerStateFromFE(const CompositionRefreshArgs& args) const {
for (auto* layer : getOutputLayersOrderedByZ()) {
- layer->getLayerFE().latchCompositionState(layer->getLayer().editFEState(),
- args.updatingGeometryThisFrame
- ? LayerFE::StateSubset::GeometryAndContent
- : LayerFE::StateSubset::Content);
+ layer->getLayerFE().prepareCompositionState(
+ args.updatingGeometryThisFrame ? LayerFE::StateSubset::GeometryAndContent
+ : LayerFE::StateSubset::Content);
}
}
@@ -611,7 +600,7 @@
compositionengine::OutputLayer* Output::findLayerRequestingBackgroundComposition() const {
compositionengine::OutputLayer* layerRequestingBgComposition = nullptr;
for (auto* layer : getOutputLayersOrderedByZ()) {
- if (layer->getLayer().getFEState().backgroundBlurRadius > 0) {
+ if (layer->getLayerFE().getCompositionState()->backgroundBlurRadius > 0) {
layerRequestingBgComposition = layer;
}
}
@@ -637,7 +626,7 @@
*outHdrDataSpace = ui::Dataspace::UNKNOWN;
for (const auto* layer : getOutputLayersOrderedByZ()) {
- switch (layer->getLayer().getFEState().dataspace) {
+ switch (layer->getLayerFE().getCompositionState()->dataspace) {
case ui::Dataspace::V0_SCRGB:
case ui::Dataspace::V0_SCRGB_LINEAR:
case ui::Dataspace::BT2020:
@@ -653,7 +642,8 @@
case ui::Dataspace::BT2020_ITU_PQ:
bestDataSpace = ui::Dataspace::DISPLAY_P3;
*outHdrDataSpace = ui::Dataspace::BT2020_PQ;
- *outIsHdrClientComposition = layer->getLayer().getFEState().forceClientComposition;
+ *outIsHdrClientComposition =
+ layer->getLayerFE().getCompositionState()->forceClientComposition;
break;
case ui::Dataspace::BT2020_HLG:
case ui::Dataspace::BT2020_ITU_HLG:
@@ -865,7 +855,7 @@
if (outputState.isSecure && supportsProtectedContent) {
auto layers = getOutputLayersOrderedByZ();
bool needsProtected = std::any_of(layers.begin(), layers.end(), [](auto* layer) {
- return layer->getLayer().getFEState().hasProtectedContent;
+ return layer->getLayerFE().getCompositionState()->hasProtectedContent;
});
if (needsProtected != renderEngine.isProtected()) {
renderEngine.useProtectedContext(needsProtected);
@@ -954,7 +944,7 @@
for (auto* layer : getOutputLayersOrderedByZ()) {
const auto& layerState = layer->getState();
- const auto& layerFEState = layer->getLayer().getFEState();
+ const auto* layerFEState = layer->getLayerFE().getCompositionState();
auto& layerFE = layer->getLayerFE();
const Region clip(viewportRegion.intersect(layerState.visibleRegion));
@@ -973,7 +963,7 @@
// underneath. We also skip the first layer as the buffer target is
// guaranteed to start out cleared.
bool clearClientComposition =
- layerState.clearClientTarget && layerFEState.isOpaque && !firstLayer;
+ layerState.clearClientTarget && layerFEState->isOpaque && !firstLayer;
ALOGV(" Composition type: client %d clear %d", clientComposition, clearClientComposition);
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index d92b7ef..b538d75 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -16,7 +16,6 @@
#include <android-base/stringprintf.h>
#include <compositionengine/DisplayColorProfile.h>
-#include <compositionengine/Layer.h>
#include <compositionengine/LayerFE.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/Output.h>
@@ -51,11 +50,9 @@
} // namespace
-std::unique_ptr<OutputLayer> createOutputLayer(
- const compositionengine::Output& output,
- const std::shared_ptr<compositionengine::Layer>& layer,
- const sp<compositionengine::LayerFE>& layerFE) {
- return createOutputLayerTemplated<OutputLayer>(output, layer, layerFE);
+std::unique_ptr<OutputLayer> createOutputLayer(const compositionengine::Output& output,
+ const sp<compositionengine::LayerFE>& layerFE) {
+ return createOutputLayerTemplated<OutputLayer>(output, layerFE);
}
OutputLayer::~OutputLayer() = default;
@@ -70,7 +67,7 @@
}
Rect OutputLayer::calculateInitialCrop() const {
- const auto& layerState = getLayer().getFEState();
+ const auto& layerState = *getLayerFE().getCompositionState();
// apply the projection's clipping to the window crop in
// layerstack space, and convert-back to layer space.
@@ -103,7 +100,7 @@
}
FloatRect OutputLayer::calculateOutputSourceCrop() const {
- const auto& layerState = getLayer().getFEState();
+ const auto& layerState = *getLayerFE().getCompositionState();
const auto& outputState = getOutput().getState();
if (!layerState.geomUsesSourceCrop) {
@@ -180,7 +177,7 @@
}
Rect OutputLayer::calculateOutputDisplayFrame() const {
- const auto& layerState = getLayer().getFEState();
+ const auto& layerState = *getLayerFE().getCompositionState();
const auto& outputState = getOutput().getState();
// apply the layer's transform, followed by the display's global transform
@@ -227,7 +224,7 @@
}
uint32_t OutputLayer::calculateOutputRelativeBufferTransform() const {
- const auto& layerState = getLayer().getFEState();
+ const auto& layerState = *getLayerFE().getCompositionState();
const auto& outputState = getOutput().getState();
/*
@@ -267,7 +264,11 @@
} // namespace impl
void OutputLayer::updateCompositionState(bool includeGeometry, bool forceClientComposition) {
- const auto& layerFEState = getLayer().getFEState();
+ const auto* layerFEState = getLayerFE().getCompositionState();
+ if (!layerFEState) {
+ return;
+ }
+
const auto& outputState = getOutput().getState();
const auto& profile = *getOutput().getDisplayColorProfile();
auto& state = editState();
@@ -285,7 +286,7 @@
state.bufferTransform =
static_cast<Hwc2::Transform>(calculateOutputRelativeBufferTransform());
- if ((layerFEState.isSecure && !outputState.isSecure) ||
+ if ((layerFEState->isSecure && !outputState.isSecure) ||
(state.bufferTransform & ui::Transform::ROT_INVALID)) {
state.forceClientComposition = true;
}
@@ -294,14 +295,14 @@
// Determine the output dependent dataspace for this layer. If it is
// colorspace agnostic, it just uses the dataspace chosen for the output to
// avoid the need for color conversion.
- state.dataspace = layerFEState.isColorspaceAgnostic &&
+ state.dataspace = layerFEState->isColorspaceAgnostic &&
outputState.targetDataspace != ui::Dataspace::UNKNOWN
? outputState.targetDataspace
- : layerFEState.dataspace;
+ : layerFEState->dataspace;
// These are evaluated every frame as they can potentially change at any
// time.
- if (layerFEState.forceClientComposition || !profile.isDataspaceSupported(state.dataspace) ||
+ if (layerFEState->forceClientComposition || !profile.isDataspaceSupported(state.dataspace) ||
forceClientComposition) {
state.forceClientComposition = true;
}
@@ -321,21 +322,25 @@
return;
}
- const auto& outputIndependentState = getLayer().getFEState();
- auto requestedCompositionType = outputIndependentState.compositionType;
+ const auto* outputIndependentState = getLayerFE().getCompositionState();
+ if (!outputIndependentState) {
+ return;
+ }
+
+ auto requestedCompositionType = outputIndependentState->compositionType;
if (includeGeometry) {
writeOutputDependentGeometryStateToHWC(hwcLayer.get(), requestedCompositionType);
- writeOutputIndependentGeometryStateToHWC(hwcLayer.get(), outputIndependentState);
+ writeOutputIndependentGeometryStateToHWC(hwcLayer.get(), *outputIndependentState);
}
writeOutputDependentPerFrameStateToHWC(hwcLayer.get());
- writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), outputIndependentState);
+ writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), *outputIndependentState);
writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType);
// Always set the layer color after setting the composition type.
- writeSolidColorStateToHWC(hwcLayer.get(), outputIndependentState);
+ writeSolidColorStateToHWC(hwcLayer.get(), *outputIndependentState);
}
void OutputLayer::writeOutputDependentGeometryStateToHWC(
@@ -546,10 +551,14 @@
return;
}
- const auto& layerFEState = getLayer().getFEState();
+ const auto* layerFEState = getLayerFE().getCompositionState();
+ if (!layerFEState) {
+ return;
+ }
+
const auto& outputState = getOutput().getState();
- Rect frame = layerFEState.cursorFrame;
+ Rect frame = layerFEState->cursorFrame;
frame.intersect(outputState.viewport, &frame);
Rect position = outputState.transform.transform(frame);
@@ -646,8 +655,7 @@
void OutputLayer::dump(std::string& out) const {
using android::base::StringAppendF;
- StringAppendF(&out, " - Output Layer %p (Composition layer %p) (%s)\n", this, &getLayer(),
- getLayerFE().getDebugName());
+ StringAppendF(&out, " - Output Layer %p(%s)\n", this, getLayerFE().getDebugName());
dumpState(out);
}