powerstats: use display MRR state residency data provider
Bug: 322458289 Test: vts-tradefed run vts -m VtsHalPowerStatsTargetTest Change-Id: Icba2a7da9c9480ce609b3cd07bd79ff2533c9ba4 Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
parent
68451c06e0
commit
dbd42fcb78
1 changed files with 40 additions and 26 deletions
|
@ -38,6 +38,12 @@ using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
||||||
|
|
||||||
void addDisplay(std::shared_ptr<PowerStats> p) {
|
void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||||
// Add display residency stats for inner display
|
// Add display residency stats for inner display
|
||||||
|
struct stat primaryBuffer;
|
||||||
|
if (!stat("/sys/class/drm/card0/device/primary-panel/time_in_state", &primaryBuffer)) {
|
||||||
|
// time_in_state exists
|
||||||
|
addDisplayMrrByEntity(p, "Inner Display", "/sys/class/drm/card0/device/primary-panel/");
|
||||||
|
} else {
|
||||||
|
// time_in_state doesn't exist
|
||||||
std::vector<std::string> inner_states = {
|
std::vector<std::string> inner_states = {
|
||||||
"Off",
|
"Off",
|
||||||
"LP: 1840x2208@1",
|
"LP: 1840x2208@1",
|
||||||
|
@ -53,8 +59,15 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||||
"Inner Display",
|
"Inner Display",
|
||||||
"/sys/class/backlight/panel0-backlight/state",
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
inner_states));
|
inner_states));
|
||||||
|
}
|
||||||
|
|
||||||
// Add display residency stats for outer display
|
// Add display residency stats for outer display
|
||||||
|
struct stat secondaryBuffer;
|
||||||
|
if (!stat("/sys/class/drm/card0/device/secondary-panel/time_in_state", &secondaryBuffer)) {
|
||||||
|
// time_in_state exists
|
||||||
|
addDisplayMrrByEntity(p, "Outer Display", "/sys/class/drm/card0/device/secondary-panel/");
|
||||||
|
} else {
|
||||||
|
// time_in_state doesn't exist
|
||||||
std::vector<std::string> outer_states = {
|
std::vector<std::string> outer_states = {
|
||||||
"Off",
|
"Off",
|
||||||
"LP: 1080x2092@30",
|
"LP: 1080x2092@30",
|
||||||
|
@ -68,6 +81,7 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||||
"Outer Display",
|
"Outer Display",
|
||||||
"/sys/class/backlight/panel1-backlight/state",
|
"/sys/class/backlight/panel1-backlight/state",
|
||||||
outer_states));
|
outer_states));
|
||||||
|
}
|
||||||
|
|
||||||
// Add display energy consumer
|
// Add display energy consumer
|
||||||
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterConsumer(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue