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

Commit 61dbf969 authored by Alec Mouri's avatar Alec Mouri Committed by Automerger Merge Worker
Browse files

Merge "SF caching: Skip BT601_625 layers for caching and hole-punch" into sc-dev am: 4e700e91

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/native/+/15053426

Change-Id: Ia2beb4931677f34188cb189205cfc7df49ce450e
parents ca0e6dcf 4e700e91
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -141,7 +141,7 @@ public:

    compositionengine::OutputLayer* getBlurLayer() const;

    bool hasHdrLayers() const;
    bool hasUnsupportedDataspace() const;

    bool hasProtectedLayers() const;

+0 −7
Original line number Diff line number Diff line
@@ -242,13 +242,6 @@ public:

    ui::Dataspace getDataspace() const { return mOutputDataspace.get(); }

    bool isHdr() const {
        const ui::Dataspace transfer =
                static_cast<ui::Dataspace>(getDataspace() & ui::Dataspace::TRANSFER_MASK);
        return (transfer == ui::Dataspace::TRANSFER_ST2084 ||
                transfer == ui::Dataspace::TRANSFER_HLG);
    }

    bool isProtected() const {
        return getOutputLayer()->getLayerFE().getCompositionState()->hasProtectedContent;
    }
+17 −6
Original line number Diff line number Diff line
@@ -295,9 +295,7 @@ bool CachedSet::requiresHolePunch() const {
        return false;
    }

    // Do not use a hole punch with an HDR layer; this should be done in client
    // composition to properly mix HDR with SDR.
    if (hasHdrLayers()) {
    if (hasUnsupportedDataspace()) {
        return false;
    }

@@ -352,9 +350,22 @@ compositionengine::OutputLayer* CachedSet::getBlurLayer() const {
    return mBlurLayer ? mBlurLayer->getOutputLayer() : nullptr;
}

bool CachedSet::hasHdrLayers() const {
    return std::any_of(mLayers.cbegin(), mLayers.cend(),
                       [](const Layer& layer) { return layer.getState()->isHdr(); });
bool CachedSet::hasUnsupportedDataspace() const {
    return std::any_of(mLayers.cbegin(), mLayers.cend(), [](const Layer& layer) {
        auto dataspace = layer.getState()->getDataspace();
        const auto transfer = static_cast<ui::Dataspace>(dataspace & ui::Dataspace::TRANSFER_MASK);
        if (transfer == ui::Dataspace::TRANSFER_ST2084 || transfer == ui::Dataspace::TRANSFER_HLG) {
            // Skip HDR.
            return true;
        }

        if ((dataspace & HAL_DATASPACE_STANDARD_MASK) == HAL_DATASPACE_STANDARD_BT601_625) {
            // RenderEngine does not match some DPUs, so skip
            // to avoid flickering/color differences.
            return true;
        }
        return false;
    });
}

bool CachedSet::hasProtectedLayers() const {
+1 −1
Original line number Diff line number Diff line
@@ -420,7 +420,7 @@ std::vector<Flattener::Run> Flattener::findCandidateRuns(time_point now) const {
        const bool layerIsInactive = now - currentSet->getLastUpdate() > mActiveLayerTimeout;
        const bool layerHasBlur = currentSet->hasBlurBehind();
        if (layerIsInactive && (firstLayer || runHasFirstLayer || !layerHasBlur) &&
            !currentSet->hasHdrLayers()) {
            !currentSet->hasUnsupportedDataspace()) {
            if (isPartOfRun) {
                builder.append(currentSet->getLayerCount());
            } else {
+14 −0
Original line number Diff line number Diff line
@@ -457,6 +457,20 @@ TEST_F(CachedSetTest, holePunch_requiresNonHdr) {
    EXPECT_FALSE(cachedSet.requiresHolePunch());
}

TEST_F(CachedSetTest, holePunch_requiresNonBT601_625) {
    mTestLayers[0]->outputLayerCompositionState.dataspace = ui::Dataspace::STANDARD_BT601_625;
    mTestLayers[0]->layerState->update(&mTestLayers[0]->outputLayer);

    CachedSet::Layer& layer = *mTestLayers[0]->cachedSetLayer.get();
    mTestLayers[0]->layerFECompositionState.buffer = sp<GraphicBuffer>::make();
    sp<mock::LayerFE> layerFE = mTestLayers[0]->layerFE;

    CachedSet cachedSet(layer);
    EXPECT_CALL(*layerFE, hasRoundedCorners()).WillRepeatedly(Return(true));

    EXPECT_FALSE(cachedSet.requiresHolePunch());
}

TEST_F(CachedSetTest, requiresHolePunch) {
    CachedSet::Layer& layer = *mTestLayers[0]->cachedSetLayer.get();
    mTestLayers[0]->layerFECompositionState.buffer = sp<GraphicBuffer>::make();
Loading