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

Commit 332e6baf authored by Vishnu Nair's avatar Vishnu Nair
Browse files

SF: Pass the release fence to the owning layer instead of the clone

Cloned layers do not have references to the callback handle so we
were dropping the release fence from clone layers presented on other
displays.

Test: presubmit
Fixes: 244427869
Change-Id: I0e202a84357c60d769a531cfadd748f0346aaa65
parent 5fc135bf
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -838,6 +838,11 @@ public:
    void updateMetadataSnapshot(const LayerMetadata& parentMetadata);
    void updateRelativeMetadataSnapshot(const LayerMetadata& relativeLayerMetadata,
                                        std::unordered_set<Layer*>& visited);
    sp<Layer> getClonedFrom() const {
        return mClonedFrom != nullptr ? mClonedFrom.promote() : nullptr;
    }
    bool isClone() { return mClonedFrom != nullptr; }

    bool willPresentCurrentTransaction() const;

    void callReleaseBufferCallback(const sp<ITransactionCompletedListener>& listener,
@@ -861,10 +866,6 @@ protected:
    void gatherBufferInfo();
    void onSurfaceFrameCreated(const std::shared_ptr<frametimeline::SurfaceFrame>&);

    sp<Layer> getClonedFrom() const {
        return mClonedFrom != nullptr ? mClonedFrom.promote() : nullptr;
    }
    bool isClone() { return mClonedFrom != nullptr; }
    bool isClonedFromAlive() { return getClonedFrom() != nullptr; }

    void cloneDrawingState(const Layer* from);
+3 −1
Original line number Diff line number Diff line
@@ -2544,7 +2544,9 @@ void SurfaceFlinger::composite(TimePoint frameTime, VsyncId vsyncId)
        CompositionResult compositionResult{layerFE->stealCompositionResult()};
        layer->onPreComposition(compositionResult.refreshStartTime);
        for (auto releaseFence : compositionResult.releaseFences) {
            layer->onLayerDisplayed(releaseFence);
            Layer* clonedFrom = layer->getClonedFrom().get();
            auto owningLayer = clonedFrom ? clonedFrom : layer;
            owningLayer->onLayerDisplayed(releaseFence);
        }
        if (compositionResult.lastClientCompositionFence) {
            layer->setWasClientComposed(compositionResult.lastClientCompositionFence);