From 2b3f82672a8d2d1ba3b0619cdb2fe2777719c206 Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Fri, 20 Jul 2018 16:03:46 -0700 Subject: [PATCH] [ConfigStore] Add useColorManagement method. Previously we couple wide color gamut display and color management together, which is because we only do color management when we have wide color gamut display. However, we would also want display that doesn't support wide color gamut but is calibrated and is capable of managing sRGB gamut to have color management. This means we will decouple wide color gamut display from color management, a device can indicate that it's color managed without having wide color gamut display and only manage color within sRGB gamut. BUG: 111505327 Test: BUild, flash and check Natural/Boosted mode. Change-Id: If1241ce040a6f691609d8f8d72a2d6f3141557cf --- CleanSpec.mk | 2 + .../compatibility_matrix.current.xml | 2 +- configstore/1.2/Android.bp | 18 ++++++++ configstore/1.2/ISurfaceFlingerConfigs.hal | 33 +++++++++++++++ configstore/{1.1 => 1.2}/default/Android.mk | 15 +++---- .../default/SurfaceFlingerConfigs.cpp | 20 +++++---- .../default/SurfaceFlingerConfigs.h | 41 +++++++++++++------ ...droid.hardware.configstore@1.2-service.rc} | 2 +- .../seccomp_policy/configstore-arm64.policy} | 0 configstore/{1.1 => 1.2}/default/service.cpp | 18 ++++---- .../{1.1 => 1.2}/default/surfaceflinger.mk | 4 ++ configstore/utils/Android.bp | 2 + 12 files changed, 119 insertions(+), 38 deletions(-) create mode 100644 configstore/1.2/Android.bp create mode 100644 configstore/1.2/ISurfaceFlingerConfigs.hal rename configstore/{1.1 => 1.2}/default/Android.mk (67%) rename configstore/{1.1 => 1.2}/default/SurfaceFlingerConfigs.cpp (90%) rename configstore/{1.1 => 1.2}/default/SurfaceFlingerConfigs.h (58%) rename configstore/{1.1/default/android.hardware.configstore@1.1-service.rc => 1.2/default/android.hardware.configstore@1.2-service.rc} (84%) rename configstore/{1.1/default/seccomp_policy/configstore@1.1-arm64.policy => 1.2/default/seccomp_policy/configstore-arm64.policy} (100%) rename configstore/{1.1 => 1.2}/default/service.cpp (80%) rename configstore/{1.1 => 1.2}/default/surfaceflinger.mk (94%) diff --git a/CleanSpec.mk b/CleanSpec.mk index 531e44ec8e..fcaced0df0 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -66,3 +66,5 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib/vndk-sp/android.hardware $(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore\@1\.1*" -print0 | xargs -0 rm -f) $(call add-clean-step, find $(PRODUCT_OUT)/system $(PRODUCT_OUT)/vendor -type f -name "android\.hardware\.configstore*" -print0 | xargs -0 rm -f) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore@1.0.policy) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/etc/seccomp_policy/configstore@1.1.policy) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/bin/hw/android.hardware.configstore@1.1-service) diff --git a/compatibility_matrices/compatibility_matrix.current.xml b/compatibility_matrices/compatibility_matrix.current.xml index 8803cdd8cc..b9cb093213 100644 --- a/compatibility_matrices/compatibility_matrix.current.xml +++ b/compatibility_matrices/compatibility_matrix.current.xml @@ -105,7 +105,7 @@ android.hardware.configstore - 1.1 + 1.2 ISurfaceFlingerConfigs default diff --git a/configstore/1.2/Android.bp b/configstore/1.2/Android.bp new file mode 100644 index 0000000000..a20eb34dd8 --- /dev/null +++ b/configstore/1.2/Android.bp @@ -0,0 +1,18 @@ +// This file is autogenerated by hidl-gen -Landroidbp. + +hidl_interface { + name: "android.hardware.configstore@1.2", + root: "android.hardware", + vndk: { + enabled: true, + }, + srcs: [ + "ISurfaceFlingerConfigs.hal", + ], + interfaces: [ + "android.hardware.configstore@1.1", + "android.hardware.configstore@1.0", + "android.hidl.base@1.0", + ], + gen_java: true, +} \ No newline at end of file diff --git a/configstore/1.2/ISurfaceFlingerConfigs.hal b/configstore/1.2/ISurfaceFlingerConfigs.hal new file mode 100644 index 0000000000..c32cc82910 --- /dev/null +++ b/configstore/1.2/ISurfaceFlingerConfigs.hal @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.1 (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.1 + * + * 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; + +import @1.1::ISurfaceFlingerConfigs; +import @1.0::OptionalBool; + +/** + * New revision of ISurfaceFlingerConfigs + */ +interface ISurfaceFlingerConfigs extends @1.1::ISurfaceFlingerConfigs { + /** + * useColorManagement indicates whether SurfaceFlinger should manage color + * by switching to appropriate color mode automatically depending on the + * Dataspace of the surfaces on screen. + * This function must return true when hasWideColorDisplay or hasHDRDisplay + * return true. + */ + useColorManagement() generates (OptionalBool value); +}; diff --git a/configstore/1.1/default/Android.mk b/configstore/1.2/default/Android.mk similarity index 67% rename from configstore/1.1/default/Android.mk rename to configstore/1.2/default/Android.mk index 40f621b3ad..b807357876 100644 --- a/configstore/1.1/default/Android.mk +++ b/configstore/1.2/default/Android.mk @@ -2,15 +2,15 @@ LOCAL_PATH := $(call my-dir) ################################################################################ include $(CLEAR_VARS) -LOCAL_MODULE := android.hardware.configstore@1.1-service +LOCAL_MODULE := android.hardware.configstore@1.2-service # seccomp is not required for coverage build. ifneq ($(NATIVE_COVERAGE),true) -LOCAL_REQUIRED_MODULES_arm64 := configstore@1.1.policy +LOCAL_REQUIRED_MODULES_arm64 := configstore.policy endif -LOCAL_PROPRIETARY_MODULE := true +LOCAL_VENDOR_MODULE := true LOCAL_MODULE_CLASS := EXECUTABLES LOCAL_MODULE_RELATIVE_PATH := hw -LOCAL_INIT_RC := android.hardware.configstore@1.1-service.rc +LOCAL_INIT_RC := android.hardware.configstore@1.2-service.rc LOCAL_SRC_FILES:= service.cpp include $(LOCAL_PATH)/surfaceflinger.mk @@ -23,16 +23,17 @@ LOCAL_SHARED_LIBRARIES := \ liblog \ libutils \ android.hardware.configstore@1.0 \ - android.hardware.configstore@1.1 + android.hardware.configstore@1.1 \ + android.hardware.configstore@1.2 include $(BUILD_EXECUTABLE) # seccomp filter for configstore ifeq ($(TARGET_ARCH), $(filter $(TARGET_ARCH), arm64)) include $(CLEAR_VARS) -LOCAL_MODULE := configstore@1.1.policy +LOCAL_MODULE := configstore.policy LOCAL_MODULE_CLASS := ETC LOCAL_MODULE_PATH := $(TARGET_OUT_VENDOR)/etc/seccomp_policy -LOCAL_SRC_FILES := seccomp_policy/configstore@1.1-$(TARGET_ARCH).policy +LOCAL_SRC_FILES := seccomp_policy/configstore-$(TARGET_ARCH).policy include $(BUILD_PREBUILT) endif diff --git a/configstore/1.1/default/SurfaceFlingerConfigs.cpp b/configstore/1.2/default/SurfaceFlingerConfigs.cpp similarity index 90% rename from configstore/1.1/default/SurfaceFlingerConfigs.cpp rename to configstore/1.2/default/SurfaceFlingerConfigs.cpp index da3081c12f..c7bd567fef 100644 --- a/configstore/1.1/default/SurfaceFlingerConfigs.cpp +++ b/configstore/1.2/default/SurfaceFlingerConfigs.cpp @@ -22,11 +22,10 @@ namespace android { namespace hardware { namespace configstore { -namespace V1_1 { +namespace V1_2 { namespace implementation { -// Methods from ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs -// follow. +// ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs implementation. Return SurfaceFlingerConfigs::vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) { #ifdef VSYNC_EVENT_PHASE_OFFSET_NS _hidl_cb({true, VSYNC_EVENT_PHASE_OFFSET_NS}); @@ -142,8 +141,7 @@ Return SurfaceFlingerConfigs::startGraphicsAllocatorService( return Void(); } -// Methods from ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs -// follow. +// ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs implementation. #ifdef PRIMARY_DISPLAY_ORIENTATION static_assert(PRIMARY_DISPLAY_ORIENTATION == 0 || PRIMARY_DISPLAY_ORIENTATION == 90 || @@ -191,10 +189,18 @@ Return SurfaceFlingerConfigs::primaryDisplayOrientation( return Void(); } -// Methods from ::android::hidl::base::V1_0::IBase follow. +// ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs implementation. +Return SurfaceFlingerConfigs::useColorManagement(useColorManagement_cb _hidl_cb) { +#if defined(USE_COLOR_MANAGEMENT) || defined(HAS_WIDE_COLOR_DISPLAY) || defined(HAS_HDR_DISPLAY) + _hidl_cb({true, true}); +#else + _hidl_cb({true, false}); +#endif + return Void(); +} } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace configstore } // namespace hardware } // namespace android diff --git a/configstore/1.1/default/SurfaceFlingerConfigs.h b/configstore/1.2/default/SurfaceFlingerConfigs.h similarity index 58% rename from configstore/1.1/default/SurfaceFlingerConfigs.h rename to configstore/1.2/default/SurfaceFlingerConfigs.h index 3714e81697..fe787890f0 100644 --- a/configstore/1.1/default/SurfaceFlingerConfigs.h +++ b/configstore/1.2/default/SurfaceFlingerConfigs.h @@ -1,24 +1,39 @@ -#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H -#define ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H +/* + * Copyright (C) 2018 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.1 (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.1 + * + * 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. + */ -#include +#ifndef ANDROID_HARDWARE_CONFIGSTORE_V1_2_SURFACEFLINGERCONFIGS_H +#define ANDROID_HARDWARE_CONFIGSTORE_V1_2_SURFACEFLINGERCONFIGS_H + +#include #include #include namespace android { namespace hardware { namespace configstore { -namespace V1_1 { +namespace V1_2 { namespace implementation { -using ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs; +using ::android::sp; using ::android::hardware::Return; using ::android::hardware::Void; -using ::android::sp; +using ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs; struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs { - // Methods from - // ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs follow. + // ::android::hardware::configstore::V1_0::ISurfaceFlingerConfigs implementation. Return vsyncEventPhaseOffsetNs(vsyncEventPhaseOffsetNs_cb _hidl_cb) override; Return vsyncSfEventPhaseOffsetNs(vsyncSfEventPhaseOffsetNs_cb _hidl_cb) override; Return useContextPriority(useContextPriority_cb _hidl_cb) override; @@ -32,17 +47,17 @@ struct SurfaceFlingerConfigs : public ISurfaceFlingerConfigs { Return maxFrameBufferAcquiredBuffers(maxFrameBufferAcquiredBuffers_cb _hidl_cb) override; Return startGraphicsAllocatorService(startGraphicsAllocatorService_cb _hidl_cb) override; - // Methods from - // ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs follow. + // ::android::hardware::configstore::V1_1::ISurfaceFlingerConfigs follow implementation. Return primaryDisplayOrientation(primaryDisplayOrientation_cb _hidl_cb) override; - // Methods from ::android::hidl::base::V1_0::IBase follow. + // ::android::hardware::configstore::V1_2::ISurfaceFlingerConfigs follow implementation. + Return useColorManagement(useColorManagement_cb _hidl_cb) override; }; } // namespace implementation -} // namespace V1_1 +} // namespace V1_2 } // namespace configstore } // namespace hardware } // namespace android -#endif // ANDROID_HARDWARE_CONFIGSTORE_V1_1_SURFACEFLINGERCONFIGS_H +#endif // ANDROID_HARDWARE_CONFIGSTORE_V1_2_SURFACEFLINGERCONFIGS_H diff --git a/configstore/1.1/default/android.hardware.configstore@1.1-service.rc b/configstore/1.2/default/android.hardware.configstore@1.2-service.rc similarity index 84% rename from configstore/1.1/default/android.hardware.configstore@1.1-service.rc rename to configstore/1.2/default/android.hardware.configstore@1.2-service.rc index 105678acb2..d6c5d10a71 100644 --- a/configstore/1.1/default/android.hardware.configstore@1.1-service.rc +++ b/configstore/1.2/default/android.hardware.configstore@1.2-service.rc @@ -1,4 +1,4 @@ -service vendor.configstore-hal /vendor/bin/hw/android.hardware.configstore@1.1-service +service vendor.configstore-hal /vendor/bin/hw/android.hardware.configstore@1.2-service class hal animation user system group system diff --git a/configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy b/configstore/1.2/default/seccomp_policy/configstore-arm64.policy similarity index 100% rename from configstore/1.1/default/seccomp_policy/configstore@1.1-arm64.policy rename to configstore/1.2/default/seccomp_policy/configstore-arm64.policy diff --git a/configstore/1.1/default/service.cpp b/configstore/1.2/default/service.cpp similarity index 80% rename from configstore/1.1/default/service.cpp rename to configstore/1.2/default/service.cpp index 3b4e7745ee..65a42f5955 100644 --- a/configstore/1.1/default/service.cpp +++ b/configstore/1.2/default/service.cpp @@ -14,27 +14,27 @@ * limitations under the License. */ -#define LOG_TAG "android.hardware.configstore@1.1-service" +#define LOG_TAG "android.hardware.configstore@1.2-service" -#include +#include #include #include #include "SurfaceFlingerConfigs.h" -using android::hardware::configureRpcThreadpool; -using android::hardware::joinRpcThreadpool; -using android::hardware::configstore::V1_1::ISurfaceFlingerConfigs; -using android::hardware::configstore::V1_1::implementation::SurfaceFlingerConfigs; -using android::hardware::SetupMinijail; +using android::OK; using android::sp; using android::status_t; -using android::OK; +using android::hardware::configureRpcThreadpool; +using android::hardware::joinRpcThreadpool; +using android::hardware::SetupMinijail; +using android::hardware::configstore::V1_2::ISurfaceFlingerConfigs; +using android::hardware::configstore::V1_2::implementation::SurfaceFlingerConfigs; int main() { configureRpcThreadpool(10, true); - SetupMinijail("/vendor/etc/seccomp_policy/configstore@1.1.policy"); + SetupMinijail("/vendor/etc/seccomp_policy/configstore.policy"); sp surfaceFlingerConfigs = new SurfaceFlingerConfigs; status_t status = surfaceFlingerConfigs->registerAsService(); diff --git a/configstore/1.1/default/surfaceflinger.mk b/configstore/1.2/default/surfaceflinger.mk similarity index 94% rename from configstore/1.1/default/surfaceflinger.mk rename to configstore/1.2/default/surfaceflinger.mk index 35922ebb09..70be4501e1 100644 --- a/configstore/1.1/default/surfaceflinger.mk +++ b/configstore/1.2/default/surfaceflinger.mk @@ -54,3 +54,7 @@ endif ifneq ($(SF_PRIMARY_DISPLAY_ORIENTATION),) LOCAL_CFLAGS += -DPRIMARY_DISPLAY_ORIENTATION=$(SF_PRIMARY_DISPLAY_ORIENTATION) endif + +ifeq ($(TARGET_USE_COLOR_MANAGEMENT),true) + LOCAL_CFLAGS += -DUSE_COLOR_MANAGEMENT +endif diff --git a/configstore/utils/Android.bp b/configstore/utils/Android.bp index 178f245fd6..e0d4aa8192 100644 --- a/configstore/utils/Android.bp +++ b/configstore/utils/Android.bp @@ -30,12 +30,14 @@ cc_library_shared { shared_libs: [ "android.hardware.configstore@1.0", "android.hardware.configstore@1.1", + "android.hardware.configstore@1.2", "libbase", "libhidlbase" ], export_shared_lib_headers: [ "android.hardware.configstore@1.0", "android.hardware.configstore@1.1", + "android.hardware.configstore@1.2", "libbase", "libhidlbase" ],