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

Commit 00a0bb94 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "CE: Fix color layer HWC call ordering"

parents 0bfca6a8 46b72df7
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -326,6 +326,9 @@ void OutputLayer::writeStateToHWC(bool includeGeometry) {
    writeOutputIndependentPerFrameStateToHWC(hwcLayer.get(), outputIndependentState);

    writeCompositionTypeToHWC(hwcLayer.get(), requestedCompositionType);

    // Always set the layer color after setting the composition type.
    writeSolidColorStateToHWC(hwcLayer.get(), outputIndependentState);
}

void OutputLayer::writeOutputDependentGeometryStateToHWC(
@@ -435,7 +438,7 @@ void OutputLayer::writeOutputIndependentPerFrameStateToHWC(
    // Content-specific per-frame state
    switch (outputIndependentState.compositionType) {
        case Hwc2::IComposerClient::Composition::SOLID_COLOR:
            writeSolidColorStateToHWC(hwcLayer, outputIndependentState);
            // For compatibility, should be written AFTER the composition type.
            break;
        case Hwc2::IComposerClient::Composition::SIDEBAND:
            writeSidebandStateToHWC(hwcLayer, outputIndependentState);
@@ -453,6 +456,10 @@ void OutputLayer::writeOutputIndependentPerFrameStateToHWC(

void OutputLayer::writeSolidColorStateToHWC(HWC2::Layer* hwcLayer,
                                            const LayerFECompositionState& outputIndependentState) {
    if (outputIndependentState.compositionType != Hwc2::IComposerClient::Composition::SOLID_COLOR) {
        return;
    }

    hwc_color_t color = {static_cast<uint8_t>(std::round(255.0f * outputIndependentState.color.r)),
                         static_cast<uint8_t>(std::round(255.0f * outputIndependentState.color.g)),
                         static_cast<uint8_t>(std::round(255.0f * outputIndependentState.color.b)),
+7 −1
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ namespace android::compositionengine {
namespace {

using testing::_;
using testing::InSequence;
using testing::Return;
using testing::ReturnRef;
using testing::StrictMock;
@@ -769,8 +770,13 @@ TEST_F(OutputLayerWriteStateToHWCTest, canSetPerFrameStateForSolidColor) {
    mLayerFEState.compositionType = Hwc2::IComposerClient::Composition::SOLID_COLOR;

    expectPerFrameCommonCalls();
    expectSetColorCall();

    // Setting the composition type should happen before setting the color. We
    // check this in this test only by setting up an testing::InSeqeuence
    // instance before setting up the two expectations.
    InSequence s;
    expectSetCompositionTypeCall(Hwc2::IComposerClient::Composition::SOLID_COLOR);
    expectSetColorCall();

    mOutputLayer.writeStateToHWC(false);
}