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

Commit a8a4597e authored by Matt Buckley's avatar Matt Buckley
Browse files

Account for refresh rate in sf adpf hint session rate limiter

Currently, the SurfaceFlinger hint session rate limiter will send hints
after 80ms of inactivity regardless of refresh rate, which can lead to
issues at lower rates (eg: 30fps) where we skip the window that we
should send the hint in and go stale. This patch addresses that
oversight.

Bug: b/240473968
Test: manual
Change-Id: I27ce9229537e445f202e948ab201cc0242882667
parent 2c9b0191
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -759,9 +759,10 @@ void AidlPowerHalWrapper::setTargetWorkDuration(int64_t targetDuration) {
}

bool AidlPowerHalWrapper::shouldReportActualDurations() {
    // Report if we have never reported before or are approaching a stale session
    // Report if we have never reported before or will go stale next frame
    if (!mLastActualDurationSent.has_value() ||
        (systemTime() - mLastActualReportTimestamp) > kStaleTimeout.count()) {
        (mLastTargetDurationSent + systemTime() - mLastActualReportTimestamp) >
                kStaleTimeout.count()) {
        return true;
    }

+1 −1
Original line number Diff line number Diff line
@@ -332,7 +332,7 @@ private:
    static const bool sTraceHintSessionData;
    static constexpr const std::chrono::nanoseconds kDefaultTarget = 16ms;
    // Amount of time after the last message was sent before the session goes stale
    // actually 100ms but we use 80 here to ideally avoid going stale
    // actually 100ms but we use 80 here to give some slack
    static constexpr const std::chrono::nanoseconds kStaleTimeout = 80ms;
};