powerstats: merge two callback data providers to single
Bluetooth HAL and Display HWC will register callback with PowerStats HAL. Single PixelStateResidencyDataProvider supports multiple callback registerings. Bug: 335379104 Test: dumpsys android.hardware.power.stats.IPowerStats/default Change-Id: I24da89fbcd26e6472f047a504e2603186925cdc8 Signed-off-by: Darren Hsu <darrenhsu@google.com>
This commit is contained in:
parent
2df0d9e91a
commit
f31af5a3a4
2 changed files with 9 additions and 11 deletions
|
@ -636,12 +636,19 @@ void addTPU(std::shared_ptr<PowerStats> p) {
|
|||
* that live in user space. Entities are defined here and user space clients of this provider's
|
||||
* vendor service register callbacks to provide state residency data for their given pwoer entity.
|
||||
*/
|
||||
void addPixelStateResidencyDataProvider(std::shared_ptr<PowerStats> p) {
|
||||
void addPixelStateResidencyDataProvider(std::shared_ptr<PowerStats> p, std::string displayName) {
|
||||
|
||||
auto pixelSdp = std::make_unique<PixelStateResidencyDataProvider>();
|
||||
|
||||
// Bluetooth power stats are provided by BT HAL callback
|
||||
pixelSdp->addEntity("Bluetooth", {{0, "Idle"}, {1, "Active"}, {2, "Tx"}, {3, "Rx"}});
|
||||
|
||||
// Display VRR power stats are provided by HWC callback. If display entity
|
||||
// name is empty, the device doesn't support VRR power stats.
|
||||
if (!displayName.empty()) {
|
||||
pixelSdp->addEntity(displayName, {});
|
||||
}
|
||||
|
||||
pixelSdp->start();
|
||||
|
||||
p->addStateResidencyDataProvider(std::move(pixelSdp));
|
||||
|
@ -656,18 +663,10 @@ void addDisplayMrr(std::shared_ptr<PowerStats> p) {
|
|||
addDisplayMrrByEntity(p, "Display", "/sys/class/drm/card0/device/primary-panel/");
|
||||
}
|
||||
|
||||
void addDisplayVrr(std::shared_ptr<PowerStats> p, std::string name) {
|
||||
auto provider = std::make_unique<PixelStateResidencyDataProvider>();
|
||||
provider->addEntity(name, {});
|
||||
provider->start();
|
||||
p->addStateResidencyDataProvider(std::move(provider));
|
||||
}
|
||||
|
||||
void addZumaProCommonDataProviders(std::shared_ptr<PowerStats> p) {
|
||||
setEnergyMeter(p);
|
||||
|
||||
addAoC(p);
|
||||
addPixelStateResidencyDataProvider(p);
|
||||
addCPUclusters(p);
|
||||
addSoC(p);
|
||||
addGNSS(p);
|
||||
|
|
|
@ -25,14 +25,13 @@ void addCPUclusters(std::shared_ptr<PowerStats> p);
|
|||
void addDevfreq(std::shared_ptr<PowerStats> p);
|
||||
void addDisplayMrr(std::shared_ptr<PowerStats> p);
|
||||
void addDisplayMrrByEntity(std::shared_ptr<PowerStats> p, std::string name, std::string path);
|
||||
void addDisplayVrr(std::shared_ptr<PowerStats> p, std::string name);
|
||||
void addDvfsStats(std::shared_ptr<PowerStats> p);
|
||||
void addGNSS(std::shared_ptr<PowerStats> p);
|
||||
void addGPU(std::shared_ptr<PowerStats> p);
|
||||
void addMobileRadio(std::shared_ptr<PowerStats> p);
|
||||
void addNFC(std::shared_ptr<PowerStats> p);
|
||||
void addPCIe(std::shared_ptr<PowerStats> p);
|
||||
void addPixelStateResidencyDataProvider(std::shared_ptr<PowerStats> p);
|
||||
void addPixelStateResidencyDataProvider(std::shared_ptr<PowerStats> p, std::string displayName);
|
||||
void addPowerDomains(std::shared_ptr<PowerStats> p);
|
||||
void addSoC(std::shared_ptr<PowerStats> p);
|
||||
void addTPU(std::shared_ptr<PowerStats> p);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue