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

Commit 3d398a08 authored by Matt Buckley's avatar Matt Buckley
Browse files

Clean up PowerAdvisor callbacks in Display

Move passing skippedValidate info to the rest of the callbacks, and
send "requiresClientComposition" information as early as possible to
make potential load change hints easier.

Test: manual
Change-Id: I28ac3c9826ed2bad8c304eb38c9b92c9160c3934
parent 6278ca24
Loading
Loading
Loading
Loading
+11 −11
Original line number Diff line number Diff line
@@ -248,12 +248,17 @@ bool Display::chooseCompositionStrategy(
        return false;
    }

    const TimePoint startTime = TimePoint::now();

    // Get any composition changes requested by the HWC device, and apply them.
    std::optional<android::HWComposer::DeviceRequestedChanges> changes;
    auto& hwc = getCompositionEngine().getHwComposer();
    const bool requiresClientComposition = anyLayersRequireClientComposition();

    if (isPowerHintSessionEnabled()) {
        mPowerAdvisor->setRequiresClientComposition(mId, requiresClientComposition);
    }

    const TimePoint hwcValidateStartTime = TimePoint::now();

    if (status_t result =
                hwc.getDeviceCompositionChanges(*halDisplayId, requiresClientComposition,
                                                getState().earliestPresentTime,
@@ -266,8 +271,10 @@ bool Display::chooseCompositionStrategy(
    }

    if (isPowerHintSessionEnabled()) {
        mPowerAdvisor->setHwcValidateTiming(mId, startTime, TimePoint::now());
        mPowerAdvisor->setRequiresClientComposition(mId, requiresClientComposition);
        mPowerAdvisor->setHwcValidateTiming(mId, hwcValidateStartTime, TimePoint::now());
        if (auto halDisplayId = HalDisplayId::tryCast(mId)) {
            mPowerAdvisor->setSkippedValidate(mId, hwc.getValidateSkipped(*halDisplayId));
        }
    }

    return true;
@@ -432,13 +439,6 @@ void Display::finishFrame(const compositionengine::CompositionRefreshArgs& refre
    }

    impl::Output::finishFrame(refreshArgs, std::move(result));

    if (isPowerHintSessionEnabled()) {
        auto& hwc = getCompositionEngine().getHwComposer();
        if (auto halDisplayId = HalDisplayId::tryCast(mId)) {
            mPowerAdvisor->setSkippedValidate(mId, hwc.getValidateSkipped(*halDisplayId));
        }
    }
}

} // namespace android::compositionengine::impl