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

Commit e90a2051 authored by Ady Abraham's avatar Ady Abraham Committed by Android (Google) Code Review
Browse files

Merge "SF: treat prediction expired as app missed deadline"

parents 2c752e7e e43ff72e
Loading
Loading
Loading
Loading
+10 −5
Original line number Diff line number Diff line
@@ -492,17 +492,22 @@ std::string SurfaceFrame::miniDump() const {

void SurfaceFrame::classifyJankLocked(int32_t displayFrameJankType, const Fps& refreshRate,
                                      nsecs_t& deadlineDelta) {
    if (mPredictionState == PredictionState::Expired ||
        mActuals.presentTime == Fence::SIGNAL_TIME_INVALID) {
    if (mActuals.presentTime == Fence::SIGNAL_TIME_INVALID) {
        // Cannot do any classification for invalid present time.
        // For prediction expired case, we do not know what happened here to classify this
        // correctly. This could potentially be AppDeadlineMissed but that's assuming no app will
        // request frames 120ms apart.
        mJankType = JankType::Unknown;
        deadlineDelta = -1;
        return;
    }

    if (mPredictionState == PredictionState::Expired) {
        // We classify prediction expired as AppDeadlineMissed as the
        // TokenManager::kMaxTokens we store is large enough to account for a
        // reasonable app, so prediction expire would mean a huge scheduling delay.
        mJankType = JankType::AppDeadlineMissed;
        deadlineDelta = -1;
        return;
    }

    if (mPredictionState == PredictionState::None) {
        // Cannot do jank classification on frames that don't have a token.
        return;
+2 −2
Original line number Diff line number Diff line
@@ -1279,7 +1279,7 @@ TEST_F(FrameTimelineTest, traceSurfaceFrame_emitsValidTracePacket) {
    validateTraceEvent(actualSurfaceFrameEnd2, protoPresentedSurfaceFrameActualEnd);
}

TEST_F(FrameTimelineTest, traceSurfaceFrame_predictionExpiredDoesNotTraceExpectedTimeline) {
TEST_F(FrameTimelineTest, traceSurfaceFrame_predictionExpiredIsAppMissedDeadline) {
    auto tracingSession = getTracingSessionForTest();
    auto presentFence1 = fenceFactory.createFenceTimeForTest(Fence::NO_FENCE);

@@ -1312,7 +1312,7 @@ TEST_F(FrameTimelineTest, traceSurfaceFrame_predictionExpiredDoesNotTraceExpecte
            createProtoActualSurfaceFrameStart(traceCookie + 1, surfaceFrameToken,
                                               displayFrameToken, sPidOne, sLayerNameOne,
                                               FrameTimelineEvent::PRESENT_UNSPECIFIED, false,
                                               false, FrameTimelineEvent::JANK_UNKNOWN,
                                               false, FrameTimelineEvent::JANK_APP_DEADLINE_MISSED,
                                               FrameTimelineEvent::PREDICTION_EXPIRED, true);
    auto protoActualSurfaceFrameEnd = createProtoFrameEnd(traceCookie + 1);