Loading services/surfaceflinger/CompositionEngine/include/compositionengine/CompositionRefreshArgs.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,9 @@ struct CompositionRefreshArgs { // to prevent an early presentation of a frame. // to prevent an early presentation of a frame. std::shared_ptr<FenceTime> previousPresentFence; std::shared_ptr<FenceTime> previousPresentFence; // The expected time for the next present nsecs_t expectedPresentTime{0}; // If set, a frame has been scheduled for that time. // If set, a frame has been scheduled for that time. std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; }; }; Loading services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputCompositionState.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -121,6 +121,9 @@ struct OutputCompositionState { // to prevent an early presentation of a frame. // to prevent an early presentation of a frame. std::shared_ptr<FenceTime> previousPresentFence; std::shared_ptr<FenceTime> previousPresentFence; // The expected time for the next present nsecs_t expectedPresentTime{0}; // Current display brightness // Current display brightness float displayBrightnessNits{-1.f}; float displayBrightnessNits{-1.f}; Loading services/surfaceflinger/CompositionEngine/src/Display.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -227,7 +227,8 @@ void Display::chooseCompositionStrategy() { if (status_t result = if (status_t result = hwc.getDeviceCompositionChanges(*halDisplayId, anyLayersRequireClientComposition(), hwc.getDeviceCompositionChanges(*halDisplayId, anyLayersRequireClientComposition(), getState().earliestPresentTime, getState().earliestPresentTime, getState().previousPresentFence, &changes); getState().previousPresentFence, getState().expectedPresentTime, &changes); result != NO_ERROR) { result != NO_ERROR) { ALOGE("chooseCompositionStrategy failed for %s: %d (%s)", getName().c_str(), result, ALOGE("chooseCompositionStrategy failed for %s: %d (%s)", getName().c_str(), result, strerror(-result)); strerror(-result)); Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -728,6 +728,7 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr editState().earliestPresentTime = refreshArgs.earliestPresentTime; editState().earliestPresentTime = refreshArgs.earliestPresentTime; editState().previousPresentFence = refreshArgs.previousPresentFence; editState().previousPresentFence = refreshArgs.previousPresentFence; editState().expectedPresentTime = refreshArgs.expectedPresentTime; compositionengine::OutputLayer* peekThroughLayer = nullptr; compositionengine::OutputLayer* peekThroughLayer = nullptr; sp<GraphicBuffer> previousOverride = nullptr; sp<GraphicBuffer> previousOverride = nullptr; Loading services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -560,7 +560,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, takesEarlyOutIfGpuDisplay) { TEST_F(DisplayChooseCompositionStrategyTest, takesEarlyOutOnHwcError) { TEST_F(DisplayChooseCompositionStrategyTest, takesEarlyOutOnHwcError) { EXPECT_CALL(*mDisplay, anyLayersRequireClientComposition()).WillOnce(Return(false)); EXPECT_CALL(*mDisplay, anyLayersRequireClientComposition()).WillOnce(Return(false)); EXPECT_CALL(mHwComposer, EXPECT_CALL(mHwComposer, getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), false, _, _, _)) getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), false, _, _, _, _)) .WillOnce(Return(INVALID_OPERATION)); .WillOnce(Return(INVALID_OPERATION)); mDisplay->chooseCompositionStrategy(); mDisplay->chooseCompositionStrategy(); Loading @@ -583,7 +583,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperation) { .WillOnce(Return(false)); .WillOnce(Return(false)); EXPECT_CALL(mHwComposer, EXPECT_CALL(mHwComposer, getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _)) getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _, _)) .WillOnce(Return(NO_ERROR)); .WillOnce(Return(NO_ERROR)); EXPECT_CALL(*mDisplay, allLayersRequireClientComposition()).WillOnce(Return(false)); EXPECT_CALL(*mDisplay, allLayersRequireClientComposition()).WillOnce(Return(false)); Loading Loading @@ -615,8 +615,8 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithChanges) { .WillOnce(Return(false)); .WillOnce(Return(false)); EXPECT_CALL(mHwComposer, EXPECT_CALL(mHwComposer, getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _)) getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _, _)) .WillOnce(DoAll(SetArgPointee<4>(changes), Return(NO_ERROR))); .WillOnce(DoAll(SetArgPointee<5>(changes), Return(NO_ERROR))); EXPECT_CALL(*mDisplay, applyChangedTypesToLayers(changes.changedTypes)).Times(1); EXPECT_CALL(*mDisplay, applyChangedTypesToLayers(changes.changedTypes)).Times(1); EXPECT_CALL(*mDisplay, applyDisplayRequests(changes.displayRequests)).Times(1); EXPECT_CALL(*mDisplay, applyDisplayRequests(changes.displayRequests)).Times(1); EXPECT_CALL(*mDisplay, applyLayerRequestsToLayers(changes.layerRequests)).Times(1); EXPECT_CALL(*mDisplay, applyLayerRequestsToLayers(changes.layerRequests)).Times(1); Loading Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/CompositionRefreshArgs.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -85,6 +85,9 @@ struct CompositionRefreshArgs { // to prevent an early presentation of a frame. // to prevent an early presentation of a frame. std::shared_ptr<FenceTime> previousPresentFence; std::shared_ptr<FenceTime> previousPresentFence; // The expected time for the next present nsecs_t expectedPresentTime{0}; // If set, a frame has been scheduled for that time. // If set, a frame has been scheduled for that time. std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; std::optional<std::chrono::steady_clock::time_point> scheduledFrameTime; }; }; Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputCompositionState.h +3 −0 Original line number Original line Diff line number Diff line Loading @@ -121,6 +121,9 @@ struct OutputCompositionState { // to prevent an early presentation of a frame. // to prevent an early presentation of a frame. std::shared_ptr<FenceTime> previousPresentFence; std::shared_ptr<FenceTime> previousPresentFence; // The expected time for the next present nsecs_t expectedPresentTime{0}; // Current display brightness // Current display brightness float displayBrightnessNits{-1.f}; float displayBrightnessNits{-1.f}; Loading
services/surfaceflinger/CompositionEngine/src/Display.cpp +2 −1 Original line number Original line Diff line number Diff line Loading @@ -227,7 +227,8 @@ void Display::chooseCompositionStrategy() { if (status_t result = if (status_t result = hwc.getDeviceCompositionChanges(*halDisplayId, anyLayersRequireClientComposition(), hwc.getDeviceCompositionChanges(*halDisplayId, anyLayersRequireClientComposition(), getState().earliestPresentTime, getState().earliestPresentTime, getState().previousPresentFence, &changes); getState().previousPresentFence, getState().expectedPresentTime, &changes); result != NO_ERROR) { result != NO_ERROR) { ALOGE("chooseCompositionStrategy failed for %s: %d (%s)", getName().c_str(), result, ALOGE("chooseCompositionStrategy failed for %s: %d (%s)", getName().c_str(), result, strerror(-result)); strerror(-result)); Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +1 −0 Original line number Original line Diff line number Diff line Loading @@ -728,6 +728,7 @@ void Output::writeCompositionState(const compositionengine::CompositionRefreshAr editState().earliestPresentTime = refreshArgs.earliestPresentTime; editState().earliestPresentTime = refreshArgs.earliestPresentTime; editState().previousPresentFence = refreshArgs.previousPresentFence; editState().previousPresentFence = refreshArgs.previousPresentFence; editState().expectedPresentTime = refreshArgs.expectedPresentTime; compositionengine::OutputLayer* peekThroughLayer = nullptr; compositionengine::OutputLayer* peekThroughLayer = nullptr; sp<GraphicBuffer> previousOverride = nullptr; sp<GraphicBuffer> previousOverride = nullptr; Loading
services/surfaceflinger/CompositionEngine/tests/DisplayTest.cpp +4 −4 Original line number Original line Diff line number Diff line Loading @@ -560,7 +560,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, takesEarlyOutIfGpuDisplay) { TEST_F(DisplayChooseCompositionStrategyTest, takesEarlyOutOnHwcError) { TEST_F(DisplayChooseCompositionStrategyTest, takesEarlyOutOnHwcError) { EXPECT_CALL(*mDisplay, anyLayersRequireClientComposition()).WillOnce(Return(false)); EXPECT_CALL(*mDisplay, anyLayersRequireClientComposition()).WillOnce(Return(false)); EXPECT_CALL(mHwComposer, EXPECT_CALL(mHwComposer, getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), false, _, _, _)) getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), false, _, _, _, _)) .WillOnce(Return(INVALID_OPERATION)); .WillOnce(Return(INVALID_OPERATION)); mDisplay->chooseCompositionStrategy(); mDisplay->chooseCompositionStrategy(); Loading @@ -583,7 +583,7 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperation) { .WillOnce(Return(false)); .WillOnce(Return(false)); EXPECT_CALL(mHwComposer, EXPECT_CALL(mHwComposer, getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _)) getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _, _)) .WillOnce(Return(NO_ERROR)); .WillOnce(Return(NO_ERROR)); EXPECT_CALL(*mDisplay, allLayersRequireClientComposition()).WillOnce(Return(false)); EXPECT_CALL(*mDisplay, allLayersRequireClientComposition()).WillOnce(Return(false)); Loading Loading @@ -615,8 +615,8 @@ TEST_F(DisplayChooseCompositionStrategyTest, normalOperationWithChanges) { .WillOnce(Return(false)); .WillOnce(Return(false)); EXPECT_CALL(mHwComposer, EXPECT_CALL(mHwComposer, getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _)) getDeviceCompositionChanges(HalDisplayId(DEFAULT_DISPLAY_ID), true, _, _, _, _)) .WillOnce(DoAll(SetArgPointee<4>(changes), Return(NO_ERROR))); .WillOnce(DoAll(SetArgPointee<5>(changes), Return(NO_ERROR))); EXPECT_CALL(*mDisplay, applyChangedTypesToLayers(changes.changedTypes)).Times(1); EXPECT_CALL(*mDisplay, applyChangedTypesToLayers(changes.changedTypes)).Times(1); EXPECT_CALL(*mDisplay, applyDisplayRequests(changes.displayRequests)).Times(1); EXPECT_CALL(*mDisplay, applyDisplayRequests(changes.displayRequests)).Times(1); EXPECT_CALL(*mDisplay, applyLayerRequestsToLayers(changes.layerRequests)).Times(1); EXPECT_CALL(*mDisplay, applyLayerRequestsToLayers(changes.layerRequests)).Times(1); Loading