powerstats: Add device specific display states
Bug: 167216667 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I90ea3553ababbc802fdc6f893f698b85655b1ad9
This commit is contained in:
parent
56926638e1
commit
e04673cadf
4 changed files with 146 additions and 4 deletions
|
@ -16,8 +16,10 @@
|
||||||
|
|
||||||
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
||||||
|
|
||||||
#include <PowerStatsAidl.h>
|
#include <dataproviders/DisplayStateResidencyDataProvider.h>
|
||||||
|
#include <dataproviders/PowerStatsEnergyConsumer.h>
|
||||||
#include <Gs101CommonDataProviders.h>
|
#include <Gs101CommonDataProviders.h>
|
||||||
|
#include <PowerStatsAidl.h>
|
||||||
|
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
|
@ -25,6 +27,37 @@
|
||||||
#include <android/binder_process.h>
|
#include <android/binder_process.h>
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
|
|
||||||
|
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
|
||||||
|
std::vector<std::string> states = {
|
||||||
|
"Off",
|
||||||
|
"LP: 1080x2400@30",
|
||||||
|
"On: 1080x2400@60",
|
||||||
|
"On: 1080x2400@90",
|
||||||
|
"HBM: 1080x2400@60",
|
||||||
|
};
|
||||||
|
|
||||||
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
||||||
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
|
states));
|
||||||
|
|
||||||
|
// Add display energy consumer
|
||||||
|
/*
|
||||||
|
* TODO(b/167216667): Add correct display power model here. Must read from display rail
|
||||||
|
* and include proper coefficients for display states.
|
||||||
|
*/
|
||||||
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(p,
|
||||||
|
EnergyConsumerType::DISPLAY, "display", {"PPVAR_VSYS_PWR_DISP"}, "Display",
|
||||||
|
{{"LP: 1080x2400@30", 1},
|
||||||
|
{"On: 1080x2400@60", 2},
|
||||||
|
{"On: 1080x2400@90", 3},
|
||||||
|
{"HBM: 1080x2400@60", 4}}));
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
||||||
|
|
||||||
|
@ -34,6 +67,7 @@ int main() {
|
||||||
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
||||||
|
|
||||||
addGs101CommonDataProviders(p);
|
addGs101CommonDataProviders(p);
|
||||||
|
addDisplay(p);
|
||||||
|
|
||||||
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
||||||
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
|
|
||||||
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
||||||
|
|
||||||
#include <PowerStatsAidl.h>
|
#include <dataproviders/DisplayStateResidencyDataProvider.h>
|
||||||
|
#include <dataproviders/PowerStatsEnergyConsumer.h>
|
||||||
#include <Gs101CommonDataProviders.h>
|
#include <Gs101CommonDataProviders.h>
|
||||||
|
#include <PowerStatsAidl.h>
|
||||||
|
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
|
@ -25,6 +27,45 @@
|
||||||
#include <android/binder_process.h>
|
#include <android/binder_process.h>
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
|
|
||||||
|
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
|
||||||
|
std::vector<std::string> states = {
|
||||||
|
"Off",
|
||||||
|
"LP: 1440x3120@10",
|
||||||
|
"LP: 1440x3120@30",
|
||||||
|
"On: 1440x3120@10",
|
||||||
|
"On: 1440x3120@30",
|
||||||
|
"On: 1440x3120@60",
|
||||||
|
"On: 1440x3120@90",
|
||||||
|
"On: 1440x3120@120",
|
||||||
|
"HBM: 1440x3120@60",
|
||||||
|
};
|
||||||
|
|
||||||
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
||||||
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
|
states));
|
||||||
|
|
||||||
|
// Add display energy consumer
|
||||||
|
/*
|
||||||
|
* TODO(b/167216667): Add correct display power model here. Must read from display rail
|
||||||
|
* and include proper coefficients for display states.
|
||||||
|
*/
|
||||||
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(p,
|
||||||
|
EnergyConsumerType::DISPLAY, "display", {"PPVAR_VSYS_PWR_DISP"}, "Display",
|
||||||
|
{{"LP: 1440x3120@10", 1},
|
||||||
|
{"LP: 1440x3120@30", 2},
|
||||||
|
{"On: 1440x3120@10", 3},
|
||||||
|
{"On: 1440x3120@30", 4},
|
||||||
|
{"On: 1440x3120@60", 5},
|
||||||
|
{"On: 1440x3120@90", 6},
|
||||||
|
{"On: 1440x3120@120", 7},
|
||||||
|
{"HBM: 1440x3120@60", 8}}));
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
||||||
|
|
||||||
|
@ -34,6 +75,7 @@ int main() {
|
||||||
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
||||||
|
|
||||||
addGs101CommonDataProviders(p);
|
addGs101CommonDataProviders(p);
|
||||||
|
addDisplay(p);
|
||||||
|
|
||||||
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
||||||
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
|
|
||||||
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
||||||
|
|
||||||
#include <PowerStatsAidl.h>
|
#include <dataproviders/DisplayStateResidencyDataProvider.h>
|
||||||
|
#include <dataproviders/PowerStatsEnergyConsumer.h>
|
||||||
#include <Gs101CommonDataProviders.h>
|
#include <Gs101CommonDataProviders.h>
|
||||||
|
#include <PowerStatsAidl.h>
|
||||||
|
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
|
@ -25,6 +27,36 @@
|
||||||
#include <android/binder_process.h>
|
#include <android/binder_process.h>
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
|
|
||||||
|
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
|
||||||
|
std::vector<std::string> states = {
|
||||||
|
"Off",
|
||||||
|
"LP: 1440x3040@30",
|
||||||
|
"On: 1440x3040@60",
|
||||||
|
"On: 1440x3040@90",
|
||||||
|
"HBM: 1440x3040@60",
|
||||||
|
"HBM: 1440x3040@90"};
|
||||||
|
|
||||||
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
||||||
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
|
states));
|
||||||
|
|
||||||
|
// Add display energy consumer
|
||||||
|
/*
|
||||||
|
* TODO(b/167216667): Add correct display power model here. Must read from display rail
|
||||||
|
* and include proper coefficients for display states.
|
||||||
|
*/
|
||||||
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(p,
|
||||||
|
EnergyConsumerType::DISPLAY, "display", {"PPVAR_VSYS_PWR_DISP"}, "Display",
|
||||||
|
{{"LP: 1440x3040@30", 1},
|
||||||
|
{"On: 1440x3040@60", 2},
|
||||||
|
{"On: 1440x3040@90", 3}}));
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
||||||
|
|
||||||
|
@ -34,6 +66,7 @@ int main() {
|
||||||
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
||||||
|
|
||||||
addGs101CommonDataProviders(p);
|
addGs101CommonDataProviders(p);
|
||||||
|
addDisplay(p);
|
||||||
|
|
||||||
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
||||||
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
||||||
|
|
|
@ -16,8 +16,10 @@
|
||||||
|
|
||||||
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
#define LOG_TAG "android.hardware.power.stats-service.pixel"
|
||||||
|
|
||||||
#include <PowerStatsAidl.h>
|
#include <dataproviders/DisplayStateResidencyDataProvider.h>
|
||||||
|
#include <dataproviders/PowerStatsEnergyConsumer.h>
|
||||||
#include <Gs101CommonDataProviders.h>
|
#include <Gs101CommonDataProviders.h>
|
||||||
|
#include <PowerStatsAidl.h>
|
||||||
|
|
||||||
#include <android-base/logging.h>
|
#include <android-base/logging.h>
|
||||||
#include <android-base/properties.h>
|
#include <android-base/properties.h>
|
||||||
|
@ -25,6 +27,36 @@
|
||||||
#include <android/binder_process.h>
|
#include <android/binder_process.h>
|
||||||
#include <log/log.h>
|
#include <log/log.h>
|
||||||
|
|
||||||
|
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
|
||||||
|
std::vector<std::string> states = {
|
||||||
|
"Off",
|
||||||
|
"LP: 1080x2340@30",
|
||||||
|
"On: 1080x2340@60",
|
||||||
|
"On: 1080x2340@90",
|
||||||
|
"HBM: 1080x2340@60",
|
||||||
|
"HBM: 1080x2340@90"};
|
||||||
|
|
||||||
|
p->addStateResidencyDataProvider(std::make_unique<DisplayStateResidencyDataProvider>("Display",
|
||||||
|
"/sys/class/backlight/panel0-backlight/state",
|
||||||
|
states));
|
||||||
|
|
||||||
|
// Add display energy consumer
|
||||||
|
/*
|
||||||
|
* TODO(b/167216667): Add correct display power model here. Must read from display rail
|
||||||
|
* and include proper coefficients for display states.
|
||||||
|
*/
|
||||||
|
p->addEnergyConsumer(PowerStatsEnergyConsumer::createMeterAndEntityConsumer(p,
|
||||||
|
EnergyConsumerType::DISPLAY, "display", {"PPVAR_VSYS_PWR_DISP"}, "Display",
|
||||||
|
{{"LP: 1440x3040@30", 1},
|
||||||
|
{"On: 1440x3040@60", 2},
|
||||||
|
{"On: 1440x3040@90", 3}}));
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
LOG(INFO) << "Pixel PowerStats HAL AIDL Service is starting.";
|
||||||
|
|
||||||
|
@ -34,6 +66,7 @@ int main() {
|
||||||
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
std::shared_ptr<PowerStats> p = ndk::SharedRefBase::make<PowerStats>();
|
||||||
|
|
||||||
addGs101CommonDataProviders(p);
|
addGs101CommonDataProviders(p);
|
||||||
|
addDisplay(p);
|
||||||
|
|
||||||
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
const std::string instance = std::string() + PowerStats::descriptor + "/default";
|
||||||
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
binder_status_t status = AServiceManager_addService(p->asBinder().get(), instance.c_str());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue