don't actuate vsync hint when not needed

Change-Id: I61c43dd76041816ab8cbe9aeaa55c11c1479ed03
This commit is contained in:
Mathias Agopian 2012-04-27 13:55:05 -07:00
parent 03e407270c
commit 06e51a0aaf
2 changed files with 7 additions and 2 deletions

View File

@ -25,7 +25,7 @@
namespace android { namespace android {
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
PowerHAL::PowerHAL() : mPowerModule(0) { PowerHAL::PowerHAL() : mPowerModule(0), mVSyncHintEnabled(false) {
int err = hw_get_module(POWER_HARDWARE_MODULE_ID, int err = hw_get_module(POWER_HARDWARE_MODULE_ID,
(const hw_module_t **)&mPowerModule); (const hw_module_t **)&mPowerModule);
ALOGW_IF(err, "%s module not found", POWER_HARDWARE_MODULE_ID); ALOGW_IF(err, "%s module not found", POWER_HARDWARE_MODULE_ID);
@ -44,7 +44,11 @@ status_t PowerHAL::vsyncHint(bool enabled) {
} }
if (mPowerModule->common.module_api_version >= POWER_MODULE_API_VERSION_0_2) { if (mPowerModule->common.module_api_version >= POWER_MODULE_API_VERSION_0_2) {
if (mPowerModule->powerHint) { if (mPowerModule->powerHint) {
mPowerModule->powerHint(mPowerModule, POWER_HINT_VSYNC, (void*)enabled); if (mVSyncHintEnabled != bool(enabled)) {
mPowerModule->powerHint(mPowerModule,
POWER_HINT_VSYNC, (void*)enabled);
mVSyncHintEnabled = bool(enabled);
}
} }
} }
return NO_ERROR; return NO_ERROR;

View File

@ -36,6 +36,7 @@ public:
private: private:
power_module_t* mPowerModule; power_module_t* mPowerModule;
bool mVSyncHintEnabled;
}; };
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------