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

Commit 6cb6100d authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "Release buffers early after GL comp"

parents c63d74ac ccab4245
Loading
Loading
Loading
Loading
+21 −0
Original line number Diff line number Diff line
@@ -132,6 +132,20 @@ status_t BufferStateLayer::addReleaseFence(const sp<CallbackHandle>& ch,
// Interface implementation for Layer
// -----------------------------------------------------------------------
void BufferStateLayer::onLayerDisplayed(const sp<Fence>& releaseFence) {

    // If a layer has been displayed again we may need to clear
    // the mLastClientComposition fence that we use for early release in setBuffer
    // (as we now have a new fence which won't pass through the client composition path in some cases
    //  e.g. screenshot). We expect one call to onLayerDisplayed after receiving the GL comp fence
    // from a single composition cycle, and want to clear on the second call
    // (which we track with mLastClientCompositionDisplayed)
   if (mLastClientCompositionDisplayed) {
        mLastClientCompositionFence = nullptr;
        mLastClientCompositionDisplayed = false;
    } else if (mLastClientCompositionFence) {
        mLastClientCompositionDisplayed = true;
    }

    if (!releaseFence->isValid()) {
        return;
    }
@@ -474,6 +488,13 @@ bool BufferStateLayer::setBuffer(const BufferData& bufferData, nsecs_t postTime,
              addSurfaceFrameDroppedForBuffer(mDrawingState.bufferSurfaceFrameTX);
              mDrawingState.bufferSurfaceFrameTX.reset();
            }
        } else if (mLastClientCompositionFence != nullptr) {
            callReleaseBufferCallback(mDrawingState.releaseBufferListener,
                                      mDrawingState.buffer->getBuffer(), mDrawingState.frameNumber,
                                      mLastClientCompositionFence, mTransformHint,
                                      mFlinger->getMaxAcquiredBufferCountForCurrentRefreshRate(
                                          mOwnerUid));
            mLastClientCompositionFence = nullptr;
        }
    }

+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ public:

    // Whether the layer should be rendered with rounded corners.
    virtual bool hasRoundedCorners() const = 0;
    virtual void setWasClientComposed(const sp<Fence>&) {}
};

// TODO(b/121291683): Specialize std::hash<> for sp<T> so these and others can
+2 −1
Original line number Diff line number Diff line
@@ -286,7 +286,8 @@ protected:
    virtual bool getSkipColorTransform() const = 0;
    virtual FrameFences presentAndGetFrameFences() = 0;
    virtual std::vector<LayerFE::LayerSettings> generateClientCompositionRequests(
            bool supportsProtectedContent, ui::Dataspace outputDataspace) = 0;
            bool supportsProtectedContent, ui::Dataspace outputDataspace,
            std::vector<LayerFE*> &outLayerRef) = 0;
    virtual void appendRegionFlashRequests(
            const Region& flashRegion,
            std::vector<LayerFE::LayerSettings>& clientCompositionLayers) = 0;
+2 −1
Original line number Diff line number Diff line
@@ -113,7 +113,8 @@ protected:
    bool getSkipColorTransform() const override;
    compositionengine::Output::FrameFences presentAndGetFrameFences() override;
    std::vector<LayerFE::LayerSettings> generateClientCompositionRequests(
            bool supportsProtectedContent, ui::Dataspace outputDataspace) override;
          bool supportsProtectedContent, ui::Dataspace outputDataspace,
          std::vector<LayerFE*> &outLayerFEs) override;
    void appendRegionFlashRequests(const Region&, std::vector<LayerFE::LayerSettings>&) override;
    void setExpensiveRenderingExpected(bool enabled) override;
    void dumpBase(std::string&) const;
+2 −2
Original line number Diff line number Diff line
@@ -114,8 +114,8 @@ public:
    MOCK_METHOD1(renderCachedSets, void(const CompositionRefreshArgs&));
    MOCK_METHOD0(presentAndGetFrameFences, compositionengine::Output::FrameFences());

    MOCK_METHOD2(generateClientCompositionRequests,
                 std::vector<LayerFE::LayerSettings>(bool, ui::Dataspace));
    MOCK_METHOD3(generateClientCompositionRequests,
                 std::vector<LayerFE::LayerSettings>(bool, ui::Dataspace, std::vector<compositionengine::LayerFE*>&));
    MOCK_METHOD2(appendRegionFlashRequests,
                 void(const Region&, std::vector<LayerFE::LayerSettings>&));
    MOCK_METHOD1(setExpensiveRenderingExpected, void(bool));
Loading