diff --git a/services/surfaceflinger/DisplayHardware/PowerHAL.cpp b/services/surfaceflinger/DisplayHardware/PowerHAL.cpp index 0cb47d59a..e41fbbc31 100644 --- a/services/surfaceflinger/DisplayHardware/PowerHAL.cpp +++ b/services/surfaceflinger/DisplayHardware/PowerHAL.cpp @@ -25,7 +25,7 @@ namespace android { // --------------------------------------------------------------------------- -PowerHAL::PowerHAL() : mPowerModule(0) { +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); @@ -44,7 +44,11 @@ status_t PowerHAL::vsyncHint(bool enabled) { } if (mPowerModule->common.module_api_version >= POWER_MODULE_API_VERSION_0_2) { 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; diff --git a/services/surfaceflinger/DisplayHardware/PowerHAL.h b/services/surfaceflinger/DisplayHardware/PowerHAL.h index 929bc0396..ef67b8f19 100644 --- a/services/surfaceflinger/DisplayHardware/PowerHAL.h +++ b/services/surfaceflinger/DisplayHardware/PowerHAL.h @@ -36,6 +36,7 @@ public: private: power_module_t* mPowerModule; + bool mVSyncHintEnabled; }; // ---------------------------------------------------------------------------