Override buffer always sets blend mode and plane alpha
This fixes a caching issue where split screen chrome blanks out the
other side of the split screen, because chrome uses an opaque layer and
is the first layer of the cached set. The opaque bit must not be
propagated to composer, since the cached buffer is allowed to blend with
other layers if there are undamaged regions. Similarly, plane alpha is
already applied when generating the override buffer, so we should not
re-apply a non-zero plane alpha.
Bug: 183480321
Test: libcompositionengine_test
Test: split screen with chrome and recent screen
Change-Id: I22ef304409f15f10435d824e5fab6d0c075d1b9a
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 4832793..fd06de5 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -397,14 +397,17 @@
void OutputLayer::writeOutputIndependentGeometryStateToHWC(
HWC2::Layer* hwcLayer, const LayerFECompositionState& outputIndependentState,
bool skipLayer) {
- if (auto error = hwcLayer->setBlendMode(outputIndependentState.blendMode);
- error != hal::Error::NONE) {
+ const auto blendMode = getState().overrideInfo.buffer
+ ? hardware::graphics::composer::hal::BlendMode::PREMULTIPLIED
+ : outputIndependentState.blendMode;
+ if (auto error = hwcLayer->setBlendMode(blendMode); error != hal::Error::NONE) {
ALOGE("[%s] Failed to set blend mode %s: %s (%d)", getLayerFE().getDebugName(),
- toString(outputIndependentState.blendMode).c_str(), to_string(error).c_str(),
- static_cast<int32_t>(error));
+ toString(blendMode).c_str(), to_string(error).c_str(), static_cast<int32_t>(error));
}
- const float alpha = skipLayer ? 0.0f : outputIndependentState.alpha;
+ const float alpha = skipLayer
+ ? 0.0f
+ : (getState().overrideInfo.buffer ? 1.0f : outputIndependentState.alpha);
ALOGV("Writing alpha %f", alpha);
if (auto error = hwcLayer->setPlaneAlpha(alpha); error != hal::Error::NONE) {