[SurfaceFinger] Adds auto color mode support in SurfaceFlinger.
This patch adds auto color mode support in SurfaceFlinger. For Auto Awesome
Color milestone 1, we expect the hardware composer is capable of handling P3
layers, meaning if the hardware composer is given P3 layers, it will strech the
color from Display P3 to the pannel native color space. Hardware composer may
punt sRGB layers back to SurfaceFlinger, in this case, we fall back to
RenderEngine. We will set the destination data space to Display P3 when the
layers are mixed color spaces, and set the destination data space as SRGB if
they are all SRGB layers.
BUG: 73824924
BUG: 73825729
Test: Build
Change-Id: I577841b14de0cfe8c29f8aa30bee8621c5d72976
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index 9d356d8..8c0050e 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -1643,6 +1643,21 @@
return true;
}
+// Dataspace::UNKNOWN, Dataspace::SRGB, Dataspace::SRGB_LINEAR,
+// Dataspace::V0_SRGB and Dataspace::V0_SRGB_LINEAR are considered legacy
+// SRGB data space for now.
+// Note that Dataspace::V0_SRGB and Dataspace::V0_SRGB_LINEAR are not legacy
+// data space, however since framework doesn't distinguish them out of legacy
+// SRGB, we have to treat them as the same for now.
+bool Layer::isLegacySrgbDataSpace() const {
+ // TODO(lpy) b/77652630, need to figure out when UNKNOWN can be treated as SRGB.
+ return mDrawingState.dataSpace == ui::Dataspace::UNKNOWN ||
+ mDrawingState.dataSpace == ui::Dataspace::SRGB ||
+ mDrawingState.dataSpace == ui::Dataspace::SRGB_LINEAR ||
+ mDrawingState.dataSpace == ui::Dataspace::V0_SRGB ||
+ mDrawingState.dataSpace == ui::Dataspace::V0_SRGB_LINEAR;
+}
+
void Layer::setParent(const sp<Layer>& layer) {
mCurrentParent = layer;
}