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

Commit fe671024 authored by Lloyd Pique's avatar Lloyd Pique
Browse files

CE: Reset forceClientComposition on geometry update

If the output layer state ever had forceClientComposition set to true,
nothing would ever reset it to false. This would cause client
composition to be used when not necessary.

This regressed in my refactoring work. It was originally cleared in
SurfaceFlinger.cpp when the geometry was invalidated.

This patch adds it back, in an equivalent spot in the CompositionEngine
code.

Bug: 138853920
Bug: 139820579
Test: atest cts/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java#testRecordingFramerateLowToHigh
Test: atest google/perf/jank/UIBench/UIBench
Test: atest libsurfaceflinger_unittest libcompositionengine_test
Test: atest CtsColorModeTestCases
Test: atest CtsDisplayTestCases
Test: atest CtsGraphicsTestCases
Test: atest CtsUiRenderingTestCases
Test: atest CtsViewTestCases
Test: atest android.media.cts.EncodeVirtualDisplayWithCompositionTest
Test: go/wm-smoke
Change-Id: I47f18094cea8ca298eae3bad1b1a9e56cb9ba6e0
parent cb2744f0
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -288,6 +288,13 @@ void OutputLayer::updateCompositionState(bool includeGeometry) {
    const auto& profile = *mOutput.getDisplayColorProfile();

    if (includeGeometry) {
        // Clear the forceClientComposition flag before it is set for any
        // reason. Note that since it can be set by some checks below when
        // updating the geometry state, we only clear it when updating the
        // geometry since those conditions for forcing client composition won't
        // go away otherwise.
        mState.forceClientComposition = false;

        mState.displayFrame = calculateOutputDisplayFrame();
        mState.sourceCrop = calculateOutputSourceCrop();
        mState.bufferTransform =
+14 −0
Original line number Diff line number Diff line
@@ -458,6 +458,7 @@ public:
TEST_F(OutputLayerUpdateCompositionStateTest, setsStateNormally) {
    mLayerFEState.isSecure = true;
    mOutputState.isSecure = true;
    mOutputLayer.editState().forceClientComposition = true;

    setupGeometryChildCallValues();

@@ -520,13 +521,25 @@ TEST_F(OutputLayerUpdateCompositionStateTest, setsOutputLayerColorspaceCorrectly
}

TEST_F(OutputLayerUpdateCompositionStateTest, doesNotRecomputeGeometryIfNotRequested) {
    mOutputLayer.editState().forceClientComposition = false;

    mOutputLayer.updateCompositionState(false);

    EXPECT_EQ(false, mOutputLayer.getState().forceClientComposition);
}

TEST_F(OutputLayerUpdateCompositionStateTest,
       doesNotClearForceClientCompositionIfNotDoingGeometry) {
    mOutputLayer.editState().forceClientComposition = true;

    mOutputLayer.updateCompositionState(false);

    EXPECT_EQ(true, mOutputLayer.getState().forceClientComposition);
}

TEST_F(OutputLayerUpdateCompositionStateTest, clientCompositionForcedFromFrontEndFlagAtAnyTime) {
    mLayerFEState.forceClientComposition = true;
    mOutputLayer.editState().forceClientComposition = false;

    mOutputLayer.updateCompositionState(false);

@@ -535,6 +548,7 @@ TEST_F(OutputLayerUpdateCompositionStateTest, clientCompositionForcedFromFrontEn

TEST_F(OutputLayerUpdateCompositionStateTest,
       clientCompositionForcedFromUnsupportedDataspaceAtAnyTime) {
    mOutputLayer.editState().forceClientComposition = false;
    EXPECT_CALL(mDisplayColorProfile, isDataspaceSupported(_)).WillRepeatedly(Return(false));

    mOutputLayer.updateCompositionState(false);