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

Commit 6f8e334c authored by Leon Scroggins III's avatar Leon Scroggins III
Browse files

HolePunchPIP: Do not use hole punch for HDR videos

Fixes: 190210946
Test: libcompositionengine_test

When mixing HDR and SDR content, we need to use client composition to
apply the appropriate gamma scaling and dithering. Skip using the hole
punch, which is used to support device composition + rounded corners.

Change-Id: Ib27063fb1b53bbd8c37381c1a10f020425686035
parent a047b922
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -294,6 +294,12 @@ 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()) {
        return false;
    }

    const auto& layerFE = mLayers[0].getState()->getOutputLayer()->getLayerFE();
    if (layerFE.getCompositionState()->forceClientComposition) {
        return false;
+14 −0
Original line number Diff line number Diff line
@@ -424,6 +424,20 @@ TEST_F(CachedSetTest, holePunch_requiresSingleLayer) {
    EXPECT_FALSE(cachedSet.requiresHolePunch());
}

TEST_F(CachedSetTest, holePunch_requiresNonHdr) {
    mTestLayers[0]->outputLayerCompositionState.dataspace = ui::Dataspace::BT2020_PQ;
    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();