Communicate composition buffer dataspace to HWC
Test: adb shell dumpsys SurfaceFlinger
look for dataspace info in DisplayDevice section
Bug: 63146977
Change-Id: If427171994fbc91faacf5bad9cc736ddfbd35ec3
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index bcc30f6..2d05d9c 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -385,6 +385,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
@@ -1224,6 +1225,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) {
@@ -1872,6 +1874,7 @@
// To achieve this we suppress color mode changes until after the boot animation
if (mBootFinished) {
setActiveColorModeInternal(displayDevice, newColorMode);
+ displayDevice->setCompositionDataSpace(newDataSpace);
}
}
}