SF: Dev Options should force client composition for all frames
While there was some code which tried to force it, it turned out that if
there was a geometry refresh for a frame, the flag would be cleared
after being set. It would then be forced on subsequent frames assuming
there were no geometry updates then.
This was caught by the libsurfaceflinger_unittest I was trying to add,
which caught it when it was re-run after I moved more code to
CompositionEngine.
This patch moves where the flag is set to after where it was being
cleared, which meant adding a parameter, and adding a bit more unit test
coverage for the revised function.
Test: atest libsurfaceflinger_unittest # With added test there
Test: atest libcompositionengine_test # With added test there
Bug: None
Change-Id: I4b96b21cdd4fe280f0943051962d3473e9113851
Merged-In: I4b96b21cdd4fe280f0943051962d3473e9113851
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 2007ea3..aa638b7 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -552,11 +552,8 @@
ALOGV(__FUNCTION__);
for (auto* layer : getOutputLayersOrderedByZ()) {
- if (refreshArgs.devOptForceClientComposition) {
- layer->editState().forceClientComposition = true;
- }
-
- layer->updateCompositionState(refreshArgs.updatingGeometryThisFrame);
+ layer->updateCompositionState(refreshArgs.updatingGeometryThisFrame,
+ refreshArgs.devOptForceClientComposition);
// Send the updated state to the HWC, if appropriate.
layer->writeStateToHWC(refreshArgs.updatingGeometryThisFrame);
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 0124e5b..721e953 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -259,7 +259,7 @@
return transform.getOrientation();
} // namespace impl
-void OutputLayer::updateCompositionState(bool includeGeometry) {
+void OutputLayer::updateCompositionState(bool includeGeometry, bool forceClientComposition) {
const auto& layerFEState = getLayer().getFEState();
const auto& outputState = getOutput().getState();
const auto& profile = *getOutput().getDisplayColorProfile();
@@ -294,7 +294,8 @@
// 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;
}
}