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

Commit 95595f7a authored by Alec Mouri's avatar Alec Mouri
Browse files

Remove surface damage from planner LayerState

Confirmed that the devices that we're prototyping this feature on don't
need to change their composition strategy based on the surface damage,
which means that this should not be included in the LayerState.

This also fixes an issue where when idle fallback is enabled in
SurfaceFlinger, the cached sets are always decomposed because the
surface damage becomes empty for every layer, which tricked the planner
into thinking the layer stack geometry changed.

Bug: 184735459
Test: Checked that cached sets are generated for static screen
workloads.

Change-Id: Idc0cd220bd31b932bb5f2421701790d52b10dfbc
parent f9932d79
Loading
Loading
Loading
Loading
+3 −11
Original line number Diff line number Diff line
@@ -360,14 +360,6 @@ private:

    OutputLayerState<mat4, LayerStateField::ColorTransform> mColorTransform;

    using SurfaceDamageState = OutputLayerState<Region, LayerStateField::SurfaceDamage>;
    SurfaceDamageState
            mSurfaceDamage{[](auto layer) {
                               return layer->getLayerFE().getCompositionState()->surfaceDamage;
                           },
                           SurfaceDamageState::getRegionToStrings(),
                           SurfaceDamageState::getRegionEquals()};

    using CompositionTypeState = OutputLayerState<hardware::graphics::composer::hal::Composition,
                                                  LayerStateField::CompositionType>;
    CompositionTypeState
@@ -410,7 +402,7 @@ private:
                            return std::vector<std::string>{stream.str()};
                        }};

    static const constexpr size_t kNumNonUniqueFields = 16;
    static const constexpr size_t kNumNonUniqueFields = 15;

    std::array<StateInterface*, kNumNonUniqueFields> getNonUniqueFields() {
        std::array<const StateInterface*, kNumNonUniqueFields> constFields =
@@ -427,8 +419,8 @@ private:
        return {
                &mDisplayFrame,    &mSourceCrop,     &mZOrder,         &mBufferTransform,
                &mBlendMode,       &mAlpha,          &mLayerMetadata,  &mVisibleRegion,
                &mOutputDataspace, &mPixelFormat,    &mColorTransform, &mSurfaceDamage,
                &mCompositionType, &mSidebandStream, &mBuffer,         &mSolidColor,
                &mOutputDataspace, &mPixelFormat,    &mColorTransform, &mCompositionType,
                &mSidebandStream,  &mBuffer,         &mSolidColor,
        };
    }
};
+0 −1
Original line number Diff line number Diff line
@@ -161,7 +161,6 @@ bool operator==(const LayerState& lhs, const LayerState& rhs) {
            lhs.mVisibleRegion == rhs.mVisibleRegion &&
            lhs.mOutputDataspace == rhs.mOutputDataspace && lhs.mPixelFormat == rhs.mPixelFormat &&
            lhs.mColorTransform == rhs.mColorTransform &&
            lhs.mSurfaceDamage == rhs.mSurfaceDamage &&
            lhs.mCompositionType == rhs.mCompositionType &&
            lhs.mSidebandStream == rhs.mSidebandStream && lhs.mBuffer == rhs.mBuffer &&
            (lhs.mCompositionType.get() != hal::Composition::SOLID_COLOR ||
+0 −41
Original line number Diff line number Diff line
@@ -793,47 +793,6 @@ TEST_F(LayerStateTest, compareColorTransform) {
    EXPECT_TRUE(otherLayerState->compare(*mLayerState));
}

TEST_F(LayerStateTest, updateSurfaceDamage) {
    OutputLayerCompositionState outputLayerCompositionState;
    LayerFECompositionState layerFECompositionState;
    layerFECompositionState.surfaceDamage = sRegionOne;
    setupMocksForLayer(mOutputLayer, mLayerFE, outputLayerCompositionState,
                       layerFECompositionState);
    mLayerState = std::make_unique<LayerState>(&mOutputLayer);

    mock::OutputLayer newOutputLayer;
    mock::LayerFE newLayerFE;
    OutputLayerCompositionState outputLayerCompositionStateTwo;
    LayerFECompositionState layerFECompositionStateTwo;
    layerFECompositionStateTwo.surfaceDamage = sRegionTwo;
    setupMocksForLayer(newOutputLayer, newLayerFE, outputLayerCompositionStateTwo,
                       layerFECompositionStateTwo);
    Flags<LayerStateField> updates = mLayerState->update(&newOutputLayer);
    EXPECT_EQ(Flags<LayerStateField>(LayerStateField::SurfaceDamage), updates);
}

TEST_F(LayerStateTest, compareSurfaceDamage) {
    OutputLayerCompositionState outputLayerCompositionState;
    LayerFECompositionState layerFECompositionState;
    layerFECompositionState.surfaceDamage = sRegionOne;
    setupMocksForLayer(mOutputLayer, mLayerFE, outputLayerCompositionState,
                       layerFECompositionState);
    mLayerState = std::make_unique<LayerState>(&mOutputLayer);
    mock::OutputLayer newOutputLayer;
    mock::LayerFE newLayerFE;
    OutputLayerCompositionState outputLayerCompositionStateTwo;
    LayerFECompositionState layerFECompositionStateTwo;
    layerFECompositionStateTwo.surfaceDamage = sRegionTwo;
    setupMocksForLayer(newOutputLayer, newLayerFE, outputLayerCompositionStateTwo,
                       layerFECompositionStateTwo);
    auto otherLayerState = std::make_unique<LayerState>(&newOutputLayer);

    verifyNonUniqueDifferingFields(*mLayerState, *otherLayerState, LayerStateField::SurfaceDamage);

    EXPECT_TRUE(mLayerState->compare(*otherLayerState));
    EXPECT_TRUE(otherLayerState->compare(*mLayerState));
}

TEST_F(LayerStateTest, updateSidebandStream) {
    OutputLayerCompositionState outputLayerCompositionState;
    LayerFECompositionState layerFECompositionState;