@@ -611,7 +611,11 @@ void SurfaceFrame::classifyJankLocked(int32_t displayFrameJankType, const Fps& r
611611 mFrameReadyMetadata = FrameReadyMetadata::OnTimeFinish;
612612 }
613613
614- if (std::abs (presentDelta) > mJankClassificationThresholds .presentThreshold ) {
614+ const nsecs_t presentThreshold =
615+ FlagManager::getInstance ().increase_missed_frame_jank_threshold ()
616+ ? mJankClassificationThresholds .presentThresholdExtended
617+ : mJankClassificationThresholds .presentThresholdLegacy ;
618+ if (std::abs (presentDelta) > presentThreshold) {
615619 mFramePresentMetadata = presentDelta > 0 ? FramePresentMetadata::LatePresent
616620 : FramePresentMetadata::EarlyPresent;
617621 // Jank that is missing by less than the render rate period is classified as partial jank,
@@ -629,9 +633,8 @@ void SurfaceFrame::classifyJankLocked(int32_t displayFrameJankType, const Fps& r
629633 } else if (mFramePresentMetadata == FramePresentMetadata::EarlyPresent) {
630634 if (mFrameReadyMetadata == FrameReadyMetadata::OnTimeFinish) {
631635 // Finish on time, Present early
632- if (deltaToVsync < mJankClassificationThresholds .presentThreshold ||
633- deltaToVsync >= refreshRate.getPeriodNsecs () -
634- mJankClassificationThresholds .presentThreshold ) {
636+ if (deltaToVsync < presentThreshold ||
637+ deltaToVsync >= refreshRate.getPeriodNsecs () - presentThreshold) {
635638 // Delta factor of vsync
636639 mJankType = JankType::SurfaceFlingerScheduling;
637640 } else {
@@ -667,9 +670,8 @@ void SurfaceFrame::classifyJankLocked(int32_t displayFrameJankType, const Fps& r
667670 if (!(mJankType & JankType::BufferStuffing)) {
668671 // In a stuffed state, if the app finishes on time and there is no display frame
669672 // jank, only buffer stuffing is the root cause of the jank.
670- if (deltaToVsync < mJankClassificationThresholds .presentThreshold ||
671- deltaToVsync >= refreshRate.getPeriodNsecs () -
672- mJankClassificationThresholds .presentThreshold ) {
673+ if (deltaToVsync < presentThreshold ||
674+ deltaToVsync >= refreshRate.getPeriodNsecs () - presentThreshold) {
673675 // Delta factor of vsync
674676 mJankType |= JankType::SurfaceFlingerScheduling;
675677 } else {
@@ -1091,7 +1093,11 @@ void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t&
10911093 ? std::abs (presentDelta) % mRefreshRate .getPeriodNsecs ()
10921094 : 0 ;
10931095
1094- if (std::abs (presentDelta) > mJankClassificationThresholds .presentThreshold ) {
1096+ nsecs_t presentThreshold = FlagManager::getInstance ().increase_missed_frame_jank_threshold ()
1097+ ? mJankClassificationThresholds .presentThresholdExtended
1098+ : mJankClassificationThresholds .presentThresholdLegacy ;
1099+
1100+ if (std::abs (presentDelta) > presentThreshold) {
10951101 mFramePresentMetadata = presentDelta > 0 ? FramePresentMetadata::LatePresent
10961102 : FramePresentMetadata::EarlyPresent;
10971103 // Jank that is missing by less than the render rate period is classified as partial jank,
@@ -1122,9 +1128,8 @@ void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t&
11221128 if (mFramePresentMetadata == FramePresentMetadata::EarlyPresent) {
11231129 if (mFrameReadyMetadata == FrameReadyMetadata::OnTimeFinish) {
11241130 // Finish on time, Present early
1125- if (deltaToVsync < mJankClassificationThresholds .presentThreshold ||
1126- deltaToVsync >= (mRefreshRate .getPeriodNsecs () -
1127- mJankClassificationThresholds .presentThreshold )) {
1131+ if (deltaToVsync < presentThreshold ||
1132+ deltaToVsync >= (mRefreshRate .getPeriodNsecs () - presentThreshold)) {
11281133 // Delta is a factor of vsync if its within the presentTheshold on either side
11291134 // of the vsyncPeriod. Example: 0-2ms and 9-11ms are both within the threshold
11301135 // of the vsyncPeriod if the threshold was 2ms and the vsyncPeriod was 11ms.
@@ -1142,7 +1147,7 @@ void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t&
11421147 }
11431148 } else if (mFramePresentMetadata == FramePresentMetadata::LatePresent) {
11441149 if (std::abs (mSurfaceFlingerPredictions .presentTime - previousPresentTime) <=
1145- mJankClassificationThresholds . presentThreshold ||
1150+ presentThreshold ||
11461151 previousPresentTime > mSurfaceFlingerPredictions .presentTime ) {
11471152 // The previous frame was either presented in the current frame's expected vsync or
11481153 // it was presented even later than the current frame's expected vsync.
@@ -1151,9 +1156,8 @@ void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t&
11511156 if (mFrameReadyMetadata == FrameReadyMetadata::OnTimeFinish &&
11521157 !(mJankType & JankType::SurfaceFlingerStuffing)) {
11531158 // Finish on time, Present late
1154- if (deltaToVsync < mJankClassificationThresholds .presentThreshold ||
1155- deltaToVsync >= (mRefreshRate .getPeriodNsecs () -
1156- mJankClassificationThresholds .presentThreshold )) {
1159+ if (deltaToVsync < presentThreshold ||
1160+ deltaToVsync >= (mRefreshRate .getPeriodNsecs () - presentThreshold)) {
11571161 // Delta is a factor of vsync if its within the presentTheshold on either side
11581162 // of the vsyncPeriod. Example: 0-2ms and 9-11ms are both within the threshold
11591163 // of the vsyncPeriod if the threshold was 2ms and the vsyncPeriod was 11ms.
@@ -1165,8 +1169,7 @@ void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t&
11651169 } else if (mFrameReadyMetadata == FrameReadyMetadata::LateFinish) {
11661170 if (!(mJankType & JankType::SurfaceFlingerStuffing) ||
11671171 mSurfaceFlingerActuals .presentTime - previousPresentTime >
1168- mRefreshRate .getPeriodNsecs () +
1169- mJankClassificationThresholds .presentThreshold ) {
1172+ mRefreshRate .getPeriodNsecs () + presentThreshold) {
11701173 // Classify CPU vs GPU if SF wasn't stuffed or if SF was stuffed but this frame
11711174 // was presented more than a vsync late.
11721175 if (mGpuFence != FenceTime::NO_FENCE) {
0 commit comments