Skip to content
Snippets Groups Projects
Commit eaf7a4bc authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "Use setPowerMode interface for HWC 1.4 and above"

parents ddf4bbe8 5e825875
No related branches found
Tags LF.BR.1.2.7-01200-8x09.0
No related merge requests found
From 86e2d82048c059c184a313400c7884d4557c3750 Mon Sep 17 00:00:00 2001
From: Sushil Chauhan <sushilchauhan@codeaurora.org>
Date: Fri, 3 Oct 2014 11:59:32 -0700
Subject: [PATCH] Use setPowerMode interface for HWC 1.4 and above
For HWC version 1.4 and above, HAL does not support blank interface.
Hence, setPowerMode() should be used in place of blank().
Change-Id: I2135f65a909b81a5182d0e0f9d7d39e11bb5e11a
---
widget/gonk/libdisplay/GonkDisplayJB.cpp | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)
diff --git a/widget/gonk/libdisplay/GonkDisplayJB.cpp b/widget/gonk/libdisplay/GonkDisplayJB.cpp
index 89a7bcf..638e6de 100644
--- a/widget/gonk/libdisplay/GonkDisplayJB.cpp
+++ b/widget/gonk/libdisplay/GonkDisplayJB.cpp
@@ -130,18 +130,27 @@ GonkDisplayJB::GonkDisplayJB()
mSTClient = stc;
mSTClient->perform(mSTClient.get(), NATIVE_WINDOW_SET_BUFFER_COUNT, 2);
mSTClient->perform(mSTClient.get(), NATIVE_WINDOW_SET_USAGE,
GRALLOC_USAGE_HW_FB |
GRALLOC_USAGE_HW_RENDER |
GRALLOC_USAGE_HW_COMPOSER);
mList = (hwc_display_contents_1_t *)malloc(sizeof(*mList) + (sizeof(hwc_layer_1_t)*2));
- if (mHwc)
+ if (mHwc) {
+#if ANDROID_VERSION >= 21
+ if (mHwc->common.version >= HWC_DEVICE_API_VERSION_1_4) {
+ mHwc->setPowerMode(mHwc, HWC_DISPLAY_PRIMARY, HWC_POWER_MODE_NORMAL);
+ } else {
+ mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, 0);
+ }
+#else
mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, 0);
+#endif
+ }
if (error == NO_ERROR) {
ALOGI("Starting bootanimation with (%d) format framebuffer", surfaceformat);
StartBootAnimation();
} else
ALOGW("Couldn't show bootanimation (%s)", strerror(-error));
}
@@ -168,21 +177,30 @@ GonkDisplayJB::SetEnabled(bool enabled)
autosuspend_disable();
mPowerModule->setInteractive(mPowerModule, true);
}
if (!enabled && mEnabledCallback) {
mEnabledCallback(enabled);
}
+#if ANDROID_VERSION >= 21
+ if (mHwc->common.version >= HWC_DEVICE_API_VERSION_1_4) {
+ mHwc->setPowerMode(mHwc, HWC_DISPLAY_PRIMARY,
+ (enabled ? HWC_POWER_MODE_NORMAL : HWC_POWER_MODE_OFF));
+ } else {
+ mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, !enabled);
+ }
+#else
if (mHwc && mHwc->blank) {
mHwc->blank(mHwc, HWC_DISPLAY_PRIMARY, !enabled);
} else if (mFBDevice && mFBDevice->enableScreen) {
mFBDevice->enableScreen(mFBDevice, enabled);
}
+#endif
if (enabled && mEnabledCallback) {
mEnabledCallback(enabled);
}
if (!enabled) {
autosuspend_enable();
mPowerModule->setInteractive(mPowerModule, false);
--
2.1.2
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment