diff options
3 files changed, 31 insertions, 0 deletions
diff --git a/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp b/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp index 0e3fdbb0dc..10dc9276d2 100644 --- a/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp +++ b/services/surfaceflinger/CompositionEngine/src/planner/LayerState.cpp @@ -14,6 +14,7 @@ * limitations under the License. */ +#include <common/FlagManager.h> #include <compositionengine/impl/planner/LayerState.h> namespace { @@ -70,6 +71,10 @@ size_t LayerState::getHash() const { if (field->getField() == LayerStateField::Buffer) { continue; } + if (FlagManager::getInstance().cache_when_source_crop_layer_only_moved() && + field->getField() == LayerStateField::SourceCrop) { + continue; + } android::hashCombineSingleHashed(hash, field->getHash()); } diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp index 39fce2b629..03758b345a 100644 --- a/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/planner/LayerStateTest.cpp @@ -18,6 +18,7 @@ #define LOG_TAG "LayerStateTest" #include <aidl/android/hardware/graphics/common/BufferUsage.h> +#include <common/include/common/test/FlagUtils.h> #include <compositionengine/impl/OutputLayer.h> #include <compositionengine/impl/planner/LayerState.h> #include <compositionengine/mock/LayerFE.h> @@ -26,6 +27,7 @@ #include <log/log.h> #include "android/hardware_buffer.h" +#include "com_android_graphics_surfaceflinger_flags.h" #include "compositionengine/LayerFECompositionState.h" #include <aidl/android/hardware/graphics/composer3/Composition.h> @@ -464,6 +466,9 @@ TEST_F(LayerStateTest, updateSourceCrop) { } TEST_F(LayerStateTest, compareSourceCrop) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); OutputLayerCompositionState outputLayerCompositionState; outputLayerCompositionState.sourceCrop = sFloatRectOne; LayerFECompositionState layerFECompositionState; diff --git a/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp b/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp index 35d0ffb6e9..a1210b4e21 100644 --- a/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp +++ b/services/surfaceflinger/CompositionEngine/tests/planner/PredictorTest.cpp @@ -18,6 +18,9 @@ #undef LOG_TAG #define LOG_TAG "PredictorTest" +#include <common/include/common/test/FlagUtils.h> +#include "com_android_graphics_surfaceflinger_flags.h" + #include <compositionengine/impl/planner/Predictor.h> #include <compositionengine/mock/LayerFE.h> #include <compositionengine/mock/OutputLayer.h> @@ -127,6 +130,9 @@ TEST_F(LayerStackTest, getApproximateMatch_doesNotMatchDifferentCompositionTypes } TEST_F(LayerStackTest, getApproximateMatch_matchesSingleDifferenceInSingleLayer) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); mock::OutputLayer outputLayerOne; sp<mock::LayerFE> layerFEOne = sp<mock::LayerFE>::make(); OutputLayerCompositionState outputLayerCompositionStateOne{ @@ -158,6 +164,9 @@ TEST_F(LayerStackTest, getApproximateMatch_matchesSingleDifferenceInSingleLayer) } TEST_F(LayerStackTest, getApproximateMatch_matchesSingleDifferenceInMultiLayerStack) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); mock::OutputLayer outputLayerOne; sp<mock::LayerFE> layerFEOne = sp<mock::LayerFE>::make(); OutputLayerCompositionState outputLayerCompositionStateOne{ @@ -304,6 +313,9 @@ TEST_F(LayerStackTest, getApproximateMatch_alwaysMatchesClientComposition) { } TEST_F(LayerStackTest, getApproximateMatch_doesNotMatchMultipleApproximations) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); mock::OutputLayer outputLayerOne; sp<mock::LayerFE> layerFEOne = sp<mock::LayerFE>::make(); OutputLayerCompositionState outputLayerCompositionStateOne{ @@ -347,6 +359,9 @@ struct PredictionTest : public testing::Test { }; TEST_F(LayerStackTest, reorderingChangesNonBufferHash) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); mock::OutputLayer outputLayerOne; sp<mock::LayerFE> layerFEOne = sp<mock::LayerFE>::make(); OutputLayerCompositionState outputLayerCompositionStateOne{ @@ -467,6 +482,9 @@ TEST_F(PredictorTest, getPredictedPlan_recordCandidateAndRetrieveExactMatch) { } TEST_F(PredictorTest, getPredictedPlan_recordCandidateAndRetrieveApproximateMatch) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); mock::OutputLayer outputLayerOne; sp<mock::LayerFE> layerFEOne = sp<mock::LayerFE>::make(); OutputLayerCompositionState outputLayerCompositionStateOne{ @@ -504,6 +522,9 @@ TEST_F(PredictorTest, getPredictedPlan_recordCandidateAndRetrieveApproximateMatc } TEST_F(PredictorTest, recordMissedPlan_skipsApproximateMatch) { + SET_FLAG_FOR_TEST(com::android::graphics::surfaceflinger::flags:: + cache_when_source_crop_layer_only_moved, + false); mock::OutputLayer outputLayerOne; sp<mock::LayerFE> layerFEOne = sp<mock::LayerFE>::make(); OutputLayerCompositionState outputLayerCompositionStateOne{ |