SF: Restructure OutputLayer creation to remove displayId argument
The existing code was explicitly passing the displayId when creating an
OutputLayer, so that a HWC2::Layer could be created if applicable.
This patch makes a quick adjustment to the code so that the
compositionengine::Display instance overrides the base createOutputLayer
logic to create the HWC2::Layer, as it knows the displayId itself.
This is a minor cleanup prior to moving computeVisibleLayers to the
Output class.
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: go/wm-smoke
Bug: 121291683
Change-Id: Ic7224ba445084b833b8c344436397372b2153d42
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 4dfdeba..cb04e95 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -230,14 +230,20 @@
}
std::unique_ptr<compositionengine::OutputLayer> Output::getOrCreateOutputLayer(
- std::optional<DisplayId> displayId, std::shared_ptr<compositionengine::Layer> layer,
- sp<compositionengine::LayerFE> layerFE) {
+ std::shared_ptr<compositionengine::Layer> layer, sp<compositionengine::LayerFE> layerFE) {
for (auto& outputLayer : mOutputLayersOrderedByZ) {
if (outputLayer && &outputLayer->getLayer() == layer.get()) {
return std::move(outputLayer);
}
}
- return createOutputLayer(mCompositionEngine, displayId, *this, layer, layerFE);
+
+ return createOutputLayer(layer, layerFE);
+}
+
+std::unique_ptr<compositionengine::OutputLayer> Output::createOutputLayer(
+ const std::shared_ptr<compositionengine::Layer>& layer,
+ const sp<compositionengine::LayerFE>& layerFE) const {
+ return impl::createOutputLayer(*this, layer, layerFE);
}
void Output::setOutputLayersOrderedByZ(OutputLayers&& layers) {