SF: enable device-specific dataspace for color space agnostic surfaces

To reduce the DPU loading in color conversion, we enable device-specific
dataspace for color space agnostic surfaces. Since the type of surfaces
usually provide gray-level surfaces to users, it can be acceptable to
ignore the color conversion on them.

Bug: 134783740
Bug: 135140940
Test: Check ScreenDecorOverlays in expected dataspace
Test: Play HDR video on B1 and C2 and check dataspace
Change-Id: I7b11e11d2015eb5c8dfdc372e2c7ffcb40a2ac1d
diff --git a/services/surfaceflinger/SurfaceFlingerProperties.cpp b/services/surfaceflinger/SurfaceFlingerProperties.cpp
index 2b33ba1..237208d 100644
--- a/services/surfaceflinger/SurfaceFlingerProperties.cpp
+++ b/services/surfaceflinger/SurfaceFlingerProperties.cpp
@@ -218,6 +218,14 @@
     return static_cast<int32_t>(defaultValue);
 }
 
+int64_t color_space_agnostic_dataspace(Dataspace defaultValue) {
+    auto temp = SurfaceFlingerProperties::color_space_agnostic_dataspace();
+    if (temp.has_value()) {
+        return *temp;
+    }
+    return static_cast<int64_t>(defaultValue);
+}
+
 int32_t set_idle_timer_ms(int32_t defaultValue) {
     auto temp = SurfaceFlingerProperties::set_idle_timer_ms();
     if (temp.has_value()) {