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

Commit 43d28cbc authored by Vishnu Nair's avatar Vishnu Nair Committed by Android (Google) Code Review
Browse files

Merge "SF: Fix onSurfaceFrameCreated for layers without buffers"

parents ea28fbe0 22491b8d
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1294,7 +1294,6 @@ std::shared_ptr<frametimeline::SurfaceFrame> Layer::createSurfaceFrameForBuffer(
    if (fps) {
        surfaceFrame->setRenderRate(*fps);
    }
    // TODO(b/178542907): Implement onSurfaceFrameCreated for BQLayer as well.
    onSurfaceFrameCreated(surfaceFrame);
    return surfaceFrame;
}
@@ -2703,6 +2702,10 @@ 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
+5 −1
Original line number Diff line number Diff line
@@ -1082,6 +1082,10 @@ private:
        return ((mSidebandStream != nullptr) || (mBufferInfo.mBuffer != nullptr));
    }

    bool hasBufferOrSidebandStreamInDrawing() const {
        return ((mDrawingState.sidebandStream != nullptr) || (mDrawingState.buffer != nullptr));
    }

    bool hasSomethingToDraw() const { return hasEffect() || hasBufferOrSidebandStream(); }

    void updateChildrenSnapshots(bool updateGeometry);
@@ -1157,7 +1161,7 @@ private:

    std::deque<std::shared_ptr<android::frametimeline::SurfaceFrame>> mPendingJankClassifications;
    // An upper bound on the number of SurfaceFrames in the pending classifications deque.
    static constexpr int kPendingClassificationMaxSurfaceFrames = 25;
    static constexpr int kPendingClassificationMaxSurfaceFrames = 50;

    const std::string mBlastTransactionName{"BufferTX - " + mName};
    // This integer is incremented everytime a buffer arrives at the server for this layer,