Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 06e51a0a authored by Mathias Agopian's avatar Mathias Agopian
Browse files

don't actuate vsync hint when not needed

Change-Id: I61c43dd76041816ab8cbe9aeaa55c11c1479ed03
parent 03e40727
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@ public:

private:
    power_module_t*   mPowerModule;
    bool mVSyncHintEnabled;
};

// ---------------------------------------------------------------------------