Loading services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -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( Loading Loading @@ -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); Loading @@ -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)), Loading services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ namespace android::compositionengine { namespace { using testing::_; using testing::InSequence; using testing::Return; using testing::ReturnRef; using testing::StrictMock; Loading Loading @@ -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); } Loading Loading
services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp +8 −1 Original line number Diff line number Diff line Loading @@ -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( Loading Loading @@ -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); Loading @@ -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)), Loading
services/surfaceflinger/CompositionEngine/tests/OutputLayerTest.cpp +7 −1 Original line number Diff line number Diff line Loading @@ -33,6 +33,7 @@ namespace android::compositionengine { namespace { using testing::_; using testing::InSequence; using testing::Return; using testing::ReturnRef; using testing::StrictMock; Loading Loading @@ -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); } Loading