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

Commit a6d8fbf4 authored by Aaron Whyte's avatar Aaron Whyte
Browse files

Revert "Break down jank between frame drops vs. triple buffered"

This reverts commit 09979fbe.

Reason for revert: Based on stacktraces and change history, I think this is causing a cluster of P crashes.
https://b.corp.google.com/issues?q=(%22android%22%20%22:uirenderer::JankTracker::finishFrame%22)
Bug: 75566601
Bug: 75811585
Bug: 75407175
Bug: 75736222
Bug: 75391447
Bug: 75659839

Change-Id: I59a8c2d8906d347210c77fb3628f5801bc299bfb
parent 09979fbe
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -56,7 +56,7 @@ message GraphicsStatsJankSummaryProto {
    // Number of "missed vsync" events.
    // Number of "missed vsync" events.
    optional int32 missed_vsync_count = 3;
    optional int32 missed_vsync_count = 3;


    // Number of frames in triple-buffering scenario (high input latency)
    // Number of "high input latency" events.
    optional int32 high_input_latency_count = 4;
    optional int32 high_input_latency_count = 4;


    // Number of "slow UI thread" events.
    // Number of "slow UI thread" events.
@@ -67,9 +67,6 @@ message GraphicsStatsJankSummaryProto {


    // Number of "slow draw" events.
    // Number of "slow draw" events.
    optional int32 slow_draw_count = 7;
    optional int32 slow_draw_count = 7;

    // Number of frames that missed their deadline (aka, visibly janked)
    optional int32 missed_deadline_count = 8;
}
}


message GraphicsStatsHistogramBucketProto {
message GraphicsStatsHistogramBucketProto {
+6 −26
Original line number Original line Diff line number Diff line
@@ -129,42 +129,22 @@ void JankTracker::finishFrame(const FrameInfo& frame) {
            totalDuration -= forgiveAmount;
            totalDuration -= forgiveAmount;
        }
        }
    }
    }

    LOG_ALWAYS_FATAL_IF(totalDuration <= 0, "Impossible totalDuration %" PRId64, totalDuration);
    LOG_ALWAYS_FATAL_IF(totalDuration <= 0, "Impossible totalDuration %" PRId64, totalDuration);
    mData->reportFrame(totalDuration);
    mData->reportFrame(totalDuration);
    (*mGlobalData)->reportFrame(totalDuration);
    (*mGlobalData)->reportFrame(totalDuration);


    // Only things like Surface.lockHardwareCanvas() are exempt from tracking
    // Keep the fast path as fast as possible.
    if (CC_UNLIKELY(frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS)) {
    if (CC_LIKELY(totalDuration < mFrameInterval)) {
        return;
        return;
    }
    }


    if (totalDuration > mFrameInterval) {
    // Only things like Surface.lockHardwareCanvas() are exempt from tracking
        mData->reportJank();
    if (frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS) {
        (*mGlobalData)->reportJank();
    }

    bool isTripleBuffered = mSwapDeadline > frame[FrameInfoIndex::IntendedVsync];

    mSwapDeadline = std::max(mSwapDeadline + mFrameInterval,
                             frame[FrameInfoIndex::IntendedVsync] + mFrameInterval);

    // If we hit the deadline, cool!
    if (frame[FrameInfoIndex::FrameCompleted] < mSwapDeadline) {
        if (isTripleBuffered) {
            mData->reportJankType(JankType::kHighInputLatency);
            (*mGlobalData)->reportJankType(JankType::kHighInputLatency);
        }
        return;
        return;
    }
    }


    mData->reportJankType(JankType::kMissedDeadline);
    mData->reportJank();
    (*mGlobalData)->reportJankType(JankType::kMissedDeadline);
    (*mGlobalData)->reportJank();

    // Janked, reset the swap deadline
    nsecs_t jitterNanos = frame[FrameInfoIndex::FrameCompleted] - frame[FrameInfoIndex::Vsync];
    nsecs_t lastFrameOffset = jitterNanos % mFrameInterval;
    mSwapDeadline = frame[FrameInfoIndex::FrameCompleted] - lastFrameOffset + mFrameInterval;


    for (int i = 0; i < NUM_BUCKETS; i++) {
    for (int i = 0; i < NUM_BUCKETS; i++) {
        int64_t delta = frame.duration(COMPARISONS[i].start, COMPARISONS[i].end);
        int64_t delta = frame.duration(COMPARISONS[i].start, COMPARISONS[i].end);
+0 −1
Original line number Original line Diff line number Diff line
@@ -75,7 +75,6 @@ private:


    std::array<int64_t, NUM_BUCKETS> mThresholds;
    std::array<int64_t, NUM_BUCKETS> mThresholds;
    int64_t mFrameInterval;
    int64_t mFrameInterval;
    nsecs_t mSwapDeadline;
    // The amount of time we will erase from the total duration to account
    // The amount of time we will erase from the total duration to account
    // for SF vsync offsets with HWC2 blocking dequeueBuffers.
    // for SF vsync offsets with HWC2 blocking dequeueBuffers.
    // (Vsync + mDequeueBlockTolerance) is the point at which we expect
    // (Vsync + mDequeueBlockTolerance) is the point at which we expect
+2 −1
Original line number Original line Diff line number Diff line
@@ -23,7 +23,8 @@ namespace uirenderer {


static const char* JANK_TYPE_NAMES[] = {
static const char* JANK_TYPE_NAMES[] = {
        "Missed Vsync",        "High input latency",       "Slow UI thread",
        "Missed Vsync",        "High input latency",       "Slow UI thread",
        "Slow bitmap uploads", "Slow issue draw commands", "Frame deadline missed"};
        "Slow bitmap uploads", "Slow issue draw commands",
};


// The bucketing algorithm controls so to speak
// The bucketing algorithm controls so to speak
// If a frame is <= to this it goes in bucket 0
// If a frame is <= to this it goes in bucket 0
+0 −1
Original line number Original line Diff line number Diff line
@@ -33,7 +33,6 @@ enum JankType {
    kSlowUI,
    kSlowUI,
    kSlowSync,
    kSlowSync,
    kSlowRT,
    kSlowRT,
    kMissedDeadline,


    // must be last
    // must be last
    NUM_BUCKETS,
    NUM_BUCKETS,
Loading