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

Commit 48cca92c authored by Peter Kalauskas's avatar Peter Kalauskas Committed by Wei Wang
Browse files

Revert "Update SF to use createHintSessionWithConfig"

This reverts commit ba180cc1.

Reason for revert: b/324164941, regression to perfetto_ft_systemui-missed_sf_frames-mean

Bug: 324484643
Bug: 324164941
Change-Id: I728ceba0bcad8f5e9a2f866e27e137e1395ae72f
parent ba180cc1
Loading
Loading
Loading
Loading
+3 −7
Original line number Original line Diff line number Diff line
@@ -48,7 +48,6 @@ namespace impl {
using aidl::android::hardware::power::Boost;
using aidl::android::hardware::power::Boost;
using aidl::android::hardware::power::Mode;
using aidl::android::hardware::power::Mode;
using aidl::android::hardware::power::SessionHint;
using aidl::android::hardware::power::SessionHint;
using aidl::android::hardware::power::SessionTag;
using aidl::android::hardware::power::WorkDuration;
using aidl::android::hardware::power::WorkDuration;


PowerAdvisor::~PowerAdvisor() = default;
PowerAdvisor::~PowerAdvisor() = default;
@@ -207,12 +206,9 @@ bool PowerAdvisor::supportsPowerHintSession() {


bool PowerAdvisor::ensurePowerHintSessionRunning() {
bool PowerAdvisor::ensurePowerHintSessionRunning() {
    if (mHintSession == nullptr && !mHintSessionThreadIds.empty() && usePowerHintSession()) {
    if (mHintSession == nullptr && !mHintSessionThreadIds.empty() && usePowerHintSession()) {
        auto ret =
        auto ret = getPowerHal().createHintSession(getpid(), static_cast<int32_t>(getuid()),
                getPowerHal().createHintSessionWithConfig(getpid(), static_cast<int32_t>(getuid()),
                                                   mHintSessionThreadIds, mTargetDuration.ns());
                                                          mHintSessionThreadIds,

                                                          mTargetDuration.ns(),
                                                          SessionTag::SURFACEFLINGER,
                                                          &mSessionConfig);
        if (ret.isOk()) {
        if (ret.isOk()) {
            mHintSession = ret.value();
            mHintSession = ret.value();
        }
        }
+0 −3
Original line number Original line Diff line number Diff line
@@ -292,9 +292,6 @@ private:
    // Whether we should send reportActualWorkDuration calls
    // Whether we should send reportActualWorkDuration calls
    static const bool sUseReportActualDuration;
    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
    // 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 kFenceWaitStartDelayValidated{150us};
    static constexpr const Duration kFenceWaitStartDelaySkippedValidate{250us};
    static constexpr const Duration kFenceWaitStartDelaySkippedValidate{250us};
+7 −9
Original line number Original line Diff line number Diff line
@@ -74,14 +74,12 @@ void PowerAdvisorTest::SetUp() {
void PowerAdvisorTest::startPowerHintSession(bool returnValidSession) {
void PowerAdvisorTest::startPowerHintSession(bool returnValidSession) {
    mMockPowerHintSession = ndk::SharedRefBase::make<NiceMock<MockIPowerHintSession>>();
    mMockPowerHintSession = ndk::SharedRefBase::make<NiceMock<MockIPowerHintSession>>();
    if (returnValidSession) {
    if (returnValidSession) {
        ON_CALL(*mMockPowerHalController, createHintSessionWithConfig)
        ON_CALL(*mMockPowerHalController, createHintSession)
                .WillByDefault(DoAll(SetArgPointee<5>(aidl::android::hardware::power::SessionConfig{
                .WillByDefault(
                                             .id = 12}),
                        Return(HalResult<std::shared_ptr<IPowerHintSession>>::
                        Return(HalResult<std::shared_ptr<IPowerHintSession>>::
                                                    fromStatus(binder::Status::ok(),
                                       fromStatus(binder::Status::ok(), mMockPowerHintSession)));
                                                               mMockPowerHintSession))));
    } else {
    } else {
        ON_CALL(*mMockPowerHalController, createHintSessionWithConfig)
        ON_CALL(*mMockPowerHalController, createHintSession)
                .WillByDefault(Return(HalResult<std::shared_ptr<IPowerHintSession>>::
                .WillByDefault(Return(HalResult<std::shared_ptr<IPowerHintSession>>::
                                              fromStatus(binder::Status::ok(), nullptr)));
                                              fromStatus(binder::Status::ok(), nullptr)));
    }
    }
@@ -285,7 +283,7 @@ TEST_F(PowerAdvisorTest, hintSessionValidWhenNullFromPowerHAL) {
}
}


TEST_F(PowerAdvisorTest, hintSessionOnlyCreatedOnce) {
TEST_F(PowerAdvisorTest, hintSessionOnlyCreatedOnce) {
    EXPECT_CALL(*mMockPowerHalController, createHintSessionWithConfig(_, _, _, _, _, _)).Times(1);
    EXPECT_CALL(*mMockPowerHalController, createHintSession(_, _, _, _)).Times(1);
    mPowerAdvisor->onBootFinished();
    mPowerAdvisor->onBootFinished();
    startPowerHintSession();
    startPowerHintSession();
    mPowerAdvisor->startPowerHintSession({1, 2, 3});
    mPowerAdvisor->startPowerHintSession({1, 2, 3});
@@ -337,7 +335,7 @@ TEST_F(PowerAdvisorTest, hintSessionTestNotifyReportRace) {
        return ndk::ScopedAStatus::fromExceptionCode(-127);
        return ndk::ScopedAStatus::fromExceptionCode(-127);
    });
    });


    ON_CALL(*mMockPowerHalController, createHintSessionWithConfig)
    ON_CALL(*mMockPowerHalController, createHintSession)
            .WillByDefault(Return(
            .WillByDefault(Return(
                    HalResult<std::shared_ptr<IPowerHintSession>>::
                    HalResult<std::shared_ptr<IPowerHintSession>>::
                            fromStatus(ndk::ScopedAStatus::fromExceptionCode(-127), nullptr)));
                            fromStatus(ndk::ScopedAStatus::fromExceptionCode(-127), nullptr)));