powerstats: use display MRR state residency data provider

Bug: 322453302
Test: vts-tradefed run vts -m VtsHalPowerStatsTargetTest
Change-Id: I78ddca8aa7f4994157845545d01d6325dd09d5ed
Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
Darren Hsu 2024-01-26 16:38:52 +08:00
parent 215acdae3f
commit 4c9c90a5ad
2 changed files with 43 additions and 29 deletions

View file

@ -36,6 +36,12 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> 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<std::string> states = {
"Off",
"LP: 1440x3120@30",
@ -55,6 +61,7 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
"Display",
"/sys/class/backlight/panel0-backlight/state",
states));
}
// Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(

View file

@ -34,6 +34,12 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
void addDisplay(std::shared_ptr<PowerStats> 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<std::string> states = {
"Off",
"LP: 1080x2400@30",
@ -46,6 +52,7 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
"Display",
"/sys/class/backlight/panel0-backlight/state",
states));
}
// Add display energy consumer
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(