diff options
| author | Steve Pfetsch <spfetsch@google.com> | 2016-01-13 17:20:17 -0800 |
|---|---|---|
| committer | Steve Pfetsch <spfetsch@google.com> | 2016-01-14 16:19:42 -0800 |
| commit | f1812e0b56773537760c9ae8ea45cee5ac902118 (patch) | |
| tree | 7c854d2dabf3f4b74860cba9d47d204a40026237 | |
| parent | ed83eaacc5d4f68d6ae25c9e7c15c292e8d4b6eb (diff) | |
| download | platform_hardware_qcom_display-marshmallow-dr1.5-dev.tar.gz platform_hardware_qcom_display-marshmallow-dr1.5-dev.tar.bz2 platform_hardware_qcom_display-marshmallow-dr1.5-dev.zip | |
Enable color temperature developer settingandroid-6.0.1_r68android-6.0.1_r67android-6.0.1_r62android-6.0.1_r54android-6.0.1_r53android-6.0.1_r45android-6.0.1_r25android-6.0.1_r24android-6.0.1_r22android-6.0.1_r21marshmallow-dr1.6-releasemarshmallow-dr1.5-releasemarshmallow-dr1.5-dev
Add a switch in Developer Settings to enable "cool" color temperature
mode.
Bug: 26110238
Change-Id: I669ae4ddf58d6654b154692afc7d0689227617b2
| -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 { |
