Detect doubleStuffed frame when duration is over 2*interval
Current doubleStuffed deadline calculation is based on the assumption
that frame duration cannot go beyond 2*interval. But we see on TV
with many >2*interval cases and device is still rendering without
frame drop.
See details in go/jank-tracker-deadline-fix-on-s
Test: build adt3_gtv-userdebug on T, verified gfxinfo is no longer
reporting a high number of "deadline missed"
Test: new test in JankTrackerTests
Bug: 189942694
Change-Id: Id9be2d0d232b89c6e145ecec513054ca8c752814
diff --git a/libs/hwui/JankTracker.cpp b/libs/hwui/JankTracker.cpp
index 1e5be6c..4b0ddd2 100644
--- a/libs/hwui/JankTracker.cpp
+++ b/libs/hwui/JankTracker.cpp
@@ -201,8 +201,9 @@
// If we are in triple buffering, we have enough buffers in queue to sustain a single frame
// drop without jank, so adjust the frame interval to the deadline.
if (isTripleBuffered) {
- deadline += frameInterval;
- frame.set(FrameInfoIndex::FrameDeadline) += frameInterval;
+ int64_t originalDeadlineDuration = deadline - frame[FrameInfoIndex::IntendedVsync];
+ deadline = mNextFrameStartUnstuffed + originalDeadlineDuration;
+ frame.set(FrameInfoIndex::FrameDeadline) = deadline;
}
// If we hit the deadline, cool!