Loading services/surfaceflinger/CompositionEngine/include/compositionengine/DisplayCreationArgs.h +9 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,10 @@ struct DisplayCreationArgs { // True if this display should be considered secure bool isSecure = false; // True if this display should be considered protected, as in this display should render DRM // content. bool isProtected = false; // Optional pointer to the power advisor interface, if one is needed for // this display. Hwc2::PowerAdvisor* powerAdvisor = nullptr; Loading Loading @@ -73,6 +77,11 @@ public: return *this; } DisplayCreationArgsBuilder& setIsProtected(bool isProtected) { mArgs.isProtected = isProtected; return *this; } DisplayCreationArgsBuilder& setPowerAdvisor(Hwc2::PowerAdvisor* powerAdvisor) { mArgs.powerAdvisor = powerAdvisor; return *this; Loading services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +3 −4 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public: const bool isSecure; // If set to true, the target buffer has protected content support. const bool supportsProtectedContent; const bool isProtected; // Viewport of the target being rendered to. This is used to determine // the shadow light position. Loading Loading @@ -167,8 +167,7 @@ using LayerFESet = std::unordered_set<sp<LayerFE>, LayerFESpHash>; static inline bool operator==(const LayerFE::ClientCompositionTargetSettings& lhs, const LayerFE::ClientCompositionTargetSettings& rhs) { return lhs.clip.hasSameRects(rhs.clip) && lhs.needsFiltering == rhs.needsFiltering && lhs.isSecure == rhs.isSecure && lhs.supportsProtectedContent == rhs.supportsProtectedContent && lhs.isSecure == rhs.isSecure && lhs.isProtected == rhs.isProtected && lhs.viewport == rhs.viewport && lhs.dataspace == rhs.dataspace && lhs.realContentIsVisible == rhs.realContentIsVisible && lhs.clearContent == rhs.clearContent; Loading @@ -189,7 +188,7 @@ static inline void PrintTo(const LayerFE::ClientCompositionTargetSettings& setti PrintTo(settings.clip, os); *os << "\n .needsFiltering = " << settings.needsFiltering; *os << "\n .isSecure = " << settings.isSecure; *os << "\n .supportsProtectedContent = " << settings.supportsProtectedContent; *os << "\n .isProtected = " << settings.isProtected; *os << "\n .viewport = "; PrintTo(settings.viewport, os); *os << "\n .dataspace = "; Loading services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputCompositionState.h +3 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,9 @@ struct OutputCompositionState { // If false, this output is not considered secure bool isSecure{false}; // If false, this output is not considered protected bool isProtected{false}; // If true, the current frame on this output uses client composition bool usesClientComposition{false}; Loading services/surfaceflinger/CompositionEngine/src/Display.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ void Display::setConfiguration(const compositionengine::DisplayCreationArgs& arg mId = args.id; mPowerAdvisor = args.powerAdvisor; editState().isSecure = args.isSecure; editState().isProtected = args.isProtected; editState().displaySpace.setBounds(args.pixels); setName(args.name); } Loading services/surfaceflinger/CompositionEngine/src/Output.cpp +17 −5 Original line number Diff line number Diff line Loading @@ -1232,10 +1232,18 @@ void Output::updateProtectedContentState() { auto& renderEngine = getCompositionEngine().getRenderEngine(); const bool supportsProtectedContent = renderEngine.supportsProtectedContent(); // If we the display is secure, protected content support is enabled, and at // least one layer has protected content, we need to use a secure back // buffer. if (outputState.isSecure && supportsProtectedContent) { bool isProtected; if (FlagManager::getInstance().display_protected()) { isProtected = outputState.isProtected; } else { isProtected = outputState.isSecure; } // We need to set the render surface as protected (DRM) if all the following conditions are met: // 1. The display is protected (in legacy, check if the display is secure) // 2. Protected content is supported // 3. At least one layer has protected content. if (isProtected && supportsProtectedContent) { auto layers = getOutputLayersOrderedByZ(); bool needsProtected = std::any_of(layers.begin(), layers.end(), [](auto* layer) { return layer->getLayerFE().getCompositionState()->hasProtectedContent; Loading Loading @@ -1475,12 +1483,16 @@ std::vector<LayerFE::LayerSettings> Output::generateClientCompositionRequests( BlurRegionsOnly : LayerFE::ClientCompositionTargetSettings::BlurSetting:: Enabled); bool isProtected = supportsProtectedContent; if (FlagManager::getInstance().display_protected()) { isProtected = outputState.isProtected && supportsProtectedContent; } compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{.clip = clip, .needsFiltering = layer->needsFiltering() || outputState.needsFiltering, .isSecure = outputState.isSecure, .supportsProtectedContent = supportsProtectedContent, .isProtected = isProtected, .viewport = outputState.layerStackSpace.getContent(), .dataspace = outputDataspace, .realContentIsVisible = realContentIsVisible, Loading Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/DisplayCreationArgs.h +9 −0 Original line number Diff line number Diff line Loading @@ -42,6 +42,10 @@ struct DisplayCreationArgs { // True if this display should be considered secure bool isSecure = false; // True if this display should be considered protected, as in this display should render DRM // content. bool isProtected = false; // Optional pointer to the power advisor interface, if one is needed for // this display. Hwc2::PowerAdvisor* powerAdvisor = nullptr; Loading Loading @@ -73,6 +77,11 @@ public: return *this; } DisplayCreationArgsBuilder& setIsProtected(bool isProtected) { mArgs.isProtected = isProtected; return *this; } DisplayCreationArgsBuilder& setPowerAdvisor(Hwc2::PowerAdvisor* powerAdvisor) { mArgs.powerAdvisor = powerAdvisor; return *this; Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/LayerFE.h +3 −4 Original line number Diff line number Diff line Loading @@ -97,7 +97,7 @@ public: const bool isSecure; // If set to true, the target buffer has protected content support. const bool supportsProtectedContent; const bool isProtected; // Viewport of the target being rendered to. This is used to determine // the shadow light position. Loading Loading @@ -167,8 +167,7 @@ using LayerFESet = std::unordered_set<sp<LayerFE>, LayerFESpHash>; static inline bool operator==(const LayerFE::ClientCompositionTargetSettings& lhs, const LayerFE::ClientCompositionTargetSettings& rhs) { return lhs.clip.hasSameRects(rhs.clip) && lhs.needsFiltering == rhs.needsFiltering && lhs.isSecure == rhs.isSecure && lhs.supportsProtectedContent == rhs.supportsProtectedContent && lhs.isSecure == rhs.isSecure && lhs.isProtected == rhs.isProtected && lhs.viewport == rhs.viewport && lhs.dataspace == rhs.dataspace && lhs.realContentIsVisible == rhs.realContentIsVisible && lhs.clearContent == rhs.clearContent; Loading @@ -189,7 +188,7 @@ static inline void PrintTo(const LayerFE::ClientCompositionTargetSettings& setti PrintTo(settings.clip, os); *os << "\n .needsFiltering = " << settings.needsFiltering; *os << "\n .isSecure = " << settings.isSecure; *os << "\n .supportsProtectedContent = " << settings.supportsProtectedContent; *os << "\n .isProtected = " << settings.isProtected; *os << "\n .viewport = "; PrintTo(settings.viewport, os); *os << "\n .dataspace = "; Loading
services/surfaceflinger/CompositionEngine/include/compositionengine/impl/OutputCompositionState.h +3 −0 Original line number Diff line number Diff line Loading @@ -53,6 +53,9 @@ struct OutputCompositionState { // If false, this output is not considered secure bool isSecure{false}; // If false, this output is not considered protected bool isProtected{false}; // If true, the current frame on this output uses client composition bool usesClientComposition{false}; Loading
services/surfaceflinger/CompositionEngine/src/Display.cpp +1 −0 Original line number Diff line number Diff line Loading @@ -57,6 +57,7 @@ void Display::setConfiguration(const compositionengine::DisplayCreationArgs& arg mId = args.id; mPowerAdvisor = args.powerAdvisor; editState().isSecure = args.isSecure; editState().isProtected = args.isProtected; editState().displaySpace.setBounds(args.pixels); setName(args.name); } Loading
services/surfaceflinger/CompositionEngine/src/Output.cpp +17 −5 Original line number Diff line number Diff line Loading @@ -1232,10 +1232,18 @@ void Output::updateProtectedContentState() { auto& renderEngine = getCompositionEngine().getRenderEngine(); const bool supportsProtectedContent = renderEngine.supportsProtectedContent(); // If we the display is secure, protected content support is enabled, and at // least one layer has protected content, we need to use a secure back // buffer. if (outputState.isSecure && supportsProtectedContent) { bool isProtected; if (FlagManager::getInstance().display_protected()) { isProtected = outputState.isProtected; } else { isProtected = outputState.isSecure; } // We need to set the render surface as protected (DRM) if all the following conditions are met: // 1. The display is protected (in legacy, check if the display is secure) // 2. Protected content is supported // 3. At least one layer has protected content. if (isProtected && supportsProtectedContent) { auto layers = getOutputLayersOrderedByZ(); bool needsProtected = std::any_of(layers.begin(), layers.end(), [](auto* layer) { return layer->getLayerFE().getCompositionState()->hasProtectedContent; Loading Loading @@ -1475,12 +1483,16 @@ std::vector<LayerFE::LayerSettings> Output::generateClientCompositionRequests( BlurRegionsOnly : LayerFE::ClientCompositionTargetSettings::BlurSetting:: Enabled); bool isProtected = supportsProtectedContent; if (FlagManager::getInstance().display_protected()) { isProtected = outputState.isProtected && supportsProtectedContent; } compositionengine::LayerFE::ClientCompositionTargetSettings targetSettings{.clip = clip, .needsFiltering = layer->needsFiltering() || outputState.needsFiltering, .isSecure = outputState.isSecure, .supportsProtectedContent = supportsProtectedContent, .isProtected = isProtected, .viewport = outputState.layerStackSpace.getContent(), .dataspace = outputDataspace, .realContentIsVisible = realContentIsVisible, Loading