diff options
author | linpeter <linpeter@google.com> | 2018-11-22 20:41:52 +0800 |
---|---|---|
committer | linpeter <linpeter@google.com> | 2019-01-16 19:53:06 +0800 |
commit | 5a12cd73762b8af496e8aa1a174a5ddfec403ba9 (patch) | |
tree | 95850343ecb67bd0ea5855a8ee5cf0f9688b824b /configstore | |
parent | 09ade87318990977620e2d710a531b1aa0fe99f1 (diff) |
[ConfigStore] Add get display primary interface
Implement get display native primaries and vts
Bug: 118515855
Test: run vts-hal -m VtsHalConfigstoreV1_2Target
-t ConfigstoreHidlTest.TestGetDisplayNativePrimaries
Change-Id: I8391fe2eaf32a2aa6dfe6eb741baa97629f00f55
Diffstat (limited to 'configstore')
-rw-r--r-- | configstore/1.2/Android.bp | 5 | ||||
-rw-r--r-- | configstore/1.2/ISurfaceFlingerConfigs.hal | 7 | ||||
-rw-r--r-- | configstore/1.2/default/SurfaceFlingerConfigs.cpp | 80 | ||||
-rw-r--r-- | configstore/1.2/default/SurfaceFlingerConfigs.h | 1 | ||||
-rw-r--r-- | configstore/1.2/default/surfaceflinger.mk | 48 | ||||
-rw-r--r-- | configstore/1.2/types.hal | 28 | ||||
-rw-r--r-- | configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp | 39 |
7 files changed, 208 insertions, 0 deletions
diff --git a/configstore/1.2/Android.bp b/configstore/1.2/Android.bp index bb4dd4a912..a3976b649f 100644 --- a/configstore/1.2/Android.bp +++ b/configstore/1.2/Android.bp @@ -7,6 +7,7 @@ hidl_interface { enabled: true, }, srcs: [ + "types.hal", "ISurfaceFlingerConfigs.hal", ], interfaces: [ @@ -17,6 +18,10 @@ hidl_interface { "android.hardware.graphics.common@1.2", "android.hidl.base@1.0", ], + types: [ + "CieXyz", + "DisplayPrimaries", + ], gen_java: true, } diff --git a/configstore/1.2/ISurfaceFlingerConfigs.hal b/configstore/1.2/ISurfaceFlingerConfigs.hal index e91b2c7237..7e5f706c02 100644 --- a/configstore/1.2/ISurfaceFlingerConfigs.hal +++ b/configstore/1.2/ISurfaceFlingerConfigs.hal @@ -69,4 +69,11 @@ interface ISurfaceFlingerConfigs extends @1.1::ISurfaceFlingerConfigs { getCompositionPreference() generates (Dataspace dataspace, PixelFormat pixelFormat, Dataspace wcgDataspace, PixelFormat wcgPixelFormat); + + /** + * Returns the native panel primary data. The data includes red, green, + * blue and white. The primary format is CIE 1931 XYZ color space. If + * unspecified, the primaries is sRGB gamut by default. + */ + getDisplayNativePrimaries() generates (DisplayPrimaries primaries); }; diff --git a/configstore/1.2/default/SurfaceFlingerConfigs.cpp b/configstore/1.2/default/SurfaceFlingerConfigs.cpp index c2cf374755..d38b402889 100644 --- a/configstore/1.2/default/SurfaceFlingerConfigs.cpp +++ b/configstore/1.2/default/SurfaceFlingerConfigs.cpp @@ -17,6 +17,7 @@ #include "SurfaceFlingerConfigs.h" #include <android/hardware/configstore/1.1/types.h> +#include <android/hardware/configstore/1.2/types.h> #include <android/hardware/graphics/common/1.1/types.h> #include <log/log.h> @@ -241,6 +242,85 @@ Return<void> SurfaceFlingerConfigs::getCompositionPreference(getCompositionPrefe return Void(); } +Return<void> SurfaceFlingerConfigs::getDisplayNativePrimaries(getDisplayNativePrimaries_cb _hidl_cb) { + DisplayPrimaries primaries; + // The default XYZ is sRGB gamut in CIE1931 color space +#ifdef TARGET_DISPLAY_PRIMARY_RED_X + primaries.red.X = TARGET_DISPLAY_PRIMARY_RED_X; +#else + primaries.red.X = 0.4123; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_RED_Y + primaries.red.Y = TARGET_DISPLAY_PRIMARY_RED_Y; +#else + primaries.red.Y = 0.2126; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_RED_Z + primaries.red.Z = TARGET_DISPLAY_PRIMARY_RED_Z; +#else + primaries.red.Z = 0.0193; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_GREEN_X + primaries.green.X = TARGET_DISPLAY_PRIMARY_GREEN_X; +#else + primaries.green.X = 0.3576; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_GREEN_Y + primaries.green.Y = TARGET_DISPLAY_PRIMARY_GREEN_Y; +#else + primaries.green.Y = 0.7152; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_GREEN_Z + primaries.green.Z = TARGET_DISPLAY_PRIMARY_GREEN_Z; +#else + primaries.green.Z = 0.1192; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_BLUE_X + primaries.blue.X = TARGET_DISPLAY_PRIMARY_BLUE_X; +#else + primaries.blue.X = 0.1805; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_BLUE_Y + primaries.blue.Y = TARGET_DISPLAY_PRIMARY_BLUE_Y; +#else + primaries.blue.Y = 0.0722; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_BLUE_Z + primaries.blue.Z = TARGET_DISPLAY_PRIMARY_BLUE_Z; +#else + primaries.blue.Z = 0.9506; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_WHITE_X + primaries.white.X = TARGET_DISPLAY_PRIMARY_WHITE_X; +#else + primaries.white.X = 0.9505; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_WHITE_Y + primaries.white.Y = TARGET_DISPLAY_PRIMARY_WHITE_Y; +#else + primaries.white.Y = 1.0000; +#endif + +#ifdef TARGET_DISPLAY_PRIMARY_WHITE_Z + primaries.white.Z = TARGET_DISPLAY_PRIMARY_WHITE_Z; +#else + primaries.white.Z = 1.0891; +#endif + + _hidl_cb(primaries); + return Void(); +} + } // namespace implementation } // namespace V1_2 } // namespace configstore diff --git a/configstore/1.2/default/SurfaceFlingerConfigs.h b/configstore/1.2/default/SurfaceFlingerConfigs.h index 7dd8f6d2c9..54a6e6211b 100644 --- a/configstore/1.2/default/SurfaceFlingerConfigs.h +++ b/configstore/1.2/default/SurfaceFlingerConfigs.h @@ -53,6 +53,7 @@ struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs { // ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs follow implementation. Return<void> useColorManagement(useColorManagement_cb _hidl_cb) override; Return<void> getCompositionPreference(getCompositionPreference_cb _hidl_cb) override; + Return<void> getDisplayNativePrimaries(getDisplayNativePrimaries_cb _hidl_cb) override; }; } // namespace implementation diff --git a/configstore/1.2/default/surfaceflinger.mk b/configstore/1.2/default/surfaceflinger.mk index dab6aa55fc..9a672564c1 100644 --- a/configstore/1.2/default/surfaceflinger.mk +++ b/configstore/1.2/default/surfaceflinger.mk @@ -74,3 +74,51 @@ endif ifneq ($(SF_WCG_COMPOSITION_PIXEL_FORMAT),) LOCAL_CFLAGS += -DWCG_COMPOSITION_PIXEL_FORMAT=$(SF_WCG_COMPOSITION_PIXEL_FORMAT) endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_RED_X),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_RED_X=$(TARGET_DISPLAY_PRIMARY_RED_X) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_RED_Y),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_RED_Y=$(TARGET_DISPLAY_PRIMARY_RED_Y) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_RED_Z),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_RED_Z=$(TARGET_DISPLAY_PRIMARY_RED_Z) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_GREEN_X),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_GREEN_X=$(TARGET_DISPLAY_PRIMARY_GREEN_X) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_GREEN_Y),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_GREEN_Y=$(TARGET_DISPLAY_PRIMARY_GREEN_Y) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_GREEN_Z),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_GREEN_Z=$(TARGET_DISPLAY_PRIMARY_GREEN_Z) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_BLUE_X),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_BLUE_X=$(TARGET_DISPLAY_PRIMARY_BLUE_X) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_BLUE_Y),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_BLUE_Y=$(TARGET_DISPLAY_PRIMARY_BLUE_Y) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_BLUE_Z),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_BLUE_Z=$(TARGET_DISPLAY_PRIMARY_BLUE_Z) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_WHITE_X),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_WHITE_X=$(TARGET_DISPLAY_PRIMARY_WHITE_X) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_WHITE_Y),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_WHITE_Y=$(TARGET_DISPLAY_PRIMARY_WHITE_Y) +endif + +ifneq ($(TARGET_DISPLAY_PRIMARY_WHITE_Z),) + LOCAL_CFLAGS += -DTARGET_DISPLAY_PRIMARY_WHITE_Z=$(TARGET_DISPLAY_PRIMARY_WHITE_Z) +endif diff --git a/configstore/1.2/types.hal b/configstore/1.2/types.hal new file mode 100644 index 0000000000..5b2c9a60b3 --- /dev/null +++ b/configstore/1.2/types.hal @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2019 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package android.hardware.configstore@1.2; + +struct CieXyz { + float X; + float Y; + float Z; +}; +struct DisplayPrimaries { + CieXyz red; + CieXyz green; + CieXyz blue; + CieXyz white; +}; diff --git a/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp b/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp index dc5fec5200..881b591284 100644 --- a/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp +++ b/configstore/1.2/vts/functional/VtsHalConfigstoreV1_2TargetTest.cpp @@ -21,6 +21,7 @@ #include <android-base/logging.h> #include <android/hardware/configstore/1.0/types.h> #include <android/hardware/configstore/1.2/ISurfaceFlingerConfigs.h> +#include <android/hardware/configstore/1.2/types.h> #include <unistd.h> using ::android::sp; @@ -31,6 +32,7 @@ using ::android::hardware::configstore::V1_0::OptionalBool; using ::android::hardware::configstore::V1_0::OptionalInt64; using ::android::hardware::configstore::V1_0::OptionalUInt64; using ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs; +using ::android::hardware::configstore::V1_2::DisplayPrimaries; using ::android::hardware::graphics::common::V1_1::PixelFormat; using ::android::hardware::graphics::common::V1_2::Dataspace; @@ -125,6 +127,43 @@ TEST_F(ConfigstoreHidlTest, TestGetCompositionPreference) { } } +TEST_F(ConfigstoreHidlTest, TestGetDisplayNativePrimaries) { + DisplayPrimaries primaries; + + Return<void> status = sfConfigs->getDisplayNativePrimaries( + [&](DisplayPrimaries tmpPrimaries) { + primaries.red = tmpPrimaries.red; + primaries.green = tmpPrimaries.green; + primaries.blue = tmpPrimaries.blue; + primaries.white = tmpPrimaries.white; + }); + EXPECT_OK(status); + + // Display primaries should be greater than or equal to zero. + // Or it returns defualt value if there is no definition. + // RED + EXPECT_GE(primaries.red.X, 0.0); + EXPECT_GE(primaries.red.Y, 0.0); + EXPECT_GE(primaries.red.Z, 0.0); + + // GREEN + EXPECT_GE(primaries.green.X, 0.0); + EXPECT_GE(primaries.green.Y, 0.0); + EXPECT_GE(primaries.green.Z, 0.0); + + + // BLUE + EXPECT_GE(primaries.blue.X, 0.0); + EXPECT_GE(primaries.blue.Y, 0.0); + EXPECT_GE(primaries.blue.Z, 0.0); + + + // WHITE + EXPECT_GE(primaries.white.X, 0.0); + EXPECT_GE(primaries.white.Y, 0.0); + EXPECT_GE(primaries.white.Z, 0.0); +} + int main(int argc, char** argv) { ::testing::AddGlobalTestEnvironment(ConfigstoreHidlEnvironment::Instance()); ::testing::InitGoogleTest(&argc, argv); |