Fix "Abnormal while playing netflix in PIP mode"
protected buffer usage of output buffer of framebuffer is determined by
if any input layer contains protected buffer.
If all the protected layers are handled by HWC,then GPU will process
normal layers only. It means, GPU got normal buffer as input but need
output to protected buffer.It would be memory violation for ARM as it
required at least one normal buffer as input for such case
Cherry-picked from AOSP. Conflicts in the test file are uninteresting;
both branches simply added new tests.
- services/surfaceflinger/CompositionEngine/tests/OutputTest.cpp
Put the behavior change behind a flag.
Bug: 307674749
Test: atest
libcompositionengine_test:OutputUpdateProtectedContentStateTest
Change-Id: I11d7c73c8eee4a46383516e8eb672827b26314e6
diff --git a/services/surfaceflinger/CompositionEngine/src/Output.cpp b/services/surfaceflinger/CompositionEngine/src/Output.cpp
index 1c2f6cb..921e05d 100644
--- a/services/surfaceflinger/CompositionEngine/src/Output.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/Output.cpp
@@ -1276,7 +1276,9 @@
if (isProtected && supportsProtectedContent) {
auto layers = getOutputLayersOrderedByZ();
bool needsProtected = std::any_of(layers.begin(), layers.end(), [](auto* layer) {
- return layer->getLayerFE().getCompositionState()->hasProtectedContent;
+ return layer->getLayerFE().getCompositionState()->hasProtectedContent &&
+ (!FlagManager::getInstance().protected_if_client() ||
+ layer->requiresClientComposition());
});
if (needsProtected != mRenderSurface->isProtected()) {
mRenderSurface->setProtected(needsProtected);