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

Commit 406f2f73 authored by Android Build Merger (Role)'s avatar Android Build Merger (Role) Committed by Android (Google) Code Review
Browse files

Merge "Merge "Break down jank between frame drops vs. triple buffered" into...

Merge "Merge "Break down jank between frame drops vs. triple buffered" into pi-dev am: 613783a9 am: ae0dbf5e"
parents 3bfc346e 2f6a2c70
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ message GraphicsStatsJankSummaryProto {
    // Number of "missed vsync" events.
    optional int32 missed_vsync_count = 3;

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

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

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

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

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

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

    // Keep the fast path as fast as possible.
    if (CC_LIKELY(totalDuration < mFrameInterval)) {
        return;
    }

    // Only things like Surface.lockHardwareCanvas() are exempt from tracking
    if (frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS) {
    if (CC_UNLIKELY(frame[FrameInfoIndex::Flags] & EXEMPT_FRAMES_FLAGS)) {
        return;
    }

    if (totalDuration > mFrameInterval) {
        mData->reportJank();
        (*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;
    }

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

    // 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++) {
        int64_t delta = frame.duration(COMPARISONS[i].start, COMPARISONS[i].end);
+1 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ private:

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

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

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

    // must be last
    NUM_BUCKETS,
Loading