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

Commit 9c7c8a33 authored by Alec Mouri's avatar Alec Mouri Committed by Automerger Merge Worker
Browse files

Merge "Move stats push off of critical path" into rvc-dev am: ce1cb8c6 am: dc5c999f

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/11797957

Change-Id: I39d008a0f974cafc6da53488759310583ce29e19
parents 92f8c5f5 dc5c999f
Loading
Loading
Loading
Loading
+11 −4
Original line number Original line Diff line number Diff line
@@ -1931,6 +1931,7 @@ void SurfaceFlinger::onMessageInvalidate(nsecs_t expectedVSyncTime) {
    // ...but if it's larger than 1s then we missed the trace cutoff.
    // ...but if it's larger than 1s then we missed the trace cutoff.
    static constexpr nsecs_t kMaxJankyDuration =
    static constexpr nsecs_t kMaxJankyDuration =
            std::chrono::duration_cast<std::chrono::nanoseconds>(1s).count();
            std::chrono::duration_cast<std::chrono::nanoseconds>(1s).count();
    nsecs_t jankDurationToUpload = -1;
    // If we're in a user build then don't push any atoms
    // If we're in a user build then don't push any atoms
    if (!mIsUserBuild && mMissedFrameJankCount > 0) {
    if (!mIsUserBuild && mMissedFrameJankCount > 0) {
        const auto display = ON_MAIN_THREAD(getDefaultDisplayDeviceLocked());
        const auto display = ON_MAIN_THREAD(getDefaultDisplayDeviceLocked());
@@ -1942,10 +1943,7 @@ void SurfaceFlinger::onMessageInvalidate(nsecs_t expectedVSyncTime) {
            const nsecs_t currentTime = systemTime();
            const nsecs_t currentTime = systemTime();
            const nsecs_t jankDuration = currentTime - mMissedFrameJankStart;
            const nsecs_t jankDuration = currentTime - mMissedFrameJankStart;
            if (jankDuration > kMinJankyDuration && jankDuration < kMaxJankyDuration) {
            if (jankDuration > kMinJankyDuration && jankDuration < kMaxJankyDuration) {
                ATRACE_NAME("Jank detected");
                jankDurationToUpload = jankDuration;
                const int32_t jankyDurationMillis = jankDuration / (1000 * 1000);
                android::util::stats_write(android::util::DISPLAY_JANK_REPORTED,
                                           jankyDurationMillis, mMissedFrameJankCount);
            }
            }


            // We either reported a jank event or we missed the trace
            // We either reported a jank event or we missed the trace
@@ -1998,6 +1996,7 @@ void SurfaceFlinger::onMessageInvalidate(nsecs_t expectedVSyncTime) {


    refreshNeeded |= mRepaintEverything;
    refreshNeeded |= mRepaintEverything;
    if (refreshNeeded && CC_LIKELY(mBootStage != BootStage::BOOTLOADER)) {
    if (refreshNeeded && CC_LIKELY(mBootStage != BootStage::BOOTLOADER)) {
        mLastJankDuration = jankDurationToUpload;
        // Signal a refresh if a transaction modified the window state,
        // Signal a refresh if a transaction modified the window state,
        // a new buffer was latched, or if HWC has requested a full
        // a new buffer was latched, or if HWC has requested a full
        // repaint
        // repaint
@@ -2304,6 +2303,14 @@ void SurfaceFlinger::postComposition()
    const size_t appConnections = mScheduler->getEventThreadConnectionCount(mAppConnectionHandle);
    const size_t appConnections = mScheduler->getEventThreadConnectionCount(mAppConnectionHandle);
    mTimeStats->recordDisplayEventConnectionCount(sfConnections + appConnections);
    mTimeStats->recordDisplayEventConnectionCount(sfConnections + appConnections);


    if (mLastJankDuration > 0) {
        ATRACE_NAME("Jank detected");
        const int32_t jankyDurationMillis = mLastJankDuration / (1000 * 1000);
        android::util::stats_write(android::util::DISPLAY_JANK_REPORTED, jankyDurationMillis,
                                   mMissedFrameJankCount);
        mLastJankDuration = -1;
    }

    if (isDisplayConnected && !display->isPoweredOn()) {
    if (isDisplayConnected && !display->isPoweredOn()) {
        return;
        return;
    }
    }
+2 −0
Original line number Original line Diff line number Diff line
@@ -1287,6 +1287,8 @@ private:
    // janky frames there are.
    // janky frames there are.
    nsecs_t mMissedFrameJankStart = 0;
    nsecs_t mMissedFrameJankStart = 0;
    int32_t mMissedFrameJankCount = 0;
    int32_t mMissedFrameJankCount = 0;
    // Positive if jank should be uploaded in postComposition
    nsecs_t mLastJankDuration = -1;


    int mFrameRateFlexibilityTokenCount = 0;
    int mFrameRateFlexibilityTokenCount = 0;