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

Commit 8da2359e authored by Ady Abraham's avatar Ady Abraham Committed by android-build-merger
Browse files

SurfaceFlinger: store fps instead of duration in LayerInfo am: 187d2d81

am: 85cf8199

Change-Id: If875d32c000f9ae35444f7c7b2cbcdd8db75c306
parents 0356d4bf 85cf8199
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -50,7 +50,8 @@ void LayerInfo::setLastPresentTime(nsecs_t lastPresentTime) {
    // Ignore time diff that are too high - those are stale values
    if (timeDiff > OBSOLETE_TIME_EPSILON_NS.count()) return;
    const nsecs_t refreshDuration = (timeDiff > 0) ? timeDiff : mMinRefreshDuration;
    mRefreshRateHistory.insertRefreshRate(refreshDuration);
    const int fps = 1e9f / refreshDuration;
    mRefreshRateHistory.insertRefreshRate(fps);
}

} // namespace scheduler
+5 −5
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class LayerInfo {
    public:
        explicit RefreshRateHistory(nsecs_t minRefreshDuration)
              : mMinRefreshDuration(minRefreshDuration) {}
        void insertRefreshRate(nsecs_t refreshRate) {
        void insertRefreshRate(int refreshRate) {
            mElements.push_back(refreshRate);
            if (mElements.size() > HISTORY_SIZE) {
                mElements.pop_front();
@@ -54,13 +54,13 @@ class LayerInfo {
        }

        float getRefreshRateAvg() const {
            nsecs_t refreshDuration = mMinRefreshDuration;
            if (mElements.size() > 0) {
                refreshDuration = scheduler::calculate_mean(mElements);
            if (mElements.empty()) {
                return 1e9f / mMinRefreshDuration;
            }

            return 1e9f / refreshDuration;
            return scheduler::calculate_mean(mElements);
        }

        void clearHistory() { mElements.clear(); }

    private: