Avoid blurring and rounded corners without EGL_EXT_protected_content
If the GPU does not support protected content, avoid forcing client
composition for protected layers. This means removing rounded corners.
It also means avoiding blurring when it would require blurring a layer
with protected content.
Bug: 196271643
Test: manual (Netflix, YouTube, ExoDefault) with modified
RenderEngine::supportsProtectedContent()
Change-Id: I9763eb22884e611568b36b2e221ee6d75ec3363e
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index d4230f5..0b11e74 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -895,13 +895,19 @@
compositionengine::OutputLayer* Output::findLayerRequestingBackgroundComposition() const {
compositionengine::OutputLayer* layerRequestingBgComposition = nullptr;
for (auto* layer : getOutputLayersOrderedByZ()) {
- auto* compState = layer->getLayerFE().getCompositionState();
+ const auto* compState = layer->getLayerFE().getCompositionState();
// If any layer has a sideband stream, we will disable blurs. In that case, we don't
// want to force client composition because of the blur.
if (compState->sidebandStream != nullptr) {
return nullptr;
}
+
+ // If RenderEngine cannot render protected content, we cannot blur.
+ if (compState->hasProtectedContent &&
+ !getCompositionEngine().getRenderEngine().supportsProtectedContent()) {
+ return nullptr;
+ }
if (compState->isOpaque) {
continue;
}
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 83d8d9f..6c93113 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -2110,6 +2110,13 @@
}
RoundedCornerState Layer::getRoundedCornerState() const {
+ // Today's DPUs cannot do rounded corners. If RenderEngine cannot render
+ // protected content, remove rounded corners from protected content so it
+ // can be rendered by the DPU.
+ if (isProtected() && !mFlinger->getRenderEngine().supportsProtectedContent()) {
+ return {};
+ }
+
// Get parent settings
RoundedCornerState parentSettings;
const auto& parent = mDrawingParent.promote();