summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger/DisplayHardware
diff options
context:
space:
mode:
authorRuchi Kandoi <kandoiruchi@google.com>2014-04-04 18:09:30 -0700
committerRuchi Kandoi <kandoiruchi@google.com>2014-04-04 18:09:30 -0700
commit4098f03d5c9fb8522279ca04da70bec6793b2caa (patch)
treece2138f9edd7ed2c5a515389bcfdb2028d16f307 /services/surfaceflinger/DisplayHardware
parentd469a1c3285b974cf2637517cc25727da8f82668 (diff)
downloadframeworks_native-4098f03d5c9fb8522279ca04da70bec6793b2caa.zip
frameworks_native-4098f03d5c9fb8522279ca04da70bec6793b2caa.tar.gz
frameworks_native-4098f03d5c9fb8522279ca04da70bec6793b2caa.tar.bz2
Revert "SurfaceFlinger: send VSYNC power hints to IPowerManager"
This reverts commit d469a1c3285b974cf2637517cc25727da8f82668.
Diffstat (limited to 'services/surfaceflinger/DisplayHardware')
-rw-r--r--services/surfaceflinger/DisplayHardware/PowerHAL.cpp40
-rw-r--r--services/surfaceflinger/DisplayHardware/PowerHAL.h10
2 files changed, 30 insertions, 20 deletions
diff --git a/services/surfaceflinger/DisplayHardware/PowerHAL.cpp b/services/surfaceflinger/DisplayHardware/PowerHAL.cpp
index bd50b4a..e41fbbc 100644
--- a/services/surfaceflinger/DisplayHardware/PowerHAL.cpp
+++ b/services/surfaceflinger/DisplayHardware/PowerHAL.cpp
@@ -20,30 +20,38 @@
#include <cutils/log.h>
#include <utils/Errors.h>
-#include <binder/IServiceManager.h>
-#include <powermanager/IPowerManager.h>
-#include <powermanager/PowerManager.h>
-
#include "PowerHAL.h"
namespace android {
// ---------------------------------------------------------------------------
+PowerHAL::PowerHAL() : mPowerModule(0), mVSyncHintEnabled(false) {
+ int err = hw_get_module(POWER_HARDWARE_MODULE_ID,
+ (const hw_module_t **)&mPowerModule);
+ ALOGW_IF(err, "%s module not found", POWER_HARDWARE_MODULE_ID);
+}
+
+PowerHAL::~PowerHAL() {
+}
+
+status_t PowerHAL::initCheck() const {
+ return mPowerModule ? NO_ERROR : NO_INIT;
+}
+
status_t PowerHAL::vsyncHint(bool enabled) {
- Mutex::Autolock _l(mlock);
- if (mPowerManager == NULL) {
- const String16 serviceName("power");
- sp<IBinder> bs = defaultServiceManager()->checkService(serviceName);
- if (bs == NULL) {
- return NAME_NOT_FOUND;
- }
- mPowerManager = interface_cast<IPowerManager>(bs);
+ if (!mPowerModule) {
+ return NO_INIT;
}
- status_t status = mPowerManager->powerHint(POWER_HINT_VSYNC, enabled ? 1 : 0);
- if(status == DEAD_OBJECT) {
- mPowerManager = NULL;
+ if (mPowerModule->common.module_api_version >= POWER_MODULE_API_VERSION_0_2) {
+ if (mPowerModule->powerHint) {
+ if (mVSyncHintEnabled != bool(enabled)) {
+ mPowerModule->powerHint(mPowerModule,
+ POWER_HINT_VSYNC, (void*)enabled);
+ mVSyncHintEnabled = bool(enabled);
+ }
+ }
}
- return status;
+ return NO_ERROR;
}
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/DisplayHardware/PowerHAL.h b/services/surfaceflinger/DisplayHardware/PowerHAL.h
index e5f82a9..ef67b8f 100644
--- a/services/surfaceflinger/DisplayHardware/PowerHAL.h
+++ b/services/surfaceflinger/DisplayHardware/PowerHAL.h
@@ -19,9 +19,7 @@
#include <stdint.h>
#include <sys/types.h>
-#include <utils/Mutex.h>
-#include <powermanager/IPowerManager.h>
#include <hardware/power.h>
namespace android {
@@ -30,11 +28,15 @@ namespace android {
class PowerHAL
{
public:
+ PowerHAL();
+ ~PowerHAL();
+
+ status_t initCheck() const;
status_t vsyncHint(bool enabled);
private:
- sp<IPowerManager> mPowerManager;
- Mutex mlock;
+ power_module_t* mPowerModule;
+ bool mVSyncHintEnabled;
};
// ---------------------------------------------------------------------------