sdm710-common: libperfmgr: remove Google-specific VR and camera hints
Change-Id: Iac0e65a16f660583d3400a35622113d35d8d1d27 Signed-off-by: Chenyang Zhong <zhongcy95@gmail.com>
This commit is contained in:
parent
2018306009
commit
dd42b3033c
2 changed files with 7 additions and 67 deletions
|
@ -50,7 +50,6 @@ Power::Power(std::shared_ptr<DisplayLowPower> dlpw, std::shared_ptr<AdaptiveCpu>
|
||||||
: mDisplayLowPower(dlpw),
|
: mDisplayLowPower(dlpw),
|
||||||
mAdaptiveCpu(adaptiveCpu),
|
mAdaptiveCpu(adaptiveCpu),
|
||||||
mInteractionHandler(nullptr),
|
mInteractionHandler(nullptr),
|
||||||
mVRModeOn(false),
|
|
||||||
mSustainedPerfModeOn(false) {
|
mSustainedPerfModeOn(false) {
|
||||||
mInteractionHandler = std::make_unique<InteractionHandler>();
|
mInteractionHandler = std::make_unique<InteractionHandler>();
|
||||||
mInteractionHandler->Init();
|
mInteractionHandler->Init();
|
||||||
|
@ -60,15 +59,6 @@ Power::Power(std::shared_ptr<DisplayLowPower> dlpw, std::shared_ptr<AdaptiveCpu>
|
||||||
LOG(INFO) << "Initialize with SUSTAINED_PERFORMANCE on";
|
LOG(INFO) << "Initialize with SUSTAINED_PERFORMANCE on";
|
||||||
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
|
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
|
||||||
mSustainedPerfModeOn = true;
|
mSustainedPerfModeOn = true;
|
||||||
} else if (state == "VR") {
|
|
||||||
LOG(INFO) << "Initialize with VR on";
|
|
||||||
HintManager::GetInstance()->DoHint(state);
|
|
||||||
mVRModeOn = true;
|
|
||||||
} else if (state == "VR_SUSTAINED_PERFORMANCE") {
|
|
||||||
LOG(INFO) << "Initialize with SUSTAINED_PERFORMANCE and VR on";
|
|
||||||
HintManager::GetInstance()->DoHint("VR_SUSTAINED_PERFORMANCE");
|
|
||||||
mSustainedPerfModeOn = true;
|
|
||||||
mVRModeOn = true;
|
|
||||||
} else {
|
} else {
|
||||||
LOG(INFO) << "Initialize PowerHAL";
|
LOG(INFO) << "Initialize PowerHAL";
|
||||||
}
|
}
|
||||||
|
@ -94,51 +84,15 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Mode::LOW_POWER:
|
case Mode::LOW_POWER:
|
||||||
mDisplayLowPower->SetDisplayLowPower(enabled);
|
|
||||||
if (enabled) {
|
|
||||||
HintManager::GetInstance()->DoHint(toString(type));
|
|
||||||
} else {
|
|
||||||
HintManager::GetInstance()->EndHint(toString(type));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case Mode::SUSTAINED_PERFORMANCE:
|
case Mode::SUSTAINED_PERFORMANCE:
|
||||||
if (enabled && !mSustainedPerfModeOn) {
|
if (enabled) {
|
||||||
if (!mVRModeOn) { // Sustained mode only.
|
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
|
||||||
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
|
|
||||||
} else { // Sustained + VR mode.
|
|
||||||
HintManager::GetInstance()->EndHint("VR");
|
|
||||||
HintManager::GetInstance()->DoHint("VR_SUSTAINED_PERFORMANCE");
|
|
||||||
}
|
|
||||||
mSustainedPerfModeOn = true;
|
|
||||||
} else if (!enabled && mSustainedPerfModeOn) {
|
|
||||||
HintManager::GetInstance()->EndHint("VR_SUSTAINED_PERFORMANCE");
|
|
||||||
HintManager::GetInstance()->EndHint("SUSTAINED_PERFORMANCE");
|
|
||||||
if (mVRModeOn) { // Switch back to VR Mode.
|
|
||||||
HintManager::GetInstance()->DoHint("VR");
|
|
||||||
}
|
|
||||||
mSustainedPerfModeOn = false;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case Mode::VR:
|
|
||||||
if (enabled && !mVRModeOn) {
|
|
||||||
if (!mSustainedPerfModeOn) { // VR mode only.
|
|
||||||
HintManager::GetInstance()->DoHint("VR");
|
|
||||||
} else { // Sustained + VR mode.
|
|
||||||
HintManager::GetInstance()->EndHint("SUSTAINED_PERFORMANCE");
|
|
||||||
HintManager::GetInstance()->DoHint("VR_SUSTAINED_PERFORMANCE");
|
|
||||||
}
|
|
||||||
mVRModeOn = true;
|
|
||||||
} else if (!enabled && mVRModeOn) {
|
|
||||||
HintManager::GetInstance()->EndHint("VR_SUSTAINED_PERFORMANCE");
|
|
||||||
HintManager::GetInstance()->EndHint("VR");
|
|
||||||
if (mSustainedPerfModeOn) { // Switch back to sustained Mode.
|
|
||||||
HintManager::GetInstance()->DoHint("SUSTAINED_PERFORMANCE");
|
|
||||||
}
|
|
||||||
mVRModeOn = false;
|
|
||||||
}
|
}
|
||||||
|
mSustainedPerfModeOn = true;
|
||||||
break;
|
break;
|
||||||
case Mode::LAUNCH:
|
case Mode::LAUNCH:
|
||||||
if (mVRModeOn || mSustainedPerfModeOn) {
|
if (mSustainedPerfModeOn) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
|
@ -156,14 +110,6 @@ ndk::ScopedAStatus Power::setMode(Mode type, bool enabled) {
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Mode::AUDIO_STREAMING_LOW_LATENCY:
|
case Mode::AUDIO_STREAMING_LOW_LATENCY:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Mode::CAMERA_STREAMING_SECURE:
|
|
||||||
[[fallthrough]];
|
|
||||||
case Mode::CAMERA_STREAMING_LOW:
|
|
||||||
[[fallthrough]];
|
|
||||||
case Mode::CAMERA_STREAMING_MID:
|
|
||||||
[[fallthrough]];
|
|
||||||
case Mode::CAMERA_STREAMING_HIGH:
|
|
||||||
[[fallthrough]];
|
|
||||||
case Mode::GAME_LOADING:
|
case Mode::GAME_LOADING:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
default:
|
default:
|
||||||
|
@ -197,7 +143,7 @@ ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) {
|
||||||
}
|
}
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case Boost::INTERACTION:
|
case Boost::INTERACTION:
|
||||||
if (mVRModeOn || mSustainedPerfModeOn) {
|
if (mSustainedPerfModeOn) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
mInteractionHandler->Acquire(durationMs);
|
mInteractionHandler->Acquire(durationMs);
|
||||||
|
@ -208,12 +154,8 @@ ndk::ScopedAStatus Power::setBoost(Boost type, int32_t durationMs) {
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Boost::AUDIO_LAUNCH:
|
case Boost::AUDIO_LAUNCH:
|
||||||
[[fallthrough]];
|
[[fallthrough]];
|
||||||
case Boost::CAMERA_LAUNCH:
|
|
||||||
[[fallthrough]];
|
|
||||||
case Boost::CAMERA_SHOT:
|
|
||||||
[[fallthrough]];
|
|
||||||
default:
|
default:
|
||||||
if (mVRModeOn || mSustainedPerfModeOn) {
|
if (mSustainedPerfModeOn) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (durationMs > 0) {
|
if (durationMs > 0) {
|
||||||
|
@ -244,9 +186,8 @@ constexpr const char *boolToString(bool b) {
|
||||||
binder_status_t Power::dump(int fd, const char **, uint32_t) {
|
binder_status_t Power::dump(int fd, const char **, uint32_t) {
|
||||||
std::string buf(::android::base::StringPrintf(
|
std::string buf(::android::base::StringPrintf(
|
||||||
"HintManager Running: %s\n"
|
"HintManager Running: %s\n"
|
||||||
"VRMode: %s\n"
|
|
||||||
"SustainedPerformanceMode: %s\n",
|
"SustainedPerformanceMode: %s\n",
|
||||||
boolToString(HintManager::GetInstance()->IsRunning()), boolToString(mVRModeOn),
|
boolToString(HintManager::GetInstance()->IsRunning()),
|
||||||
boolToString(mSustainedPerfModeOn)));
|
boolToString(mSustainedPerfModeOn)));
|
||||||
// Dump nodes through libperfmgr
|
// Dump nodes through libperfmgr
|
||||||
HintManager::GetInstance()->DumpToFd(fd);
|
HintManager::GetInstance()->DumpToFd(fd);
|
||||||
|
|
|
@ -55,7 +55,6 @@ class Power : public ::aidl::android::hardware::power::BnPower {
|
||||||
std::shared_ptr<DisplayLowPower> mDisplayLowPower;
|
std::shared_ptr<DisplayLowPower> mDisplayLowPower;
|
||||||
std::shared_ptr<AdaptiveCpu> mAdaptiveCpu;
|
std::shared_ptr<AdaptiveCpu> mAdaptiveCpu;
|
||||||
std::unique_ptr<InteractionHandler> mInteractionHandler;
|
std::unique_ptr<InteractionHandler> mInteractionHandler;
|
||||||
std::atomic<bool> mVRModeOn;
|
|
||||||
std::atomic<bool> mSustainedPerfModeOn;
|
std::atomic<bool> mSustainedPerfModeOn;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue