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

Commit 660628f2 authored by Alec Mouri's avatar Alec Mouri Committed by Android (Google) Code Review
Browse files

Merge "Expose gl/hwc switch counts from timestats." into rvc-dev

parents 78cc3ba8 8f7a010d
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -2094,6 +2094,8 @@ void SurfaceFlinger::handleMessageRefresh() {
    postFrame();
    postComposition();

    const bool prevFrameHadDeviceComposition = mHadDeviceComposition;

    mHadClientComposition =
            std::any_of(mDisplays.cbegin(), mDisplays.cend(), [](const auto& tokenDisplayPair) {
                auto& displayDevice = tokenDisplayPair.second;
@@ -2111,6 +2113,11 @@ void SurfaceFlinger::handleMessageRefresh() {
                return displayDevice->getCompositionDisplay()->getState().reusedClientComposition;
            });

    // Only report a strategy change if we move in and out of composition with hw overlays
    if (prevFrameHadDeviceComposition != mHadDeviceComposition) {
        mTimeStats->incrementCompositionStrategyChanges();
    }

    mVSyncModulator->onRefreshed(mHadClientComposition);

    mLayersWithQueuedFrames.clear();
+10 −0
Original line number Diff line number Diff line
@@ -290,6 +290,15 @@ void TimeStats::incrementRefreshRateSwitches() {
    mTimeStats.refreshRateSwitches++;
}

void TimeStats::incrementCompositionStrategyChanges() {
    if (!mEnabled.load()) return;

    ATRACE_CALL();

    std::lock_guard<std::mutex> lock(mMutex);
    mTimeStats.compositionStrategyChanges++;
}

void TimeStats::recordDisplayEventConnectionCount(int32_t count) {
    if (!mEnabled.load()) return;

@@ -844,6 +853,7 @@ void TimeStats::clearGlobalLocked() {
    mTimeStats.clientCompositionFrames = 0;
    mTimeStats.clientCompositionReusedFrames = 0;
    mTimeStats.refreshRateSwitches = 0;
    mTimeStats.compositionStrategyChanges = 0;
    mTimeStats.displayEventConnectionsCount = 0;
    mTimeStats.displayOnTime = 0;
    mTimeStats.presentToPresent.hist.clear();
+5 −0
Original line number Diff line number Diff line
@@ -54,6 +54,10 @@ public:
    virtual void incrementClientCompositionReusedFrames() = 0;
    // Increments the number of times the display refresh rate changed.
    virtual void incrementRefreshRateSwitches() = 0;
    // Increments the number of changes in composition strategy
    // The intention is to reflect the number of changes between hwc and gpu
    // composition, where "gpu composition" may also include mixed composition.
    virtual void incrementCompositionStrategyChanges() = 0;
    // Records the most up-to-date count of display event connections.
    // The stored count will be the maximum ever recoded.
    virtual void recordDisplayEventConnectionCount(int32_t count) = 0;
@@ -218,6 +222,7 @@ public:
    void incrementClientCompositionFrames() override;
    void incrementClientCompositionReusedFrames() override;
    void incrementRefreshRateSwitches() override;
    void incrementCompositionStrategyChanges() override;
    void recordDisplayEventConnectionCount(int32_t count) override;

    void recordFrameDuration(nsecs_t startTime, nsecs_t endTime) override;
+1 −0
Original line number Diff line number Diff line
@@ -106,6 +106,7 @@ std::string TimeStatsHelper::TimeStatsGlobal::toString(std::optional<uint32_t> m
    StringAppendF(&result, "clientCompositionFrames = %d\n", clientCompositionFrames);
    StringAppendF(&result, "clientCompositionReusedFrames = %d\n", clientCompositionReusedFrames);
    StringAppendF(&result, "refreshRateSwitches = %d\n", refreshRateSwitches);
    StringAppendF(&result, "compositionStrategyChanges = %d\n", compositionStrategyChanges);
    StringAppendF(&result, "displayOnTime = %" PRId64 " ms\n", displayOnTime);
    StringAppendF(&result, "displayConfigStats is as below:\n");
    for (const auto& [fps, duration] : refreshRateStats) {
+1 −0
Original line number Diff line number Diff line
@@ -63,6 +63,7 @@ public:
        int32_t clientCompositionFrames = 0;
        int32_t clientCompositionReusedFrames = 0;
        int32_t refreshRateSwitches = 0;
        int32_t compositionStrategyChanges = 0;
        int32_t displayEventConnectionsCount = 0;
        int64_t displayOnTime = 0;
        Histogram presentToPresent;
Loading