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

Commit 999a7fda authored by Fabien Sanglard's avatar Fabien Sanglard
Browse files

Fix protected content playback via HWC2on1Adapter

The adapter marked unsupported dataspace layer with HWC_SKIP_LAYER
which prevented HWC to mark protected content with HWC_OVERLAY.

Test: AUPT
Change-Id: Id8c05c7e575ffcc4160cdd8d23b151c4901b4c5c
parent 2dcb6983
Loading
Loading
Loading
Loading
+9 −5
Original line number Diff line number Diff line
@@ -1298,6 +1298,7 @@ bool HWC2On1Adapter::Display::prepare()
        auto& hwc1Layer = mHwc1RequestedContents->hwLayers[layer->getHwc1Id()];
        hwc1Layer.releaseFenceFd = -1;
        hwc1Layer.acquireFenceFd = -1;
        ALOGV("Applying states for layer %" PRIu64 " ", layer->getId());
        layer->applyState(hwc1Layer, applyAllState);
    }

@@ -2009,7 +2010,6 @@ HWC2On1Adapter::Layer::Layer(Display& display)
    mZ(0),
    mReleaseFence(),
    mHwc1Id(0),
    mHasUnsupportedDataspace(false),
    mHasUnsupportedPlaneAlpha(false) {}

bool HWC2On1Adapter::SortLayersByZ::operator()(
@@ -2070,9 +2070,8 @@ Error HWC2On1Adapter::Layer::setCompositionType(Composition type)
    return Error::None;
}

Error HWC2On1Adapter::Layer::setDataspace(android_dataspace_t dataspace)
Error HWC2On1Adapter::Layer::setDataspace(android_dataspace_t)
{
    mHasUnsupportedDataspace = (dataspace != HAL_DATASPACE_UNKNOWN);
    return Error::None;
}

@@ -2318,8 +2317,13 @@ void HWC2On1Adapter::Layer::applyCompositionType(hwc_layer_1_t& hwc1Layer,
    // HWC1 never supports color transforms or dataspaces and only sometimes
    // supports plane alpha (depending on the version). These require us to drop
    // some or all layers to client composition.
    if (mHasUnsupportedDataspace || mHasUnsupportedPlaneAlpha ||
            mDisplay.hasColorTransform() || mHasUnsupportedBackgroundColor) {
    ALOGV("applyCompositionType");
    ALOGV("mHasUnsupportedPlaneAlpha = %d", mHasUnsupportedPlaneAlpha);
    ALOGV("mDisplay.hasColorTransform() = %d", mDisplay.hasColorTransform());
    ALOGV("mHasUnsupportedBackgroundColor = %d", mHasUnsupportedBackgroundColor);

    if (mHasUnsupportedPlaneAlpha || mDisplay.hasColorTransform() ||
        mHasUnsupportedBackgroundColor) {
        hwc1Layer.compositionType = HWC_FRAMEBUFFER;
        hwc1Layer.flags = HWC_SKIP_LAYER;
        return;
+0 −1
Original line number Diff line number Diff line
@@ -605,7 +605,6 @@ private:
            DeferredFence mReleaseFence;

            size_t mHwc1Id;
            bool mHasUnsupportedDataspace;
            bool mHasUnsupportedPlaneAlpha;
            bool mHasUnsupportedBackgroundColor;
    };