Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6614faf5 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Exclude source crop from geometry hash calculation" into main

parents 69fd3fb8 44c0a8f8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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());
    }

+5 −0
Original line number Diff line number Diff line
@@ -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;
+21 −0
Original line number Diff line number Diff line
@@ -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{