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

Commit 991e1925 authored by Wiwit Rifa'i's avatar Wiwit Rifa'i
Browse files

Exclude source crop from geometry hash calculation

Bug: 305718400
Test: video playback; libcompositionengine_test
Change-Id: I583f47e68c073e1d4cfdfa08f7184fb7117c72fc
Merged-In: I583f47e68c073e1d4cfdfa08f7184fb7117c72fc
(cherry picked from commit 44c0a8f8)
parent b0061268
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>
@@ -454,6 +456,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{