Communicate composition buffer dataspace to HWC
Test: adb shell dumpsys SurfaceFlinger
look for dataspace info in DisplayDevice section
Bug: 63146977
Change-Id: If427171994fbc91faacf5bad9cc736ddfbd35ec3
(cherry picked from commit 79d272442ce13418c3ea81c95d7fea0159b4b481)
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 63f260a..0ae5209 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -383,6 +383,7 @@
#ifdef USE_HWC2
sp<DisplayDevice> hw(getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]));
if (hw->getWideColorSupport()) {
+ hw->setCompositionDataSpace(HAL_DATASPACE_V0_SRGB);
setActiveColorModeInternal(hw, HAL_COLOR_MODE_SRGB);
}
#endif
@@ -1222,6 +1223,7 @@
hasWideColorModes && hasWideColorDisplay);
mDisplays.add(token, hw);
setActiveColorModeInternal(hw, HAL_COLOR_MODE_NATIVE);
+ hw->setCompositionDataSpace(HAL_DATASPACE_UNKNOWN);
}
void SurfaceFlinger::onHotplugReceived(HWComposer* composer, int32_t disp, bool connected) {
@@ -1871,6 +1873,7 @@
// To achieve this we suppress color mode changes until after the boot animation
if (mBootFinished) {
setActiveColorModeInternal(displayDevice, newColorMode);
+ displayDevice->setCompositionDataSpace(newDataSpace);
}
}
}