Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 17 | #include <compositionengine/CompositionRefreshArgs.h> |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 18 | #include <compositionengine/LayerFECompositionState.h> |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 19 | #include <compositionengine/impl/CompositionEngine.h> |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 20 | #include <compositionengine/mock/LayerFE.h> |
| 21 | #include <compositionengine/mock/Output.h> |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 22 | #include <compositionengine/mock/OutputLayer.h> |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 23 | #include <gtest/gtest.h> |
Lloyd Pique | b97e04f | 2018-10-18 17:07:05 -0700 | [diff] [blame] | 24 | #include <renderengine/mock/RenderEngine.h> |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 25 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 26 | #include "MockHWComposer.h" |
Alec Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 27 | #include "TimeStats/TimeStats.h" |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 28 | |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 29 | namespace android::compositionengine { |
| 30 | namespace { |
| 31 | |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 32 | using ::testing::_; |
Haibo Huang | f66b752 | 2020-09-10 18:20:30 -0700 | [diff] [blame] | 33 | using ::testing::DoAll; |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 34 | using ::testing::InSequence; |
| 35 | using ::testing::Ref; |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 36 | using ::testing::Return; |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 37 | using ::testing::ReturnRef; |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 38 | using ::testing::SaveArg; |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 39 | using ::testing::StrictMock; |
| 40 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 41 | struct CompositionEngineTest : public testing::Test { |
Alec Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 42 | std::shared_ptr<TimeStats> mTimeStats; |
| 43 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 44 | impl::CompositionEngine mEngine; |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 45 | CompositionRefreshArgs mRefreshArgs; |
| 46 | |
| 47 | std::shared_ptr<mock::Output> mOutput1{std::make_shared<StrictMock<mock::Output>>()}; |
| 48 | std::shared_ptr<mock::Output> mOutput2{std::make_shared<StrictMock<mock::Output>>()}; |
| 49 | std::shared_ptr<mock::Output> mOutput3{std::make_shared<StrictMock<mock::Output>>()}; |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 50 | }; |
| 51 | |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 52 | TEST_F(CompositionEngineTest, canInstantiateCompositionEngine) { |
| 53 | auto engine = impl::createCompositionEngine(); |
| 54 | EXPECT_TRUE(engine.get() != nullptr); |
| 55 | } |
| 56 | |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 57 | TEST_F(CompositionEngineTest, canSetHWComposer) { |
Ady Abraham | eca9d75 | 2021-03-03 12:20:00 -0800 | [diff] [blame] | 58 | android::mock::HWComposer* hwc = new StrictMock<android::mock::HWComposer>(); |
| 59 | mEngine.setHwComposer(std::unique_ptr<android::HWComposer>(hwc)); |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 60 | |
Ady Abraham | eca9d75 | 2021-03-03 12:20:00 -0800 | [diff] [blame] | 61 | EXPECT_EQ(hwc, &mEngine.getHwComposer()); |
Lloyd Pique | 441d504 | 2018-10-18 16:49:51 -0700 | [diff] [blame] | 62 | } |
| 63 | |
Lloyd Pique | b97e04f | 2018-10-18 17:07:05 -0700 | [diff] [blame] | 64 | TEST_F(CompositionEngineTest, canSetRenderEngine) { |
Patrick Williams | 0a525a4 | 2022-10-26 20:20:50 +0000 | [diff] [blame] | 65 | auto renderEngine = std::make_unique<StrictMock<renderengine::mock::RenderEngine>>(); |
| 66 | mEngine.setRenderEngine(renderEngine.get()); |
Lloyd Pique | b97e04f | 2018-10-18 17:07:05 -0700 | [diff] [blame] | 67 | |
Patrick Williams | 0a525a4 | 2022-10-26 20:20:50 +0000 | [diff] [blame] | 68 | EXPECT_EQ(renderEngine.get(), &mEngine.getRenderEngine()); |
Lloyd Pique | b97e04f | 2018-10-18 17:07:05 -0700 | [diff] [blame] | 69 | } |
| 70 | |
Alec Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 71 | TEST_F(CompositionEngineTest, canSetTimeStats) { |
| 72 | mEngine.setTimeStats(mTimeStats); |
| 73 | |
Patrick Williams | 74c0bf6 | 2022-11-02 23:59:26 +0000 | [diff] [blame^] | 74 | EXPECT_EQ(mTimeStats.get(), mEngine.getTimeStats()); |
Alec Mouri | e4034bb | 2019-11-19 12:45:54 -0800 | [diff] [blame] | 75 | } |
| 76 | |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 77 | /* |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 78 | * CompositionEngine::present |
| 79 | */ |
| 80 | |
| 81 | struct CompositionEnginePresentTest : public CompositionEngineTest { |
| 82 | struct CompositionEnginePartialMock : public impl::CompositionEngine { |
| 83 | // These are the overridable functions CompositionEngine::present() may |
| 84 | // call, and have separate test coverage. |
| 85 | MOCK_METHOD1(preComposition, void(CompositionRefreshArgs&)); |
| 86 | }; |
| 87 | |
| 88 | StrictMock<CompositionEnginePartialMock> mEngine; |
| 89 | }; |
| 90 | |
| 91 | TEST_F(CompositionEnginePresentTest, worksWithEmptyRequest) { |
| 92 | // present() always calls preComposition() |
| 93 | EXPECT_CALL(mEngine, preComposition(Ref(mRefreshArgs))); |
| 94 | |
| 95 | mEngine.present(mRefreshArgs); |
| 96 | } |
| 97 | |
| 98 | TEST_F(CompositionEnginePresentTest, worksAsExpected) { |
| 99 | // Expect calls to in a certain sequence |
| 100 | InSequence seq; |
| 101 | |
| 102 | // present() always calls preComposition() |
| 103 | EXPECT_CALL(mEngine, preComposition(Ref(mRefreshArgs))); |
| 104 | |
| 105 | // The first step in presenting is to make sure all outputs are prepared. |
| 106 | EXPECT_CALL(*mOutput1, prepare(Ref(mRefreshArgs), _)); |
| 107 | EXPECT_CALL(*mOutput2, prepare(Ref(mRefreshArgs), _)); |
| 108 | EXPECT_CALL(*mOutput3, prepare(Ref(mRefreshArgs), _)); |
| 109 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 110 | // The last step is to actually present each output. |
| 111 | EXPECT_CALL(*mOutput1, present(Ref(mRefreshArgs))); |
| 112 | EXPECT_CALL(*mOutput2, present(Ref(mRefreshArgs))); |
| 113 | EXPECT_CALL(*mOutput3, present(Ref(mRefreshArgs))); |
| 114 | |
| 115 | mRefreshArgs.outputs = {mOutput1, mOutput2, mOutput3}; |
| 116 | mEngine.present(mRefreshArgs); |
| 117 | } |
| 118 | |
| 119 | /* |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 120 | * CompositionEngine::updateCursorAsync |
| 121 | */ |
| 122 | |
| 123 | struct CompositionEngineUpdateCursorAsyncTest : public CompositionEngineTest { |
| 124 | public: |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 125 | struct Layer { |
Ady Abraham | eca9d75 | 2021-03-03 12:20:00 -0800 | [diff] [blame] | 126 | Layer() { EXPECT_CALL(outputLayer, getLayerFE()).WillRepeatedly(ReturnRef(*layerFE)); } |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 127 | |
| 128 | StrictMock<mock::OutputLayer> outputLayer; |
Ady Abraham | eca9d75 | 2021-03-03 12:20:00 -0800 | [diff] [blame] | 129 | sp<StrictMock<mock::LayerFE>> layerFE = sp<StrictMock<mock::LayerFE>>::make(); |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 130 | LayerFECompositionState layerFEState; |
| 131 | }; |
| 132 | |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 133 | CompositionEngineUpdateCursorAsyncTest() { |
Lloyd Pique | 0a45623 | 2020-01-16 17:51:13 -0800 | [diff] [blame] | 134 | EXPECT_CALL(*mOutput1, getOutputLayerCount()).WillRepeatedly(Return(0u)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 135 | EXPECT_CALL(*mOutput1, getOutputLayerOrderedByZByIndex(_)).Times(0); |
| 136 | |
Lloyd Pique | 0a45623 | 2020-01-16 17:51:13 -0800 | [diff] [blame] | 137 | EXPECT_CALL(*mOutput2, getOutputLayerCount()).WillRepeatedly(Return(1u)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 138 | EXPECT_CALL(*mOutput2, getOutputLayerOrderedByZByIndex(0)) |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 139 | .WillRepeatedly(Return(&mOutput2Layer1.outputLayer)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 140 | |
Lloyd Pique | 0a45623 | 2020-01-16 17:51:13 -0800 | [diff] [blame] | 141 | EXPECT_CALL(*mOutput3, getOutputLayerCount()).WillRepeatedly(Return(2u)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 142 | EXPECT_CALL(*mOutput3, getOutputLayerOrderedByZByIndex(0)) |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 143 | .WillRepeatedly(Return(&mOutput3Layer1.outputLayer)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 144 | EXPECT_CALL(*mOutput3, getOutputLayerOrderedByZByIndex(1)) |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 145 | .WillRepeatedly(Return(&mOutput3Layer2.outputLayer)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 146 | } |
| 147 | |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 148 | Layer mOutput2Layer1; |
| 149 | Layer mOutput3Layer1; |
| 150 | Layer mOutput3Layer2; |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 151 | }; |
| 152 | |
| 153 | TEST_F(CompositionEngineUpdateCursorAsyncTest, handlesNoOutputs) { |
| 154 | mEngine.updateCursorAsync(mRefreshArgs); |
| 155 | } |
| 156 | |
| 157 | TEST_F(CompositionEngineUpdateCursorAsyncTest, handlesNoLayersBeingCursorLayers) { |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 158 | EXPECT_CALL(mOutput3Layer1.outputLayer, isHardwareCursor()).WillRepeatedly(Return(false)); |
| 159 | EXPECT_CALL(mOutput3Layer2.outputLayer, isHardwareCursor()).WillRepeatedly(Return(false)); |
| 160 | EXPECT_CALL(mOutput2Layer1.outputLayer, isHardwareCursor()).WillRepeatedly(Return(false)); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 161 | |
| 162 | mRefreshArgs.outputs = {mOutput1, mOutput2, mOutput3}; |
| 163 | |
| 164 | mEngine.updateCursorAsync(mRefreshArgs); |
| 165 | } |
| 166 | |
| 167 | TEST_F(CompositionEngineUpdateCursorAsyncTest, handlesMultipleLayersBeingCursorLayers) { |
| 168 | { |
| 169 | InSequence seq; |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 170 | EXPECT_CALL(mOutput2Layer1.outputLayer, isHardwareCursor()).WillRepeatedly(Return(true)); |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 171 | EXPECT_CALL(mOutput2Layer1.outputLayer, writeCursorPositionToHWC()); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 172 | } |
| 173 | |
| 174 | { |
| 175 | InSequence seq; |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 176 | EXPECT_CALL(mOutput3Layer1.outputLayer, isHardwareCursor()).WillRepeatedly(Return(true)); |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 177 | EXPECT_CALL(mOutput3Layer1.outputLayer, writeCursorPositionToHWC()); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 178 | } |
| 179 | |
| 180 | { |
| 181 | InSequence seq; |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 182 | EXPECT_CALL(mOutput3Layer2.outputLayer, isHardwareCursor()).WillRepeatedly(Return(true)); |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 183 | EXPECT_CALL(mOutput3Layer2.outputLayer, writeCursorPositionToHWC()); |
Lloyd Pique | aed56ab | 2019-11-13 22:34:11 -0800 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | mRefreshArgs.outputs = {mOutput1, mOutput2, mOutput3}; |
| 187 | |
| 188 | mEngine.updateCursorAsync(mRefreshArgs); |
| 189 | } |
| 190 | |
| 191 | /* |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 192 | * CompositionEngine::preComposition |
| 193 | */ |
| 194 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 195 | struct CompositionTestPreComposition : public CompositionEngineTest { |
Ady Abraham | e0eafa8 | 2022-02-02 19:30:47 -0800 | [diff] [blame] | 196 | sp<StrictMock<mock::LayerFE>> mLayer1FE = sp<StrictMock<mock::LayerFE>>::make(); |
| 197 | sp<StrictMock<mock::LayerFE>> mLayer2FE = sp<StrictMock<mock::LayerFE>>::make(); |
| 198 | sp<StrictMock<mock::LayerFE>> mLayer3FE = sp<StrictMock<mock::LayerFE>>::make(); |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 199 | }; |
| 200 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 201 | TEST_F(CompositionTestPreComposition, preCompositionSetsFrameTimestamp) { |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 202 | const nsecs_t before = systemTime(SYSTEM_TIME_MONOTONIC); |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 203 | mEngine.preComposition(mRefreshArgs); |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 204 | const nsecs_t after = systemTime(SYSTEM_TIME_MONOTONIC); |
| 205 | |
| 206 | // The frame timestamp should be between the before and after timestamps |
| 207 | EXPECT_GE(mEngine.getLastFrameRefreshTimestamp(), before); |
| 208 | EXPECT_LE(mEngine.getLastFrameRefreshTimestamp(), after); |
| 209 | } |
| 210 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 211 | TEST_F(CompositionTestPreComposition, preCompositionInvokesLayerPreCompositionWithFrameTimestamp) { |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 212 | nsecs_t ts1 = 0; |
| 213 | nsecs_t ts2 = 0; |
| 214 | nsecs_t ts3 = 0; |
Vishnu Nair | ba35410 | 2022-08-01 00:14:18 +0000 | [diff] [blame] | 215 | EXPECT_CALL(*mLayer1FE, onPreComposition(_, _)) |
| 216 | .WillOnce(DoAll(SaveArg<0>(&ts1), Return(false))); |
| 217 | EXPECT_CALL(*mLayer2FE, onPreComposition(_, _)) |
| 218 | .WillOnce(DoAll(SaveArg<0>(&ts2), Return(false))); |
| 219 | EXPECT_CALL(*mLayer3FE, onPreComposition(_, _)) |
| 220 | .WillOnce(DoAll(SaveArg<0>(&ts3), Return(false))); |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 221 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 222 | mRefreshArgs.outputs = {mOutput1}; |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 223 | mRefreshArgs.layers = {mLayer1FE, mLayer2FE, mLayer3FE}; |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 224 | |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 225 | mEngine.preComposition(mRefreshArgs); |
| 226 | |
| 227 | // Each of the onPreComposition calls should used the same refresh timestamp |
| 228 | EXPECT_EQ(ts1, mEngine.getLastFrameRefreshTimestamp()); |
| 229 | EXPECT_EQ(ts2, mEngine.getLastFrameRefreshTimestamp()); |
| 230 | EXPECT_EQ(ts3, mEngine.getLastFrameRefreshTimestamp()); |
| 231 | } |
| 232 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 233 | TEST_F(CompositionTestPreComposition, preCompositionDefaultsToNoUpdateNeeded) { |
Vishnu Nair | ba35410 | 2022-08-01 00:14:18 +0000 | [diff] [blame] | 234 | EXPECT_CALL(*mLayer1FE, onPreComposition(_, _)).WillOnce(Return(false)); |
| 235 | EXPECT_CALL(*mLayer2FE, onPreComposition(_, _)).WillOnce(Return(false)); |
| 236 | EXPECT_CALL(*mLayer3FE, onPreComposition(_, _)).WillOnce(Return(false)); |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 237 | |
| 238 | mEngine.setNeedsAnotherUpdateForTest(true); |
| 239 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 240 | mRefreshArgs.outputs = {mOutput1}; |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 241 | mRefreshArgs.layers = {mLayer1FE, mLayer2FE, mLayer3FE}; |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 242 | |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 243 | mEngine.preComposition(mRefreshArgs); |
| 244 | |
| 245 | // The call should have cleared the needsAnotherUpdate flag |
| 246 | EXPECT_FALSE(mEngine.needsAnotherUpdate()); |
| 247 | } |
| 248 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 249 | TEST_F(CompositionTestPreComposition, |
| 250 | preCompositionSetsNeedsAnotherUpdateIfAtLeastOneLayerRequestsIt) { |
Vishnu Nair | ba35410 | 2022-08-01 00:14:18 +0000 | [diff] [blame] | 251 | EXPECT_CALL(*mLayer1FE, onPreComposition(_, _)).WillOnce(Return(true)); |
| 252 | EXPECT_CALL(*mLayer2FE, onPreComposition(_, _)).WillOnce(Return(false)); |
| 253 | EXPECT_CALL(*mLayer3FE, onPreComposition(_, _)).WillOnce(Return(false)); |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 254 | |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 255 | mRefreshArgs.outputs = {mOutput1}; |
Lloyd Pique | de19665 | 2020-01-22 17:29:58 -0800 | [diff] [blame] | 256 | mRefreshArgs.layers = {mLayer1FE, mLayer2FE, mLayer3FE}; |
Lloyd Pique | e82ed2d | 2019-11-13 19:28:12 -0800 | [diff] [blame] | 257 | |
Lloyd Pique | ab039b5 | 2019-02-13 14:22:42 -0800 | [diff] [blame] | 258 | mEngine.preComposition(mRefreshArgs); |
| 259 | |
| 260 | EXPECT_TRUE(mEngine.needsAnotherUpdate()); |
| 261 | } |
| 262 | |
Lloyd Pique | 70d9136 | 2018-10-18 16:02:55 -0700 | [diff] [blame] | 263 | } // namespace |
| 264 | } // namespace android::compositionengine |