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

Commit 8d34c905 authored by Jorim Jaggi's avatar Jorim Jaggi
Browse files

Fix jank classification

Make sure to use the correct present fence.

Test: Check jank classification in SysUI
Change-Id: I7ac956486b5a037f852fd7d0e73cd12f1ce756b2
parent 54263095
Loading
Loading
Loading
Loading
+11 −10
Original line number Original line Diff line number Diff line
@@ -1994,11 +1994,6 @@ void SurfaceFlinger::onMessageRefresh() {


    mScheduler->onDisplayRefreshed(presentTime);
    mScheduler->onDisplayRefreshed(presentTime);


    // Set presentation information before calling postComposition, such that jank information from
    // this' frame classification is already available when sending jank info to clients.
    mFrameTimeline->setSfPresent(systemTime(),
                                 std::make_shared<FenceTime>(mPreviousPresentFences[0]));

    postFrame();
    postFrame();
    postComposition();
    postComposition();


@@ -2120,11 +2115,6 @@ void SurfaceFlinger::postComposition() {
    ATRACE_CALL();
    ATRACE_CALL();
    ALOGV("postComposition");
    ALOGV("postComposition");


    nsecs_t dequeueReadyTime = systemTime();
    for (const auto& layer : mLayersWithQueuedFrames) {
        layer->releasePendingBuffer(dequeueReadyTime);
    }

    const auto* display = ON_MAIN_THREAD(getDefaultDisplayDeviceLocked()).get();
    const auto* display = ON_MAIN_THREAD(getDefaultDisplayDeviceLocked()).get();


    getBE().mGlCompositionDoneTimeline.updateSignalTimes();
    getBE().mGlCompositionDoneTimeline.updateSignalTimes();
@@ -2146,6 +2136,17 @@ void SurfaceFlinger::postComposition() {
    auto presentFenceTime = std::make_shared<FenceTime>(mPreviousPresentFences[0]);
    auto presentFenceTime = std::make_shared<FenceTime>(mPreviousPresentFences[0]);
    getBE().mDisplayTimeline.push(presentFenceTime);
    getBE().mDisplayTimeline.push(presentFenceTime);


    // Set presentation information before calling Layer::releasePendingBuffer, such that jank
    // information from previous' frame classification is already available when sending jank info
    // to clients, so they get jank classification as early as possible.
    mFrameTimeline->setSfPresent(systemTime(),
                                 std::make_shared<FenceTime>(mPreviousPresentFences[0]));

    nsecs_t dequeueReadyTime = systemTime();
    for (const auto& layer : mLayersWithQueuedFrames) {
        layer->releasePendingBuffer(dequeueReadyTime);
    }

    const DisplayStatInfo stats = mScheduler->getDisplayStatInfo(systemTime());
    const DisplayStatInfo stats = mScheduler->getDisplayStatInfo(systemTime());


    // We use the CompositionEngine::getLastFrameRefreshTimestamp() which might
    // We use the CompositionEngine::getLastFrameRefreshTimestamp() which might