SF: pass Color as float to HWC
In HWC3 Color is represented as a float [0.0 - 1.0] to be consistent
across the stack. SF passes the color as float and it gets translated
back to uint8_t for HWC2.
Bug: 207139550
Test: atest SurfaceFlinger_test
Change-Id: I83867eed70bd3baa3292c9cc099d891ba9cc6183
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
index 545e2a2..e8fbe8e 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayer.cpp
@@ -551,10 +551,10 @@
void OutputLayer::writeSolidColorStateToHWC(HWC2::Layer* hwcLayer,
const LayerFECompositionState& outputIndependentState) {
- hal::Color 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)),
- 255};
+ aidl::android::hardware::graphics::composer3::Color color = {outputIndependentState.color.r,
+ outputIndependentState.color.g,
+ outputIndependentState.color.b,
+ 1.0f};
if (auto error = hwcLayer->setColor(color); error != hal::Error::NONE) {
ALOGE("[%s] Failed to set color: %s (%d)", getLayerFE().getDebugName(),