powerstats: use display MRR state residency data provider

Bug: 322457936
Test: vts-tradefed run vts -m VtsHalPowerStatsTargetTest
Change-Id: I1a0c7fcaaf832a9c1d8eff3a6a59d98cfc23e28d
Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
Darren Hsu 2024-01-26 17:32:08 +08:00
parent 0bbb57c706
commit 7eeb1b93ac

View File

@ -36,17 +36,24 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> p) {
// Add display residency stats
std::vector<std::string> states = {
"Off",
"LP: 1080x2400@30",
"On: 1080x2400@60",
"On: 1080x2400@90",
"HBM: 1080x2400@60",
"HBM: 1080x2400@90"};
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<std::string> states = {
"Off",
"LP: 1080x2400@30",
"On: 1080x2400@60",
"On: 1080x2400@90",
"HBM: 1080x2400@60",
"HBM: 1080x2400@90"};
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
"/sys/class/backlight/panel0-backlight/state",
states));
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
"/sys/class/backlight/panel0-backlight/state",
states));
}
// Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(p,