From a6b5f7acc48d10fdc0733936628affc8359f966e Mon Sep 17 00:00:00 2001 From: Darren Hsu Date: Wed, 13 Mar 2024 11:54:43 +0800 Subject: [PATCH] powerstats: use display VRR power stats on specific devices Bug: 329201432 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I77d49f87929a7e534576f3a6d77fc820172f7f93 Signed-off-by: Darren Hsu --- powerstats/caiman/service.cpp | 33 +-------------------------------- powerstats/komodo/service.cpp | 33 +-------------------------------- 2 files changed, 2 insertions(+), 64 deletions(-) diff --git a/powerstats/caiman/service.cpp b/powerstats/caiman/service.cpp index 3ed20dd5..acf90cd3 100644 --- a/powerstats/caiman/service.cpp +++ b/powerstats/caiman/service.cpp @@ -33,38 +33,6 @@ using aidl::android::hardware::power::stats::EnergyConsumerType; using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer; void addDisplay(std::shared_ptr p) { - // Add display residency stats - struct stat buffer; - if (!stat("/sys/class/drm/card0/device/primary-panel/time_in_state", &buffer)) { - // time_in_state exists - addDisplayMrr(p); - } else { - // time_in_state doesn't exist - std::vector states = { - "Off", - "LP: 960x2142@1", - "LP: 960x2142@30", - "On: 960x2142@1", - "On: 960x2142@30", - "On: 960x2142@60", - "On: 960x2142@120", - "HBM: 960x2142@60", - "HBM: 960x2142@120", - "LP: 1280x2856@1", - "LP: 1280x2856@30", - "On: 1280x2856@1", - "On: 1280x2856@30", - "On: 1280x2856@60", - "On: 1280x2856@120", - "HBM: 1280x2856@60", - "HBM: 1280x2856@120"}; - - p->addStateResidencyDataProvider(std::make_unique( - "Display", - "/sys/class/backlight/panel0-backlight/state", - states)); - } - // Add display energy consumer p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer( p, @@ -81,6 +49,7 @@ int main() { std::shared_ptr p = ndk::SharedRefBase::make(); + addDisplayVrr(p, "Display"); addZumaProCommonDataProviders(p); addDisplay(p); diff --git a/powerstats/komodo/service.cpp b/powerstats/komodo/service.cpp index 2d873333..acf90cd3 100644 --- a/powerstats/komodo/service.cpp +++ b/powerstats/komodo/service.cpp @@ -33,38 +33,6 @@ using aidl::android::hardware::power::stats::EnergyConsumerType; using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer; void addDisplay(std::shared_ptr p) { - // Add display residency stats - struct stat buffer; - if (!stat("/sys/class/drm/card0/device/primary-panel/time_in_state", &buffer)) { - // time_in_state exists - addDisplayMrr(p); - } else { - // time_in_state doesn't exist - std::vector states = { - "Off", - "LP: 1008x2244@1", - "LP: 1008x2244@30", - "On: 1008x2244@1", - "On: 1008x2244@30", - "On: 1008x2244@60", - "On: 1008x2244@120", - "HBM: 1008x2244@60", - "HBM: 1008x2244@120", - "LP: 1344x2992@1", - "LP: 1344x2992@30", - "On: 1344x2992@1", - "On: 1344x2992@30", - "On: 1344x2992@60", - "On: 1344x2992@120", - "HBM: 1344x2992@60", - "HBM: 1344x2992@120"}; - - p->addStateResidencyDataProvider(std::make_unique( - "Display", - "/sys/class/backlight/panel0-backlight/state", - states)); - } - // Add display energy consumer p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer( p, @@ -81,6 +49,7 @@ int main() { std::shared_ptr p = ndk::SharedRefBase::make(); + addDisplayVrr(p, "Display"); addZumaProCommonDataProviders(p); addDisplay(p);