diff options
author | Steve Pfetsch <spfetsch@google.com> | 2016-01-15 20:44:34 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2016-01-15 20:44:34 +0000 |
commit | 0e87e54c5842ab44bd74636046e941905dc1c3ea (patch) | |
tree | 1c9d47d242e92764eab8c724978d61563f56be8f /msm8994 | |
parent | 5409a6cf355dba296d33a6051dd6dc88a99bf8c7 (diff) | |
parent | f1812e0b56773537760c9ae8ea45cee5ac902118 (diff) | |
download | display-0e87e54c5842ab44bd74636046e941905dc1c3ea.tar.gz |
Enable color temperature developer setting
am: f1812e0b56
* commit 'f1812e0b56773537760c9ae8ea45cee5ac902118':
Enable color temperature developer setting
Diffstat (limited to 'msm8994')
-rw-r--r-- | msm8994/libhwcomposer/hwc.cpp | 31 | ||||
-rw-r--r-- | msm8994/libhwcomposer/hwc_utils.cpp | 2 | ||||
-rw-r--r-- | msm8994/libhwcomposer/hwc_utils.h | 2 |
3 files changed, 35 insertions, 0 deletions
diff --git a/msm8994/libhwcomposer/hwc.cpp b/msm8994/libhwcomposer/hwc.cpp index fc0842b1..1e5a8a48 100644 --- a/msm8994/libhwcomposer/hwc.cpp +++ b/msm8994/libhwcomposer/hwc.cpp @@ -249,6 +249,34 @@ static void scaleDisplayFrame(hwc_context_t *ctx, int dpy, } } +static void hwc_configure_color_temp(hwc_composer_device_1* dev) { + hwc_context_t* ctx = (hwc_context_t*)(dev); + char value[PROPERTY_VALUE_MAX]; + bool cool; + + property_get("persist.sys.debug.color_temp", value, "x"); + cool = (value[0] == '1'); + + if ((value[0] == '0' || value[0] == '1') && + cool != ctx->mCoolColorTemperatureEnabled) { + ctx->mCoolColorTemperatureEnabled = cool; + + ALOGI("Color temperature change. Cool = %d", cool ? 1 : 0); + + int fd = open("/sys/class/graphics/fb0/color_temp", O_WRONLY); + if (fd >= 0) { + if (cool) + write(fd, "1", 2); + else + write(fd, "0", 2); + close(fd); + } else { + ALOGE("Failed to open color_temp file with result=%d", fd); + } + } +} + + static int hwc_prepare_primary(hwc_composer_device_1 *dev, hwc_display_contents_1_t *list) { ATRACE_CALL(); @@ -515,6 +543,9 @@ static int hwc_setPowerMode(struct hwc_composer_device_1* dev, int dpy, return -EINVAL; } + // Configure the color temperature + hwc_configure_color_temp(dev); + ALOGD_IF(POWER_MODE_DEBUG, "%s: Done setting mode %d on display %d", __FUNCTION__, mode, dpy); return ret; diff --git a/msm8994/libhwcomposer/hwc_utils.cpp b/msm8994/libhwcomposer/hwc_utils.cpp index 98c41666..3234d659 100644 --- a/msm8994/libhwcomposer/hwc_utils.cpp +++ b/msm8994/libhwcomposer/hwc_utils.cpp @@ -393,6 +393,8 @@ void initContext(hwc_context_t *ctx) // Initializing boot anim completed check to false ctx->mDefaultModeApplied = false; + ctx->mCoolColorTemperatureEnabled = false; + // Initialize gpu perfomance hint related parameters property_get("sys.hwc.gpu_perf_mode", value, "0"); #ifdef QCOM_BSP diff --git a/msm8994/libhwcomposer/hwc_utils.h b/msm8994/libhwcomposer/hwc_utils.h index c9f35e54..2e4b3f42 100644 --- a/msm8994/libhwcomposer/hwc_utils.h +++ b/msm8994/libhwcomposer/hwc_utils.h @@ -683,6 +683,8 @@ struct hwc_context_t { bool mDefaultModeApplied; //Manages color modes qhwc::ColorMode *mColorMode; + // Indicates whether cool color temperature is enabled. + bool mCoolColorTemperatureEnabled; }; namespace qhwc { |