power: Add a debug property for switching powerhint.json path
Add a bool property `vendor.powerhal.config.debug`. Power HAL would use `/data/vendor/etc/powerhint.json` when vendor.powerhal.config.debug = true. Bug: 218872105 Bug: 206061061 Test: adb wait-for-device root; adb shell mkdir -p /data/vendor/etc/; adb push powerhint_mod.json /data/vendor/etc/powerhint.json Test: adb shell setprop vendor.powerhal.config.debug true && \ adb shell getprop vendor.powerhal.config.debug && \ adb shell stop vendor.power-hal-aidl && \ adb shell start vendor.power-hal-aidl && adb shell stop && adb shell start Test: adb pull /data/local.prop ; vim local.prop + vendor.powerhal.config.debug=true Test: adb wait-for-device root && adb shell perfetto -o \ /data/misc/perfetto-traces/trace_file.perfetto-trace -t 20s sched freq \ idle am wm gfx view power hal && \ adb pull /data/misc/perfetto-traces/trace_file.perfetto-trace trace_profile_debug.pftrace Change-Id: Ibaf5df280b989a8268efce1e3ab9a3f1e5510800
This commit is contained in:
parent
445137072b
commit
3978399d16
@ -34,6 +34,7 @@ using aidl::google::hardware::power::impl::pixel::PowerSessionManager;
|
||||
using ::android::perfmgr::HintManager;
|
||||
|
||||
constexpr std::string_view kPowerHalInitProp("vendor.powerhal.init");
|
||||
constexpr std::string_view kConfigDebugPathProperty("vendor.powerhal.config.debug");
|
||||
constexpr std::string_view kConfigProperty("vendor.powerhal.config");
|
||||
constexpr std::string_view kConfigDefaultFileName("powerhint.json");
|
||||
|
||||
@ -68,14 +69,23 @@ int main() {
|
||||
CHECK(status == STATUS_OK);
|
||||
LOG(INFO) << "Xiaomi Power HAL AIDL Service with Extension is started.";
|
||||
|
||||
if (::android::base::GetIntProperty("vendor.powerhal.adpf.rate", -1) != -1) {
|
||||
PowerHintMonitor::getInstance()->start();
|
||||
PowerSessionManager::getInstance()->setHintManager(hm);
|
||||
}
|
||||
|
||||
std::thread initThread([&]() {
|
||||
::android::base::WaitForProperty(kPowerHalInitProp.data(), "1");
|
||||
hm->Start();
|
||||
|
||||
// use debug config for ADPF tuning.
|
||||
if (android::base::GetBoolProperty(kConfigDebugPathProperty.data(), false)) {
|
||||
const std::string debug_config_path =
|
||||
"/data/vendor/etc/" + android::base::GetProperty(kConfigProperty.data(),
|
||||
kConfigDefaultFileName.data());
|
||||
hm = HintManager::GetFromJSON(debug_config_path, false);
|
||||
LOG(WARNING) << "Xiaomi Power HAL AIDL Service with Extension is reloading with config: "
|
||||
<< debug_config_path;
|
||||
}
|
||||
if (::android::base::GetIntProperty("vendor.powerhal.adpf.rate", -1) != -1) {
|
||||
PowerHintMonitor::getInstance()->start();
|
||||
PowerSessionManager::getInstance()->setHintManager(hm);
|
||||
}
|
||||
});
|
||||
initThread.detach();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user