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

Commit f6fe81ab authored by Huihong Luo's avatar Huihong Luo Committed by Android (Google) Code Review
Browse files

Merge changes from topic "bug240653315" into main

* changes:
  Fix a crash for skipped layers with null buffers
  Revert "Skip SOLID_COLOR layers from SF Caching"
parents 88217126 5e16196c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -147,8 +147,6 @@ public:

    bool hasProtectedLayers() const;

    bool hasSolidColorLayers() const;

    // True if any layer in this cached set has CachingHint::Disabled
    bool cachingHintExcludesLayers() const;

+0 −5
Original line number Diff line number Diff line
@@ -258,11 +258,6 @@ public:

    gui::CachingHint getCachingHint() const { return mCachingHint.get(); }

    bool hasSolidColorCompositionType() const {
        return getOutputLayer()->getLayerFE().getCompositionState()->compositionType ==
                aidl::android::hardware::graphics::composer3::Composition::SOLID_COLOR;
    }

    float getFps() const { return getOutputLayer()->getLayerFE().getCompositionState()->fps; }

    void dump(std::string& result) const;
+3 −1
Original line number Diff line number Diff line
@@ -394,7 +394,6 @@ void OutputLayer::writeStateToHWC(bool includeGeometry, bool skipLayer, uint32_t
    auto requestedCompositionType = outputIndependentState->compositionType;

    if (requestedCompositionType == Composition::SOLID_COLOR && state.overrideInfo.buffer) {
        // this should never happen, as SOLID_COLOR is skipped from caching, b/230073351
        requestedCompositionType = Composition::DEVICE;
    }

@@ -665,6 +664,9 @@ void OutputLayer::uncacheBuffers(const std::vector<uint64_t>& bufferIdsToUncache
void OutputLayer::writeBufferStateToHWC(HWC2::Layer* hwcLayer,
                                        const LayerFECompositionState& outputIndependentState,
                                        bool skipLayer) {
    if (skipLayer && outputIndependentState.buffer == nullptr) {
        return;
    }
    auto supportedPerFrameMetadata =
            getOutput().getDisplayColorProfile()->getSupportedPerFrameMetadata();
    if (auto error = hwcLayer->setPerFrameMetadata(supportedPerFrameMetadata,
+0 −6
Original line number Diff line number Diff line
@@ -393,12 +393,6 @@ bool CachedSet::hasProtectedLayers() const {
                       [](const Layer& layer) { return layer.getState()->isProtected(); });
}

bool CachedSet::hasSolidColorLayers() const {
    return std::any_of(mLayers.cbegin(), mLayers.cend(), [](const Layer& layer) {
        return layer.getState()->hasSolidColorCompositionType();
    });
}

bool CachedSet::cachingHintExcludesLayers() const {
    const bool shouldExcludeLayers =
            std::any_of(mLayers.cbegin(), mLayers.cend(), [](const Layer& layer) {
+0 −7
Original line number Diff line number Diff line
@@ -513,13 +513,6 @@ void Flattener::buildCachedSets(time_point now) {
        }
    }

    for (const CachedSet& layer : mLayers) {
        if (layer.hasSolidColorLayers()) {
            ATRACE_NAME("layer->hasSolidColorLayers()");
            return;
        }
    }

    std::vector<Run> runs = findCandidateRuns(now);

    std::optional<Run> bestRun = findBestRun(runs);