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

Commit 5ff61b87 authored by Pascal Mütschard's avatar Pascal Mütschard Committed by Android (Google) Code Review
Browse files

Merge "Track jank classification for bufferless layers."

parents 492cf57a 55626261
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -2662,18 +2662,18 @@ void Layer::onLayerDisplayed(ftl::SharedFuture<FenceResult> futureFenceResult) {

void Layer::onSurfaceFrameCreated(
        const std::shared_ptr<frametimeline::SurfaceFrame>& surfaceFrame) {
    if (!hasBufferOrSidebandStreamInDrawing()) {
        return;
    }

    while (mPendingJankClassifications.size() >= kPendingClassificationMaxSurfaceFrames) {
        // Too many SurfaceFrames pending classification. The front of the deque is probably not
        // tracked by FrameTimeline and will never be presented. This will only result in a memory
        // leak.
        if (hasBufferOrSidebandStreamInDrawing()) {
            // Only log for layers with a buffer, since we expect the jank data to be drained for
            // these, while there may be no jank listeners for bufferless layers.
            ALOGW("Removing the front of pending jank deque from layer - %s to prevent memory leak",
                  mName.c_str());
            std::string miniDump = mPendingJankClassifications.front()->miniDump();
            ALOGD("Head SurfaceFrame mini dump\n%s", miniDump.c_str());
        }
        mPendingJankClassifications.pop_front();
    }
    mPendingJankClassifications.emplace_back(surfaceFrame);