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

Commit 2eae6d38 authored by Rajavenu Kyatham's avatar Rajavenu Kyatham Committed by Yichi Chen
Browse files

SurfaceFlinger: Consider parent alpha as well

sf: Use layer alpha derived from parent layer

Layer::getAlpha() function derives the plane alpha value for child
layer from its parent layer. This alpha value is passed across all
the composition devices like MDP and GPU for all child layers. But
while clearing the FB region, only child layer alpha is checked
instead of derived alpha value from parent. This causes FB clear to
happen for non opaque layer results in flickering effect. Use derived
alpha value from parent to fix the issue

SF: Consider parent alpha as well in dim layer

Consider parent alpha as well in dim layer during client
composition same as device composition.

Bug: b/110632776
Test: Run sffakehwc_test with new test cases in ChildColorLayerTest
Change-Id: I99f320e0224f77ca1596f08d259d56907f82d6cc
parent 7fea6fe1
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -68,8 +68,7 @@ void ColorLayer::drawNow(const RenderArea& renderArea, bool useIdentityTransform
}
}


bool ColorLayer::isVisible() const {
bool ColorLayer::isVisible() const {
    const Layer::State& s(getDrawingState());
    return !isHiddenByPolicy() && getAlpha() > 0.0f;
    return !isHiddenByPolicy() && s.color.a;
}
}


void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
void ColorLayer::setPerFrameData(const sp<const DisplayDevice>& display) {
+2 −1
Original line number Original line Diff line number Diff line
@@ -3214,7 +3214,8 @@ bool SurfaceFlinger::doComposeSurfaces(const sp<const DisplayDevice>& display) {
                case HWC2::Composition::SolidColor: {
                case HWC2::Composition::SolidColor: {
                    const Layer::State& state(layer->getDrawingState());
                    const Layer::State& state(layer->getDrawingState());
                    if (layer->getClearClientTarget(displayId) && !firstLayer &&
                    if (layer->getClearClientTarget(displayId) && !firstLayer &&
                        layer->isOpaque(state) && (state.color.a == 1.0f) && hasClientComposition) {
                        layer->isOpaque(state) && (layer->getAlpha() == 1.0f) &&
                        hasClientComposition) {
                        // never clear the very first layer since we're
                        // never clear the very first layer since we're
                        // guaranteed the FB is already cleared
                        // guaranteed the FB is already cleared
                        layer->clearWithOpenGL(renderArea);
                        layer->clearWithOpenGL(renderArea);