display: create entity_name property
HWC should designate the entity name 'Inner-Display' for the primary display in cases of dual panels. Bug: 329370514 Test: verify powerstats for dual panel devices Change-Id: Id9dc05d081f21dad7c97f9a7a061164fb01644dd
This commit is contained in:
parent
4ae1a5d169
commit
7a3f70b91e
2 changed files with 7 additions and 28 deletions
|
@ -32,36 +32,12 @@ using aidl::android::hardware::power::stats::DisplayStateResidencyDataProvider;
|
|||
using aidl::android::hardware::power::stats::EnergyConsumerType;
|
||||
using aidl::android::hardware::power::stats::PowerStatsEnergyConsumer;
|
||||
|
||||
void addDisplay(std::shared_ptr<PowerStats> p) {
|
||||
// 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 = {
|
||||
"Off",
|
||||
"LP: 2152x2076@1",
|
||||
"LP: 2152x2076@30",
|
||||
"On: 2152x2076@1",
|
||||
"On: 2152x2076@10",
|
||||
"On: 2152x2076@60",
|
||||
"On: 2152x2076@120",
|
||||
"HBM: 2152x2076@60",
|
||||
"HBM: 2152x2076@120"};
|
||||
|
||||
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
|
||||
"Inner Display",
|
||||
"/sys/class/backlight/panel0-backlight/state",
|
||||
inner_states));
|
||||
}
|
||||
|
||||
void addOuterDisplay(std::shared_ptr<PowerStats> p) {
|
||||
// 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/");
|
||||
addDisplayMrrByEntity(p, "Outer-Display", "/sys/class/drm/card0/device/secondary-panel/");
|
||||
} else {
|
||||
// time_in_state doesn't exist
|
||||
std::vector<std::string> outer_states = {
|
||||
|
@ -73,7 +49,7 @@ void addDisplay(std::shared_ptr<PowerStats> p) {
|
|||
"HBM: 1080x2424@120"};
|
||||
|
||||
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>(
|
||||
"Outer Display",
|
||||
"Outer-Display",
|
||||
"/sys/class/backlight/panel1-backlight/state",
|
||||
outer_states));
|
||||
}
|
||||
|
@ -94,8 +70,9 @@ int main() {
|
|||
|
||||
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
||||
|
||||
addDisplayVrr(p, "Inner-Display");
|
||||
addZumaProCommonDataProviders(p);
|
||||
addDisplay(p);
|
||||
addOuterDisplay(p);
|
||||
|
||||
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
||||
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue