CE: Layers only have FE layer state
Remove the concept of having a compositionengine::Layer having internal
state since it was only used to internally store a copy of the
LayerFECompositionState. Instead switch the Layer interface so only the
FE state can be obtained. Any internal state will from now on be
private.
Doing this also allows the LayerFECompostionState to be easily extended
by extended versions of CompositionEngine.
Test: atest libsurfaceflinger_unittest libcompositionengine_test
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: 121291683
Change-Id: I689e8714aca46320c87e0cb5ef18fdde93eb7499
diff --git a/services/surfaceflinger/BufferLayer.cpp b/services/surfaceflinger/BufferLayer.cpp
index b060b04..fba235d 100644
--- a/services/surfaceflinger/BufferLayer.cpp
+++ b/services/surfaceflinger/BufferLayer.cpp
@@ -22,12 +22,10 @@
#include "BufferLayer.h"
#include <compositionengine/CompositionEngine.h>
-#include <compositionengine/Display.h>
#include <compositionengine/Layer.h>
#include <compositionengine/LayerCreationArgs.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/OutputLayer.h>
-#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <cutils/compiler.h>
#include <cutils/native_handle.h>
diff --git a/services/surfaceflinger/BufferQueueLayer.cpp b/services/surfaceflinger/BufferQueueLayer.cpp
index f2e861d..fcabedf 100644
--- a/services/surfaceflinger/BufferQueueLayer.cpp
+++ b/services/surfaceflinger/BufferQueueLayer.cpp
@@ -17,15 +17,13 @@
#undef LOG_TAG
#define LOG_TAG "BufferQueueLayer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
-#include <compositionengine/Display.h>
+#include "BufferQueueLayer.h"
+
#include <compositionengine/Layer.h>
-#include <compositionengine/OutputLayer.h>
-#include <compositionengine/impl/LayerCompositionState.h>
-#include <compositionengine/impl/OutputLayerCompositionState.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <gui/BufferQueueConsumer.h>
#include <system/window.h>
-#include "BufferQueueLayer.h"
#include "LayerRejecter.h"
#include "SurfaceInterceptor.h"
@@ -197,7 +195,7 @@
if (mSidebandStreamChanged.compare_exchange_strong(sidebandStreamChanged, false)) {
// mSidebandStreamChanged was changed to false
mSidebandStream = mConsumer->getSidebandStream();
- auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
+ auto& layerCompositionState = getCompositionLayer()->editFEState();
layerCompositionState.sidebandStream = mSidebandStream;
if (layerCompositionState.sidebandStream != nullptr) {
setTransactionFlags(eTransactionNeeded);
@@ -335,7 +333,7 @@
mPreviousBufferId = getCurrentBufferId();
mBufferInfo.mBuffer =
mConsumer->getCurrentBuffer(&mBufferInfo.mBufferSlot, &mBufferInfo.mFence);
- auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
+ auto& layerCompositionState = getCompositionLayer()->editFEState();
layerCompositionState.buffer = mBufferInfo.mBuffer;
if (mBufferInfo.mBuffer == nullptr) {
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index 509deaf..ad05bc8 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -19,18 +19,16 @@
#define LOG_TAG "BufferStateLayer"
#define ATRACE_TAG ATRACE_TAG_GRAPHICS
+#include "BufferStateLayer.h"
+
#include <limits>
-#include <compositionengine/Display.h>
#include <compositionengine/Layer.h>
-#include <compositionengine/OutputLayer.h>
-#include <compositionengine/impl/LayerCompositionState.h>
-#include <compositionengine/impl/OutputLayerCompositionState.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <gui/BufferQueue.h>
#include <private/gui/SyncFeatures.h>
#include <renderengine/Image.h>
-#include "BufferStateLayer.h"
#include "ColorLayer.h"
#include "FrameTracer/FrameTracer.h"
#include "TimeStats/TimeStats.h"
@@ -415,7 +413,7 @@
// mSidebandStreamChanged was true
LOG_ALWAYS_FATAL_IF(!getCompositionLayer());
mSidebandStream = s.sidebandStream;
- getCompositionLayer()->editState().frontEnd.sidebandStream = mSidebandStream;
+ getCompositionLayer()->editFEState().sidebandStream = mSidebandStream;
if (mSidebandStream != nullptr) {
setTransactionFlags(eTransactionNeeded);
mFlinger->setTransactionFlags(eTraversalNeeded);
@@ -520,7 +518,7 @@
mPreviousBufferId = getCurrentBufferId();
mBufferInfo.mBuffer = s.buffer;
mBufferInfo.mFence = s.acquireFence;
- auto& layerCompositionState = getCompositionLayer()->editState().frontEnd;
+ auto& layerCompositionState = getCompositionLayer()->editFEState();
layerCompositionState.buffer = mBufferInfo.mBuffer;
return NO_ERROR;
diff --git a/services/surfaceflinger/ColorLayer.cpp b/services/surfaceflinger/ColorLayer.cpp
index 49b1810..99805d9 100644
--- a/services/surfaceflinger/ColorLayer.cpp
+++ b/services/surfaceflinger/ColorLayer.cpp
@@ -25,13 +25,9 @@
#include <sys/types.h>
#include <compositionengine/CompositionEngine.h>
-#include <compositionengine/Display.h>
#include <compositionengine/Layer.h>
#include <compositionengine/LayerCreationArgs.h>
#include <compositionengine/LayerFECompositionState.h>
-#include <compositionengine/OutputLayer.h>
-#include <compositionengine/impl/LayerCompositionState.h>
-#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <renderengine/RenderEngine.h>
#include <ui/GraphicBuffer.h>
#include <utils/Errors.h>
diff --git a/services/surfaceflinger/CompositionEngine/Android.bp b/services/surfaceflinger/CompositionEngine/Android.bp
index e49b65f..fcb94fd 100644
--- a/services/surfaceflinger/CompositionEngine/Android.bp
+++ b/services/surfaceflinger/CompositionEngine/Android.bp
@@ -47,7 +47,7 @@
"src/DumpHelpers.cpp",
"src/HwcBufferCache.cpp",
"src/Layer.cpp",
- "src/LayerCompositionState.cpp",
+ "src/LayerFECompositionState.cpp",
"src/Output.cpp",
"src/OutputCompositionState.cpp",
"src/OutputLayer.cpp",
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/Layer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/Layer.h
index 451608b..1259c52 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/Layer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/Layer.h
@@ -26,9 +26,7 @@
class Display;
class LayerFE;
-namespace impl {
-struct LayerCompositionState;
-} // namespace impl
+struct LayerFECompositionState;
/**
* A layer contains the output-independent composition state for a front-end
@@ -42,17 +40,13 @@
// front-end layer no longer exists.
virtual sp<LayerFE> getLayerFE() const = 0;
- using CompositionState = impl::LayerCompositionState;
-
- // Gets the raw composition state data for the layer
+ // Gets the raw front-end composition state data for the layer
// TODO(lpique): Make this protected once it is only internally called.
- virtual const CompositionState& getState() const = 0;
+ virtual const LayerFECompositionState& getFEState() const = 0;
- // Allows mutable access to the raw composition state data for the layer.
- // This is meant to be used by the various functions that are part of the
- // composition process.
+ // Allows mutable access to the raw front-end composition state
// TODO(lpique): Make this protected once it is only internally called.
- virtual CompositionState& editState() = 0;
+ virtual LayerFECompositionState& editFEState() = 0;
// Debugging
virtual void dump(std::string& result) const = 0;
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h
index 530f49a..2ba781d 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFECompositionState.h
@@ -147,6 +147,9 @@
// The output-independent frame for the cursor
Rect cursorFrame;
+
+ // Debugging
+ void dump(std::string& out) const;
};
} // namespace android::compositionengine
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Layer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Layer.h
index 3e56b21..d441c9c 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Layer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/Layer.h
@@ -19,7 +19,7 @@
#include <memory>
#include <compositionengine/Layer.h>
-#include <compositionengine/impl/LayerCompositionState.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <utils/RefBase.h>
#include <utils/StrongPointer.h>
@@ -41,8 +41,8 @@
sp<LayerFE> getLayerFE() const override;
- const LayerCompositionState& getState() const override;
- LayerCompositionState& editState() override;
+ const LayerFECompositionState& getFEState() const override;
+ LayerFECompositionState& editFEState() override;
void dump(std::string& result) const override;
@@ -50,7 +50,8 @@
const compositionengine::CompositionEngine& mCompositionEngine;
const wp<LayerFE> mLayerFE;
- LayerCompositionState mState;
+ // State obtained from calls to LayerFE::getCompositionState
+ LayerFECompositionState mFrontEndState;
};
std::shared_ptr<compositionengine::Layer> createLayer(const compositionengine::CompositionEngine&,
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/LayerCompositionState.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/LayerCompositionState.h
deleted file mode 100644
index 726c850..0000000
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/impl/LayerCompositionState.h
+++ /dev/null
@@ -1,42 +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.
- */
-
-#pragma once
-
-#include <cstdint>
-#include <string>
-
-#include <compositionengine/LayerFECompositionState.h>
-#include <renderengine/Mesh.h>
-#include <ui/Region.h>
-
-namespace android {
-
-namespace compositionengine::impl {
-
-struct LayerCompositionState {
- /*
- * State set by LayerFE::getCompositionState
- */
-
- LayerFECompositionState frontEnd;
-
- // Debugging
- void dump(std::string& result) const;
-};
-
-} // namespace compositionengine::impl
-} // namespace android
diff --git a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/Layer.h b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/Layer.h
index cce3b97..4f03cb4 100644
--- a/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/Layer.h
+++ b/services/surfaceflinger/CompositionEngine/include/compositionengine/mock/Layer.h
@@ -18,7 +18,7 @@
#include <compositionengine/Layer.h>
#include <compositionengine/LayerFE.h>
-#include <compositionengine/impl/LayerCompositionState.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <gmock/gmock.h>
namespace android::compositionengine::mock {
@@ -30,8 +30,8 @@
MOCK_CONST_METHOD0(getLayerFE, sp<LayerFE>());
- MOCK_CONST_METHOD0(getState, const CompositionState&());
- MOCK_METHOD0(editState, CompositionState&());
+ MOCK_CONST_METHOD0(getFEState, const LayerFECompositionState&());
+ MOCK_METHOD0(editFEState, LayerFECompositionState&());
MOCK_CONST_METHOD1(dump, void(std::string&));
};
diff --git a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
index 713266f..8391458 100644
--- a/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/CompositionEngine.cpp
@@ -103,8 +103,8 @@
for (auto& layer : output->getOutputLayersOrderedByZ()) {
if (layer->isHardwareCursor()) {
// Latch the cursor composition state from each front-end layer.
- layer->getLayerFE().latchCursorCompositionState(
- layer->getLayer().editState().frontEnd);
+ layer->getLayerFE().latchCursorCompositionState(layer->getLayer().editFEState());
+
layer->writeCursorPositionToHWC();
}
}
diff --git a/services/surfaceflinger/CompositionEngine/src/Layer.cpp b/services/surfaceflinger/CompositionEngine/src/Layer.cpp
index 96e9731..8a1cbe4 100644
--- a/services/surfaceflinger/CompositionEngine/src/Layer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Layer.cpp
@@ -43,19 +43,21 @@
return mLayerFE.promote();
}
-const LayerCompositionState& Layer::getState() const {
- return mState;
+const compositionengine::LayerFECompositionState& Layer::getFEState() const {
+ return mFrontEndState;
}
-LayerCompositionState& Layer::editState() {
- return mState;
+compositionengine::LayerFECompositionState& Layer::editFEState() {
+ return mFrontEndState;
}
void Layer::dump(std::string& out) const {
auto layerFE = getLayerFE();
android::base::StringAppendF(&out, "* compositionengine::Layer %p (%s)\n", this,
layerFE ? layerFE->getDebugName() : "<unknown>");
- mState.dump(out);
+
+ out.append(" frontend:\n");
+ mFrontEndState.dump(out);
}
} // namespace impl
diff --git a/services/surfaceflinger/CompositionEngine/src/LayerCompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/LayerCompositionState.cpp
deleted file mode 100644
index c5debf6..0000000
--- a/services/surfaceflinger/CompositionEngine/src/LayerCompositionState.cpp
+++ /dev/null
@@ -1,91 +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/impl/DumpHelpers.h>
-#include <compositionengine/impl/LayerCompositionState.h>
-
-namespace android::compositionengine::impl {
-
-namespace {
-
-using android::compositionengine::impl::dumpVal;
-
-void dumpVal(std::string& out, const char* name, half4 value) {
- using android::base::StringAppendF;
- StringAppendF(&out, "%s=[%f %f %f] ", name, static_cast<float>(value.r),
- static_cast<float>(value.g), static_cast<float>(value.b));
-}
-
-void dumpFrontEnd(std::string& out, const LayerFECompositionState& state) {
- out.append(" ");
- dumpVal(out, "isSecure", state.isSecure);
- dumpVal(out, "geomUsesSourceCrop", state.geomUsesSourceCrop);
- dumpVal(out, "geomBufferUsesDisplayInverseTransform",
- state.geomBufferUsesDisplayInverseTransform);
- dumpVal(out, "geomLayerTransform", state.geomLayerTransform);
-
- out.append("\n ");
- dumpVal(out, "geomBufferSize", state.geomBufferSize);
- dumpVal(out, "geomContentCrop", state.geomContentCrop);
- dumpVal(out, "geomCrop", state.geomCrop);
- dumpVal(out, "geomBufferTransform", state.geomBufferTransform);
-
- out.append("\n ");
- dumpVal(out, "transparentRegionHint", state.transparentRegionHint);
-
- out.append(" ");
- dumpVal(out, "geomLayerBounds", state.geomLayerBounds);
-
- out.append("\n ");
- dumpVal(out, "blend", toString(state.blendMode), state.blendMode);
- dumpVal(out, "alpha", state.alpha);
-
- out.append("\n ");
- dumpVal(out, "type", state.type);
- dumpVal(out, "appId", state.appId);
-
- dumpVal(out, "composition type", toString(state.compositionType), state.compositionType);
-
- out.append("\n buffer: ");
- dumpVal(out, "bufferSlot", state.bufferSlot);
- dumpVal(out, "buffer", state.buffer.get());
-
- out.append("\n ");
- dumpVal(out, "sideband stream", state.sidebandStream.get());
-
- out.append("\n ");
- dumpVal(out, "color", state.color);
-
- out.append("\n ");
- dumpVal(out, "isOpaque", state.isOpaque);
- dumpVal(out, "hasProtectedContent", state.hasProtectedContent);
- dumpVal(out, "isColorspaceAgnostic", state.isColorspaceAgnostic);
- dumpVal(out, "dataspace", toString(state.dataspace), state.dataspace);
- dumpVal(out, "hdr metadata types", state.hdrMetadata.validTypes);
- dumpVal(out, "colorTransform", state.colorTransform);
-
- out.append("\n");
-}
-
-} // namespace
-
-void LayerCompositionState::dump(std::string& out) const {
- out.append(" frontend:\n");
- dumpFrontEnd(out, frontEnd);
-}
-
-} // namespace android::compositionengine::impl
diff --git a/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp
new file mode 100644
index 0000000..1ca03dc
--- /dev/null
+++ b/services/surfaceflinger/CompositionEngine/src/LayerFECompositionState.cpp
@@ -0,0 +1,85 @@
+/*
+ * 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/LayerFECompositionState.h>
+#include <compositionengine/impl/DumpHelpers.h>
+
+namespace android::compositionengine {
+
+namespace {
+
+using android::compositionengine::impl::dumpVal;
+
+void dumpVal(std::string& out, const char* name, half4 value) {
+ using android::base::StringAppendF;
+ StringAppendF(&out, "%s=[%f %f %f] ", name, static_cast<float>(value.r),
+ static_cast<float>(value.g), static_cast<float>(value.b));
+}
+
+} // namespace
+
+void LayerFECompositionState::dump(std::string& out) const {
+ out.append(" ");
+ dumpVal(out, "isSecure", isSecure);
+ dumpVal(out, "geomUsesSourceCrop", geomUsesSourceCrop);
+ dumpVal(out, "geomBufferUsesDisplayInverseTransform", geomBufferUsesDisplayInverseTransform);
+ dumpVal(out, "geomLayerTransform", geomLayerTransform);
+
+ out.append("\n ");
+ dumpVal(out, "geomBufferSize", geomBufferSize);
+ dumpVal(out, "geomContentCrop", geomContentCrop);
+ dumpVal(out, "geomCrop", geomCrop);
+ dumpVal(out, "geomBufferTransform", geomBufferTransform);
+
+ out.append("\n ");
+ dumpVal(out, "transparentRegionHint", transparentRegionHint);
+
+ out.append(" ");
+ dumpVal(out, "geomLayerBounds", geomLayerBounds);
+
+ out.append("\n ");
+ dumpVal(out, "blend", toString(blendMode), blendMode);
+ dumpVal(out, "alpha", alpha);
+
+ out.append("\n ");
+ dumpVal(out, "type", type);
+ dumpVal(out, "appId", appId);
+
+ dumpVal(out, "composition type", toString(compositionType), compositionType);
+
+ out.append("\n buffer: ");
+ dumpVal(out, "slot", bufferSlot);
+ dumpVal(out, "buffer", buffer.get());
+
+ out.append("\n ");
+ dumpVal(out, "sideband stream", sidebandStream.get());
+
+ out.append("\n ");
+ dumpVal(out, "color", color);
+
+ out.append("\n ");
+ dumpVal(out, "isOpaque", isOpaque);
+ dumpVal(out, "hasProtectedContent", hasProtectedContent);
+ dumpVal(out, "isColorspaceAgnostic", isColorspaceAgnostic);
+ dumpVal(out, "dataspace", toString(dataspace), dataspace);
+ dumpVal(out, "hdr metadata types", hdrMetadata.validTypes);
+ dumpVal(out, "colorTransform", colorTransform);
+
+ out.append("\n");
+}
+
+} // namespace android::compositionengine
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 83df628..02ebc1f 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -22,8 +22,8 @@
#include <compositionengine/DisplayColorProfile.h>
#include <compositionengine/Layer.h>
#include <compositionengine/LayerFE.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/RenderSurface.h>
-#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/Output.h>
#include <compositionengine/impl/OutputLayer.h>
#include <renderengine/DisplaySettings.h>
@@ -249,7 +249,7 @@
return false;
}
- const auto& layerFEState = layer->getState().frontEnd;
+ const auto& layerFEState = layer->getFEState();
return belongsInOutput(layerFEState.layerStackId, layerFEState.internalOnly);
}
@@ -400,12 +400,12 @@
// appear on multiple outputs.
if (!coverage.latchedLayers.count(layerFE)) {
coverage.latchedLayers.insert(layerFE);
- layerFE->latchCompositionState(layer->editState().frontEnd,
+ layerFE->latchCompositionState(layer->editFEState(),
compositionengine::LayerFE::StateSubset::BasicGeometry);
}
// Obtain a read-only reference to the front-end layer state
- const auto& layerFEState = layer->getState().frontEnd;
+ const auto& layerFEState = layer->getFEState();
// Only consider the layers on the given layer stack
if (!belongsInOutput(layer.get())) {
@@ -572,7 +572,7 @@
void Output::updateLayerStateFromFE(const CompositionRefreshArgs& args) const {
for (auto& layer : mOutputLayersOrderedByZ) {
- layer->getLayerFE().latchCompositionState(layer->getLayer().editState().frontEnd,
+ layer->getLayerFE().latchCompositionState(layer->getLayer().editFEState(),
args.updatingGeometryThisFrame
? LayerFE::StateSubset::GeometryAndContent
: LayerFE::StateSubset::Content);
@@ -615,7 +615,7 @@
*outHdrDataSpace = ui::Dataspace::UNKNOWN;
for (const auto& layer : mOutputLayersOrderedByZ) {
- switch (layer->getLayer().getState().frontEnd.dataspace) {
+ switch (layer->getLayer().getFEState().dataspace) {
case ui::Dataspace::V0_SCRGB:
case ui::Dataspace::V0_SCRGB_LINEAR:
case ui::Dataspace::BT2020:
@@ -631,8 +631,7 @@
case ui::Dataspace::BT2020_ITU_PQ:
bestDataSpace = ui::Dataspace::DISPLAY_P3;
*outHdrDataSpace = ui::Dataspace::BT2020_PQ;
- *outIsHdrClientComposition =
- layer->getLayer().getState().frontEnd.forceClientComposition;
+ *outIsHdrClientComposition = layer->getLayer().getFEState().forceClientComposition;
break;
case ui::Dataspace::BT2020_HLG:
case ui::Dataspace::BT2020_ITU_HLG:
@@ -838,7 +837,7 @@
bool needsProtected =
std::any_of(mOutputLayersOrderedByZ.begin(), mOutputLayersOrderedByZ.end(),
[](auto& layer) {
- return layer->getLayer().getState().frontEnd.hasProtectedContent;
+ return layer->getLayer().getFEState().hasProtectedContent;
});
if (needsProtected != renderEngine.isProtected()) {
renderEngine.useProtectedContext(needsProtected);
@@ -892,7 +891,7 @@
for (auto& layer : mOutputLayersOrderedByZ) {
const auto& layerState = layer->getState();
- const auto& layerFEState = layer->getLayer().getState().frontEnd;
+ const auto& layerFEState = layer->getLayer().getFEState();
auto& layerFE = layer->getLayerFE();
const Region clip(viewportRegion.intersect(layerState.visibleRegion));
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 4eb256f..2e45953 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -18,8 +18,8 @@
#include <compositionengine/DisplayColorProfile.h>
#include <compositionengine/Layer.h>
#include <compositionengine/LayerFE.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/Output.h>
-#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/OutputCompositionState.h>
#include <compositionengine/impl/OutputLayer.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
@@ -86,7 +86,7 @@
}
Rect OutputLayer::calculateInitialCrop() const {
- const auto& layerState = mLayer->getState().frontEnd;
+ const auto& layerState = mLayer->getFEState();
// apply the projection's clipping to the window crop in
// layerstack space, and convert-back to layer space.
@@ -119,7 +119,7 @@
}
FloatRect OutputLayer::calculateOutputSourceCrop() const {
- const auto& layerState = mLayer->getState().frontEnd;
+ const auto& layerState = mLayer->getFEState();
const auto& outputState = mOutput.getState();
if (!layerState.geomUsesSourceCrop) {
@@ -196,7 +196,7 @@
}
Rect OutputLayer::calculateOutputDisplayFrame() const {
- const auto& layerState = mLayer->getState().frontEnd;
+ const auto& layerState = mLayer->getFEState();
const auto& outputState = mOutput.getState();
// apply the layer's transform, followed by the display's global transform
@@ -243,7 +243,7 @@
}
uint32_t OutputLayer::calculateOutputRelativeBufferTransform() const {
- const auto& layerState = mLayer->getState().frontEnd;
+ const auto& layerState = mLayer->getFEState();
const auto& outputState = mOutput.getState();
/*
@@ -283,7 +283,7 @@
} // namespace impl
void OutputLayer::updateCompositionState(bool includeGeometry) {
- const auto& layerFEState = mLayer->getState().frontEnd;
+ const auto& layerFEState = mLayer->getFEState();
const auto& outputState = mOutput.getState();
const auto& profile = *mOutput.getDisplayColorProfile();
@@ -327,7 +327,7 @@
return;
}
- const auto& outputIndependentState = mLayer->getState().frontEnd;
+ const auto& outputIndependentState = mLayer->getFEState();
auto requestedCompositionType = outputIndependentState.compositionType;
if (includeGeometry) {
@@ -544,7 +544,7 @@
return;
}
- const auto& layerFEState = mLayer->getState().frontEnd;
+ const auto& layerFEState = mLayer->getFEState();
const auto& outputState = mOutput.getState();
Rect frame = layerFEState.cursorFrame;
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
index b73c47b..88cedfa 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp
@@ -59,7 +59,7 @@
EXPECT_CALL(*mLayerFE, getDebugName()).WillRepeatedly(Return("Test LayerFE"));
EXPECT_CALL(mOutput, getName()).WillRepeatedly(ReturnRef(kOutputName));
- EXPECT_CALL(*mLayer, getState()).WillRepeatedly(ReturnRef(mLayerState));
+ EXPECT_CALL(*mLayer, getFEState()).WillRepeatedly(ReturnRef(mLayerFEState));
EXPECT_CALL(mOutput, getState()).WillRepeatedly(ReturnRef(mOutputState));
}
@@ -70,7 +70,7 @@
new StrictMock<compositionengine::mock::LayerFE>()};
impl::OutputLayer mOutputLayer{mOutput, mLayer, mLayerFE};
- impl::LayerCompositionState mLayerState;
+ LayerFECompositionState mLayerFEState;
impl::OutputCompositionState mOutputState;
};
@@ -112,27 +112,26 @@
OutputLayerSourceCropTest() {
// Set reasonable default values for a simple case. Each test will
// set one specific value to something different.
- mLayerState.frontEnd.geomUsesSourceCrop = true;
- mLayerState.frontEnd.geomContentCrop = Rect{0, 0, 1920, 1080};
- mLayerState.frontEnd.transparentRegionHint = Region{};
- mLayerState.frontEnd.geomLayerBounds = FloatRect{0.f, 0.f, 1920.f, 1080.f};
- mLayerState.frontEnd.geomLayerTransform = ui::Transform{TR_IDENT};
- mLayerState.frontEnd.geomBufferSize = Rect{0, 0, 1920, 1080};
- mLayerState.frontEnd.geomBufferTransform = TR_IDENT;
+ mLayerFEState.geomUsesSourceCrop = true;
+ mLayerFEState.geomContentCrop = Rect{0, 0, 1920, 1080};
+ mLayerFEState.transparentRegionHint = Region{};
+ mLayerFEState.geomLayerBounds = FloatRect{0.f, 0.f, 1920.f, 1080.f};
+ mLayerFEState.geomLayerTransform = ui::Transform{TR_IDENT};
+ mLayerFEState.geomBufferSize = Rect{0, 0, 1920, 1080};
+ mLayerFEState.geomBufferTransform = TR_IDENT;
mOutputState.viewport = Rect{0, 0, 1920, 1080};
}
FloatRect calculateOutputSourceCrop() {
- mLayerState.frontEnd.geomInverseLayerTransform =
- mLayerState.frontEnd.geomLayerTransform.inverse();
+ mLayerFEState.geomInverseLayerTransform = mLayerFEState.geomLayerTransform.inverse();
return mOutputLayer.calculateOutputSourceCrop();
}
};
TEST_F(OutputLayerSourceCropTest, computesEmptyIfSourceCropNotUsed) {
- mLayerState.frontEnd.geomUsesSourceCrop = false;
+ mLayerFEState.geomUsesSourceCrop = false;
const FloatRect expected{};
EXPECT_THAT(calculateOutputSourceCrop(), FloatRectEq(expected));
@@ -144,15 +143,15 @@
}
TEST_F(OutputLayerSourceCropTest, handlesBoundsOutsideViewport) {
- mLayerState.frontEnd.geomLayerBounds = FloatRect{-2000.f, -2000.f, 2000.f, 2000.f};
+ mLayerFEState.geomLayerBounds = FloatRect{-2000.f, -2000.f, 2000.f, 2000.f};
const FloatRect expected{0.f, 0.f, 1920.f, 1080.f};
EXPECT_THAT(calculateOutputSourceCrop(), FloatRectEq(expected));
}
TEST_F(OutputLayerSourceCropTest, handlesBoundsOutsideViewportRotated) {
- mLayerState.frontEnd.geomLayerBounds = FloatRect{-2000.f, -2000.f, 2000.f, 2000.f};
- mLayerState.frontEnd.geomLayerTransform.set(HAL_TRANSFORM_ROT_90, 1920, 1080);
+ mLayerFEState.geomLayerBounds = FloatRect{-2000.f, -2000.f, 2000.f, 2000.f};
+ mLayerFEState.geomLayerTransform.set(HAL_TRANSFORM_ROT_90, 1920, 1080);
const FloatRect expected{0.f, 0.f, 1080.f, 1080.f};
EXPECT_THAT(calculateOutputSourceCrop(), FloatRectEq(expected));
@@ -190,8 +189,8 @@
for (size_t i = 0; i < testData.size(); i++) {
const auto& entry = testData[i];
- mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = entry.bufferInvDisplay;
- mLayerState.frontEnd.geomBufferTransform = entry.buffer;
+ mLayerFEState.geomBufferUsesDisplayInverseTransform = entry.bufferInvDisplay;
+ mLayerFEState.geomBufferTransform = entry.buffer;
mOutputState.orientation = entry.display;
EXPECT_THAT(calculateOutputSourceCrop(), FloatRectEq(entry.expected)) << "entry " << i;
@@ -199,7 +198,7 @@
}
TEST_F(OutputLayerSourceCropTest, geomContentCropAffectsCrop) {
- mLayerState.frontEnd.geomContentCrop = Rect{0, 0, 960, 540};
+ mLayerFEState.geomContentCrop = Rect{0, 0, 960, 540};
const FloatRect expected{0.f, 0.f, 960.f, 540.f};
EXPECT_THAT(calculateOutputSourceCrop(), FloatRectEq(expected));
@@ -221,20 +220,19 @@
// Set reasonable default values for a simple case. Each test will
// set one specific value to something different.
- mLayerState.frontEnd.transparentRegionHint = Region{};
- mLayerState.frontEnd.geomLayerTransform = ui::Transform{TR_IDENT};
- mLayerState.frontEnd.geomBufferSize = Rect{0, 0, 1920, 1080};
- mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = false;
- mLayerState.frontEnd.geomCrop = Rect{0, 0, 1920, 1080};
- mLayerState.frontEnd.geomLayerBounds = FloatRect{0.f, 0.f, 1920.f, 1080.f};
+ mLayerFEState.transparentRegionHint = Region{};
+ mLayerFEState.geomLayerTransform = ui::Transform{TR_IDENT};
+ mLayerFEState.geomBufferSize = Rect{0, 0, 1920, 1080};
+ mLayerFEState.geomBufferUsesDisplayInverseTransform = false;
+ mLayerFEState.geomCrop = Rect{0, 0, 1920, 1080};
+ mLayerFEState.geomLayerBounds = FloatRect{0.f, 0.f, 1920.f, 1080.f};
mOutputState.viewport = Rect{0, 0, 1920, 1080};
mOutputState.transform = ui::Transform{TR_IDENT};
}
Rect calculateOutputDisplayFrame() {
- mLayerState.frontEnd.geomInverseLayerTransform =
- mLayerState.frontEnd.geomLayerTransform.inverse();
+ mLayerFEState.geomInverseLayerTransform = mLayerFEState.geomLayerTransform.inverse();
return mOutputLayer.calculateOutputDisplayFrame();
}
@@ -246,32 +244,32 @@
}
TEST_F(OutputLayerDisplayFrameTest, fullActiveTransparentRegionReturnsEmptyFrame) {
- mLayerState.frontEnd.transparentRegionHint = Region{Rect{0, 0, 1920, 1080}};
+ mLayerFEState.transparentRegionHint = Region{Rect{0, 0, 1920, 1080}};
const Rect expected{0, 0, 0, 0};
EXPECT_THAT(calculateOutputDisplayFrame(), RectEq(expected));
}
TEST_F(OutputLayerDisplayFrameTest, cropAffectsDisplayFrame) {
- mLayerState.frontEnd.geomCrop = Rect{100, 200, 300, 500};
+ mLayerFEState.geomCrop = Rect{100, 200, 300, 500};
const Rect expected{100, 200, 300, 500};
EXPECT_THAT(calculateOutputDisplayFrame(), RectEq(expected));
}
TEST_F(OutputLayerDisplayFrameTest, cropAffectsDisplayFrameRotated) {
- mLayerState.frontEnd.geomCrop = Rect{100, 200, 300, 500};
- mLayerState.frontEnd.geomLayerTransform.set(HAL_TRANSFORM_ROT_90, 1920, 1080);
+ mLayerFEState.geomCrop = Rect{100, 200, 300, 500};
+ mLayerFEState.geomLayerTransform.set(HAL_TRANSFORM_ROT_90, 1920, 1080);
const Rect expected{1420, 100, 1720, 300};
EXPECT_THAT(calculateOutputDisplayFrame(), RectEq(expected));
}
TEST_F(OutputLayerDisplayFrameTest, emptyGeomCropIsNotUsedToComputeFrame) {
- mLayerState.frontEnd.geomCrop = Rect{};
+ mLayerFEState.geomCrop = Rect{};
const Rect expected{0, 0, 1920, 1080};
EXPECT_THAT(calculateOutputDisplayFrame(), RectEq(expected));
}
TEST_F(OutputLayerDisplayFrameTest, geomLayerBoundsAffectsFrame) {
- mLayerState.frontEnd.geomLayerBounds = FloatRect{0.f, 0.f, 960.f, 540.f};
+ mLayerFEState.geomLayerBounds = FloatRect{0.f, 0.f, 960.f, 540.f};
const Rect expected{0, 0, 960, 540};
EXPECT_THAT(calculateOutputDisplayFrame(), RectEq(expected));
}
@@ -293,7 +291,7 @@
*/
TEST_F(OutputLayerTest, calculateOutputRelativeBufferTransformTestsNeeded) {
- mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = false;
+ mLayerFEState.geomBufferUsesDisplayInverseTransform = false;
struct Entry {
uint32_t layer;
@@ -340,8 +338,8 @@
for (size_t i = 0; i < testData.size(); i++) {
const auto& entry = testData[i];
- mLayerState.frontEnd.geomLayerTransform.set(entry.layer, 1920, 1080);
- mLayerState.frontEnd.geomBufferTransform = entry.buffer;
+ mLayerFEState.geomLayerTransform.set(entry.layer, 1920, 1080);
+ mLayerFEState.geomBufferTransform = entry.buffer;
mOutputState.orientation = entry.display;
auto actual = mOutputLayer.calculateOutputRelativeBufferTransform();
@@ -351,7 +349,7 @@
TEST_F(OutputLayerTest,
calculateOutputRelativeBufferTransformTestWithOfBufferUsesDisplayInverseTransform) {
- mLayerState.frontEnd.geomBufferUsesDisplayInverseTransform = true;
+ mLayerFEState.geomBufferUsesDisplayInverseTransform = true;
struct Entry {
uint32_t layer;
@@ -398,8 +396,8 @@
for (size_t i = 0; i < testData.size(); i++) {
const auto& entry = testData[i];
- mLayerState.frontEnd.geomLayerTransform = ui::Transform{entry.layer};
- mLayerState.frontEnd.geomBufferTransform = entry.buffer;
+ mLayerFEState.geomLayerTransform = ui::Transform{entry.layer};
+ mLayerFEState.geomBufferTransform = entry.buffer;
mOutputState.orientation = entry.display;
auto actual = mOutputLayer.calculateOutputRelativeBufferTransform();
@@ -425,7 +423,7 @@
struct OutputLayerUpdateCompositionStateTest : public OutputLayerTest {
public:
OutputLayerUpdateCompositionStateTest() {
- EXPECT_CALL(*mLayer, getState()).WillRepeatedly(ReturnRef(mLayerState));
+ EXPECT_CALL(*mLayer, getFEState()).WillRepeatedly(ReturnRef(mLayerFEState));
EXPECT_CALL(mOutput, getState()).WillRepeatedly(ReturnRef(mOutputState));
EXPECT_CALL(mOutput, getDisplayColorProfile())
.WillRepeatedly(Return(&mDisplayColorProfile));
@@ -458,7 +456,7 @@
};
TEST_F(OutputLayerUpdateCompositionStateTest, setsStateNormally) {
- mLayerState.frontEnd.isSecure = true;
+ mLayerFEState.isSecure = true;
mOutputState.isSecure = true;
setupGeometryChildCallValues();
@@ -472,7 +470,7 @@
TEST_F(OutputLayerUpdateCompositionStateTest,
alsoSetsForceCompositionIfSecureLayerOnNonsecureOutput) {
- mLayerState.frontEnd.isSecure = true;
+ mLayerFEState.isSecure = true;
mOutputState.isSecure = false;
setupGeometryChildCallValues();
@@ -486,7 +484,7 @@
TEST_F(OutputLayerUpdateCompositionStateTest,
alsoSetsForceCompositionIfUnsupportedBufferTransform) {
- mLayerState.frontEnd.isSecure = true;
+ mLayerFEState.isSecure = true;
mOutputState.isSecure = true;
mBufferTransform = ui::Transform::ROT_INVALID;
@@ -501,12 +499,12 @@
}
TEST_F(OutputLayerUpdateCompositionStateTest, setsOutputLayerColorspaceCorrectly) {
- mLayerState.frontEnd.dataspace = ui::Dataspace::DISPLAY_P3;
+ mLayerFEState.dataspace = ui::Dataspace::DISPLAY_P3;
mOutputState.targetDataspace = ui::Dataspace::V0_SCRGB;
// If the layer is not colorspace agnostic, the output layer dataspace
// should use the layers requested colorspace.
- mLayerState.frontEnd.isColorspaceAgnostic = false;
+ mLayerFEState.isColorspaceAgnostic = false;
mOutputLayer.updateCompositionState(false);
@@ -514,7 +512,7 @@
// If the layer is colorspace agnostic, the output layer dataspace
// should use the colorspace chosen for the whole output.
- mLayerState.frontEnd.isColorspaceAgnostic = true;
+ mLayerFEState.isColorspaceAgnostic = true;
mOutputLayer.updateCompositionState(false);
@@ -528,7 +526,7 @@
}
TEST_F(OutputLayerUpdateCompositionStateTest, clientCompositionForcedFromFrontEndFlagAtAnyTime) {
- mLayerState.frontEnd.forceClientComposition = true;
+ mLayerFEState.forceClientComposition = true;
mOutputLayer.updateCompositionState(false);
@@ -583,18 +581,18 @@
outputLayerState.outputSpaceVisibleRegion = kOutputSpaceVisibleRegion;
outputLayerState.dataspace = kDataspace;
- mLayerState.frontEnd.blendMode = kBlendMode;
- mLayerState.frontEnd.alpha = kAlpha;
- mLayerState.frontEnd.type = kType;
- mLayerState.frontEnd.appId = kAppId;
- mLayerState.frontEnd.colorTransform = kColorTransform;
- mLayerState.frontEnd.color = kColor;
- mLayerState.frontEnd.surfaceDamage = kSurfaceDamage;
- mLayerState.frontEnd.hdrMetadata = kHdrMetadata;
- mLayerState.frontEnd.sidebandStream = NativeHandle::create(kSidebandStreamHandle, false);
- mLayerState.frontEnd.buffer = kBuffer;
- mLayerState.frontEnd.bufferSlot = BufferQueue::INVALID_BUFFER_SLOT;
- mLayerState.frontEnd.acquireFence = kFence;
+ mLayerFEState.blendMode = kBlendMode;
+ mLayerFEState.alpha = kAlpha;
+ mLayerFEState.type = kType;
+ mLayerFEState.appId = kAppId;
+ mLayerFEState.colorTransform = kColorTransform;
+ mLayerFEState.color = kColor;
+ mLayerFEState.surfaceDamage = kSurfaceDamage;
+ mLayerFEState.hdrMetadata = kHdrMetadata;
+ mLayerFEState.sidebandStream = NativeHandle::create(kSidebandStreamHandle, false);
+ mLayerFEState.buffer = kBuffer;
+ mLayerFEState.bufferSlot = BufferQueue::INVALID_BUFFER_SLOT;
+ mLayerFEState.acquireFence = kFence;
EXPECT_CALL(mOutput, getDisplayColorProfile())
.WillRepeatedly(Return(&mDisplayColorProfile));
@@ -698,7 +696,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForSolidColor) {
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
expectPerFrameCommonCalls();
expectSetColorCall();
@@ -708,7 +706,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForSideband) {
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SIDEBAND;
expectPerFrameCommonCalls();
expectSetSidebandHandleCall();
@@ -718,7 +716,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForCursor) {
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::CURSOR;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::CURSOR;
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
@@ -728,7 +726,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForDevice) {
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::DEVICE;
expectPerFrameCommonCalls();
expectSetHdrMetadataAndBufferCalls();
@@ -741,7 +739,7 @@
(*mOutputLayer.editState().hwc).hwcCompositionType =
Hwc2::IComposerClient::Composition::SOLID_COLOR;
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
expectPerFrameCommonCalls();
expectSetColorCall();
@@ -751,7 +749,7 @@
}
TEST_F(OutputLayerWriteStateToHWCTest, compositionTypeIsSetToClientIfColorTransformNotSupported) {
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
expectPerFrameCommonCalls(SimulateUnsupported::ColorTransform);
expectSetColorCall();
@@ -763,7 +761,7 @@
TEST_F(OutputLayerWriteStateToHWCTest, compositionTypeIsSetToClientIfClientCompositionForced) {
mOutputLayer.editState().forceClientComposition = true;
- mLayerState.frontEnd.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
+ mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;
expectPerFrameCommonCalls();
expectSetColorCall();
@@ -787,7 +785,7 @@
auto& outputLayerState = mOutputLayer.editState();
outputLayerState.hwc = impl::OutputLayerCompositionState::Hwc(mHwcLayer);
- mLayerState.frontEnd.cursorFrame = kDefaultCursorFrame;
+ mLayerFEState.cursorFrame = kDefaultCursorFrame;
mOutputState.viewport = kDefaultDisplayViewport;
mOutputState.transform = ui::Transform{kDefaultTransform};
@@ -812,7 +810,7 @@
}
TEST_F(OutputLayerWriteCursorPositionToHWCTest, writeCursorPositionToHWCIntersectedWithViewport) {
- mLayerState.frontEnd.cursorFrame = Rect{3000, 3000, 3016, 3016};
+ mLayerFEState.cursorFrame = Rect{3000, 3000, 3016, 3016};
EXPECT_CALL(*mHwcLayer, setCursorPosition(1920, 1080)).WillOnce(Return(kDefaultError));
diff --git a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
index a0b8017..70c343b 100644
--- a/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
+++ b/services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
@@ -16,7 +16,7 @@
#include <cmath>
-#include <compositionengine/impl/LayerCompositionState.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/impl/Output.h>
#include <compositionengine/impl/OutputCompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
@@ -378,9 +378,9 @@
TEST_F(OutputTest, belongsInOutputFiltersLayersAsExpected) {
StrictMock<mock::Layer> layer;
- impl::LayerCompositionState layerState;
+ LayerFECompositionState layerFEState;
- EXPECT_CALL(layer, getState()).WillRepeatedly(ReturnRef(layerState));
+ EXPECT_CALL(layer, getFEState()).WillRepeatedly(ReturnRef(layerFEState));
const uint32_t layerStack1 = 123u;
const uint32_t layerStack2 = 456u;
@@ -392,29 +392,29 @@
EXPECT_FALSE(mOutput.belongsInOutput(nullptr));
// A layer with no layerStack does not belong to it, internal-only or not.
- layerState.frontEnd.layerStackId = std::nullopt;
- layerState.frontEnd.internalOnly = false;
+ layerFEState.layerStackId = std::nullopt;
+ layerFEState.internalOnly = false;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = std::nullopt;
- layerState.frontEnd.internalOnly = true;
+ layerFEState.layerStackId = std::nullopt;
+ layerFEState.internalOnly = true;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
// Any layer with layerStack1 belongs to it, internal-only or not.
- layerState.frontEnd.layerStackId = layerStack1;
- layerState.frontEnd.internalOnly = false;
+ layerFEState.layerStackId = layerStack1;
+ layerFEState.internalOnly = false;
EXPECT_TRUE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = layerStack1;
- layerState.frontEnd.internalOnly = true;
+ layerFEState.layerStackId = layerStack1;
+ layerFEState.internalOnly = true;
EXPECT_TRUE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = layerStack2;
- layerState.frontEnd.internalOnly = true;
+ layerFEState.layerStackId = layerStack2;
+ layerFEState.internalOnly = true;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = layerStack2;
- layerState.frontEnd.internalOnly = false;
+ layerFEState.layerStackId = layerStack2;
+ layerFEState.internalOnly = false;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
// If the output accepts layerStack1 but not internal-only layers...
@@ -424,20 +424,20 @@
EXPECT_FALSE(mOutput.belongsInOutput(nullptr));
// Only non-internal layers with layerStack1 belong to it.
- layerState.frontEnd.layerStackId = layerStack1;
- layerState.frontEnd.internalOnly = false;
+ layerFEState.layerStackId = layerStack1;
+ layerFEState.internalOnly = false;
EXPECT_TRUE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = layerStack1;
- layerState.frontEnd.internalOnly = true;
+ layerFEState.layerStackId = layerStack1;
+ layerFEState.internalOnly = true;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = layerStack2;
- layerState.frontEnd.internalOnly = true;
+ layerFEState.layerStackId = layerStack2;
+ layerFEState.internalOnly = true;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
- layerState.frontEnd.layerStackId = layerStack2;
- layerState.frontEnd.internalOnly = false;
+ layerFEState.layerStackId = layerStack2;
+ layerFEState.internalOnly = false;
EXPECT_FALSE(mOutput.belongsInOutput(&layer));
}
@@ -732,8 +732,8 @@
leftOutputLayerState.clearClientTarget = false;
leftOutputLayerState.visibleRegion = Region{Rect{0, 0, 1000, 1000}};
- impl::LayerCompositionState leftLayerState;
- leftLayerState.frontEnd.isOpaque = true;
+ LayerFECompositionState leftLayerFEState;
+ leftLayerFEState.isOpaque = true;
const half3 leftLayerColor{1.f, 0.f, 0.f};
renderengine::LayerSettings leftLayerRESettings;
@@ -743,8 +743,8 @@
rightOutputLayerState.clearClientTarget = false;
rightOutputLayerState.visibleRegion = Region{Rect{1000, 0, 2000, 1000}};
- impl::LayerCompositionState rightLayerState;
- rightLayerState.frontEnd.isOpaque = true;
+ LayerFECompositionState rightLayerFEState;
+ rightLayerFEState.isOpaque = true;
const half3 rightLayerColor{0.f, 1.f, 0.f};
renderengine::LayerSettings rightLayerRESettings;
@@ -755,7 +755,7 @@
EXPECT_CALL(*leftOutputLayer, getLayerFE()).WillRepeatedly(ReturnRef(leftLayerFE));
EXPECT_CALL(*leftOutputLayer, requiresClientComposition()).WillRepeatedly(Return(true));
EXPECT_CALL(*leftOutputLayer, needsFiltering()).WillRepeatedly(Return(false));
- EXPECT_CALL(leftLayer, getState()).WillRepeatedly(ReturnRef(leftLayerState));
+ EXPECT_CALL(leftLayer, getFEState()).WillRepeatedly(ReturnRef(leftLayerFEState));
EXPECT_CALL(leftLayerFE, prepareClientComposition(_)).WillOnce(Return(leftLayerRESettings));
EXPECT_CALL(*rightOutputLayer, getState()).WillRepeatedly(ReturnRef(rightOutputLayerState));
@@ -763,7 +763,7 @@
EXPECT_CALL(*rightOutputLayer, getLayerFE()).WillRepeatedly(ReturnRef(rightLayerFE));
EXPECT_CALL(*rightOutputLayer, requiresClientComposition()).WillRepeatedly(Return(true));
EXPECT_CALL(*rightOutputLayer, needsFiltering()).WillRepeatedly(Return(false));
- EXPECT_CALL(rightLayer, getState()).WillRepeatedly(ReturnRef(rightLayerState));
+ EXPECT_CALL(rightLayer, getFEState()).WillRepeatedly(ReturnRef(rightLayerFEState));
EXPECT_CALL(rightLayerFE, prepareClientComposition(_)).WillOnce(Return(rightLayerRESettings));
Output::OutputLayers outputLayers;
@@ -806,15 +806,15 @@
outputLayerState.clearClientTarget = false;
outputLayerState.visibleRegion = Region{Rect{3000, 0, 4000, 1000}};
- impl::LayerCompositionState layerState;
- layerState.frontEnd.isOpaque = true;
+ LayerFECompositionState layerFEState;
+ layerFEState.isOpaque = true;
EXPECT_CALL(*outputLayer, getState()).WillRepeatedly(ReturnRef(outputLayerState));
EXPECT_CALL(*outputLayer, getLayer()).WillRepeatedly(ReturnRef(layer));
EXPECT_CALL(*outputLayer, getLayerFE()).WillRepeatedly(ReturnRef(layerFE));
EXPECT_CALL(*outputLayer, requiresClientComposition()).WillRepeatedly(Return(true));
EXPECT_CALL(*outputLayer, needsFiltering()).WillRepeatedly(Return(false));
- EXPECT_CALL(layer, getState()).WillRepeatedly(ReturnRef(layerState));
+ EXPECT_CALL(layer, getFEState()).WillRepeatedly(ReturnRef(layerFEState));
EXPECT_CALL(layerFE, prepareClientComposition(_)).Times(0);
Output::OutputLayers outputLayers;
@@ -861,15 +861,15 @@
leftOutputLayerState.clearClientTarget = true;
leftOutputLayerState.visibleRegion = Region{Rect{0, 0, 1000, 1000}};
- impl::LayerCompositionState leftLayerState;
- leftLayerState.frontEnd.isOpaque = true;
+ LayerFECompositionState leftLayerFEState;
+ leftLayerFEState.isOpaque = true;
impl::OutputLayerCompositionState rightOutputLayerState;
rightOutputLayerState.clearClientTarget = true;
rightOutputLayerState.visibleRegion = Region{Rect{1000, 0, 2000, 1000}};
- impl::LayerCompositionState rightLayerState;
- rightLayerState.frontEnd.isOpaque = true;
+ LayerFECompositionState rightLayerFEState;
+ rightLayerFEState.isOpaque = true;
const half3 rightLayerColor{0.f, 1.f, 0.f};
renderengine::LayerSettings rightLayerRESettings;
@@ -881,14 +881,14 @@
EXPECT_CALL(*leftOutputLayer, getLayerFE()).WillRepeatedly(ReturnRef(leftLayerFE));
EXPECT_CALL(*leftOutputLayer, requiresClientComposition()).WillRepeatedly(Return(false));
EXPECT_CALL(*leftOutputLayer, needsFiltering()).WillRepeatedly(Return(false));
- EXPECT_CALL(leftLayer, getState()).WillRepeatedly(ReturnRef(leftLayerState));
+ EXPECT_CALL(leftLayer, getFEState()).WillRepeatedly(ReturnRef(leftLayerFEState));
EXPECT_CALL(*rightOutputLayer, getState()).WillRepeatedly(ReturnRef(rightOutputLayerState));
EXPECT_CALL(*rightOutputLayer, getLayer()).WillRepeatedly(ReturnRef(rightLayer));
EXPECT_CALL(*rightOutputLayer, getLayerFE()).WillRepeatedly(ReturnRef(rightLayerFE));
EXPECT_CALL(*rightOutputLayer, requiresClientComposition()).WillRepeatedly(Return(false));
EXPECT_CALL(*rightOutputLayer, needsFiltering()).WillRepeatedly(Return(false));
- EXPECT_CALL(rightLayer, getState()).WillRepeatedly(ReturnRef(rightLayerState));
+ EXPECT_CALL(rightLayer, getFEState()).WillRepeatedly(ReturnRef(rightLayerFEState));
EXPECT_CALL(rightLayerFE, prepareClientComposition(_)).WillOnce(Return(rightLayerRESettings));
Output::OutputLayers outputLayers;
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index bed33a7..7b708bc 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -27,7 +27,6 @@
#include <compositionengine/Layer.h>
#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/OutputLayer.h>
-#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <cutils/compiler.h>
#include <cutils/native_handle.h>
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index cc12608..1555079 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -41,12 +41,9 @@
#include <compositionengine/CompositionRefreshArgs.h>
#include <compositionengine/Display.h>
#include <compositionengine/DisplayColorProfile.h>
-#include <compositionengine/Layer.h>
#include <compositionengine/OutputLayer.h>
#include <compositionengine/RenderSurface.h>
-#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/OutputCompositionState.h>
-#include <compositionengine/impl/OutputLayerCompositionState.h>
#include <dvr/vr_flinger.h>
#include <gui/BufferQueue.h>
#include <gui/DebugEGLImageTracker.h>
diff --git a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
index d0d391b..b77f82a 100644
--- a/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
+++ b/services/surfaceflinger/tests/unittests/TestableSurfaceFlinger.h
@@ -18,9 +18,9 @@
#include <compositionengine/Display.h>
#include <compositionengine/Layer.h>
+#include <compositionengine/LayerFECompositionState.h>
#include <compositionengine/OutputLayer.h>
#include <compositionengine/impl/CompositionEngine.h>
-#include <compositionengine/impl/LayerCompositionState.h>
#include <compositionengine/impl/OutputLayerCompositionState.h>
#include "BufferQueueLayer.h"
@@ -235,7 +235,7 @@
void setLayerSidebandStream(sp<Layer> layer, sp<NativeHandle> sidebandStream) {
layer->mDrawingState.sidebandStream = sidebandStream;
layer->mSidebandStream = sidebandStream;
- layer->getCompositionLayer()->editState().frontEnd.sidebandStream = sidebandStream;
+ layer->getCompositionLayer()->editFEState().sidebandStream = sidebandStream;
}
void setLayerCompositionType(sp<Layer> layer, HWC2::Composition type) {