Loading services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ namespace impl { using aidl::android::hardware::power::Boost; using aidl::android::hardware::power::Mode; using aidl::android::hardware::power::SessionHint; using aidl::android::hardware::power::SessionTag; using aidl::android::hardware::power::WorkDuration; PowerAdvisor::~PowerAdvisor() = default; Loading Loading @@ -207,12 +206,9 @@ bool PowerAdvisor::supportsPowerHintSession() { bool PowerAdvisor::ensurePowerHintSessionRunning() { if (mHintSession == nullptr && !mHintSessionThreadIds.empty() && usePowerHintSession()) { auto ret = getPowerHal().createHintSessionWithConfig(getpid(), static_cast<int32_t>(getuid()), mHintSessionThreadIds, mTargetDuration.ns(), SessionTag::SURFACEFLINGER, &mSessionConfig); auto ret = getPowerHal().createHintSession(getpid(), static_cast<int32_t>(getuid()), mHintSessionThreadIds, mTargetDuration.ns()); if (ret.isOk()) { mHintSession = ret.value(); } Loading services/surfaceflinger/DisplayHardware/PowerAdvisor.h +0 −3 Original line number Diff line number Diff line Loading @@ -292,9 +292,6 @@ private: // Whether we should send reportActualWorkDuration calls static const bool sUseReportActualDuration; // Metadata about the session returned from PowerHAL aidl::android::hardware::power::SessionConfig mSessionConfig; // How long we expect hwc to run after the present call until it waits for the fence static constexpr const Duration kFenceWaitStartDelayValidated{150us}; static constexpr const Duration kFenceWaitStartDelaySkippedValidate{250us}; Loading services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -74,14 +74,12 @@ void PowerAdvisorTest::SetUp() { void PowerAdvisorTest::startPowerHintSession(bool returnValidSession) { mMockPowerHintSession = ndk::SharedRefBase::make<NiceMock<MockIPowerHintSession>>(); if (returnValidSession) { ON_CALL(*mMockPowerHalController, createHintSessionWithConfig) .WillByDefault(DoAll(SetArgPointee<5>(aidl::android::hardware::power::SessionConfig{ .id = 12}), ON_CALL(*mMockPowerHalController, createHintSession) .WillByDefault( Return(HalResult<std::shared_ptr<IPowerHintSession>>:: fromStatus(binder::Status::ok(), mMockPowerHintSession)))); fromStatus(binder::Status::ok(), mMockPowerHintSession))); } else { ON_CALL(*mMockPowerHalController, createHintSessionWithConfig) ON_CALL(*mMockPowerHalController, createHintSession) .WillByDefault(Return(HalResult<std::shared_ptr<IPowerHintSession>>:: fromStatus(binder::Status::ok(), nullptr))); } Loading Loading @@ -285,7 +283,7 @@ TEST_F(PowerAdvisorTest, hintSessionValidWhenNullFromPowerHAL) { } TEST_F(PowerAdvisorTest, hintSessionOnlyCreatedOnce) { EXPECT_CALL(*mMockPowerHalController, createHintSessionWithConfig(_, _, _, _, _, _)).Times(1); EXPECT_CALL(*mMockPowerHalController, createHintSession(_, _, _, _)).Times(1); mPowerAdvisor->onBootFinished(); startPowerHintSession(); mPowerAdvisor->startPowerHintSession({1, 2, 3}); Loading Loading @@ -337,7 +335,7 @@ TEST_F(PowerAdvisorTest, hintSessionTestNotifyReportRace) { return ndk::ScopedAStatus::fromExceptionCode(-127); }); ON_CALL(*mMockPowerHalController, createHintSessionWithConfig) ON_CALL(*mMockPowerHalController, createHintSession) .WillByDefault(Return( HalResult<std::shared_ptr<IPowerHintSession>>:: fromStatus(ndk::ScopedAStatus::fromExceptionCode(-127), nullptr))); Loading Loading
services/surfaceflinger/DisplayHardware/PowerAdvisor.cpp +3 −7 Original line number Diff line number Diff line Loading @@ -48,7 +48,6 @@ namespace impl { using aidl::android::hardware::power::Boost; using aidl::android::hardware::power::Mode; using aidl::android::hardware::power::SessionHint; using aidl::android::hardware::power::SessionTag; using aidl::android::hardware::power::WorkDuration; PowerAdvisor::~PowerAdvisor() = default; Loading Loading @@ -207,12 +206,9 @@ bool PowerAdvisor::supportsPowerHintSession() { bool PowerAdvisor::ensurePowerHintSessionRunning() { if (mHintSession == nullptr && !mHintSessionThreadIds.empty() && usePowerHintSession()) { auto ret = getPowerHal().createHintSessionWithConfig(getpid(), static_cast<int32_t>(getuid()), mHintSessionThreadIds, mTargetDuration.ns(), SessionTag::SURFACEFLINGER, &mSessionConfig); auto ret = getPowerHal().createHintSession(getpid(), static_cast<int32_t>(getuid()), mHintSessionThreadIds, mTargetDuration.ns()); if (ret.isOk()) { mHintSession = ret.value(); } Loading
services/surfaceflinger/DisplayHardware/PowerAdvisor.h +0 −3 Original line number Diff line number Diff line Loading @@ -292,9 +292,6 @@ private: // Whether we should send reportActualWorkDuration calls static const bool sUseReportActualDuration; // Metadata about the session returned from PowerHAL aidl::android::hardware::power::SessionConfig mSessionConfig; // How long we expect hwc to run after the present call until it waits for the fence static constexpr const Duration kFenceWaitStartDelayValidated{150us}; static constexpr const Duration kFenceWaitStartDelaySkippedValidate{250us}; Loading
services/surfaceflinger/tests/unittests/PowerAdvisorTest.cpp +7 −9 Original line number Diff line number Diff line Loading @@ -74,14 +74,12 @@ void PowerAdvisorTest::SetUp() { void PowerAdvisorTest::startPowerHintSession(bool returnValidSession) { mMockPowerHintSession = ndk::SharedRefBase::make<NiceMock<MockIPowerHintSession>>(); if (returnValidSession) { ON_CALL(*mMockPowerHalController, createHintSessionWithConfig) .WillByDefault(DoAll(SetArgPointee<5>(aidl::android::hardware::power::SessionConfig{ .id = 12}), ON_CALL(*mMockPowerHalController, createHintSession) .WillByDefault( Return(HalResult<std::shared_ptr<IPowerHintSession>>:: fromStatus(binder::Status::ok(), mMockPowerHintSession)))); fromStatus(binder::Status::ok(), mMockPowerHintSession))); } else { ON_CALL(*mMockPowerHalController, createHintSessionWithConfig) ON_CALL(*mMockPowerHalController, createHintSession) .WillByDefault(Return(HalResult<std::shared_ptr<IPowerHintSession>>:: fromStatus(binder::Status::ok(), nullptr))); } Loading Loading @@ -285,7 +283,7 @@ TEST_F(PowerAdvisorTest, hintSessionValidWhenNullFromPowerHAL) { } TEST_F(PowerAdvisorTest, hintSessionOnlyCreatedOnce) { EXPECT_CALL(*mMockPowerHalController, createHintSessionWithConfig(_, _, _, _, _, _)).Times(1); EXPECT_CALL(*mMockPowerHalController, createHintSession(_, _, _, _)).Times(1); mPowerAdvisor->onBootFinished(); startPowerHintSession(); mPowerAdvisor->startPowerHintSession({1, 2, 3}); Loading Loading @@ -337,7 +335,7 @@ TEST_F(PowerAdvisorTest, hintSessionTestNotifyReportRace) { return ndk::ScopedAStatus::fromExceptionCode(-127); }); ON_CALL(*mMockPowerHalController, createHintSessionWithConfig) ON_CALL(*mMockPowerHalController, createHintSession) .WillByDefault(Return( HalResult<std::shared_ptr<IPowerHintSession>>:: fromStatus(ndk::ScopedAStatus::fromExceptionCode(-127), nullptr))); Loading