mirror of
https://github.com/Evolution-X/hardware_interfaces
synced 2026-02-01 16:50:18 +00:00
Merge "power: Add DPF and update imminent hints to AIDL"
This commit is contained in:
@@ -28,6 +28,13 @@ enum Boost {
|
|||||||
*/
|
*/
|
||||||
INTERACTION,
|
INTERACTION,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This boost indicates that the framework is likely to provide a new
|
||||||
|
* display frame soon. This implies that the device should ensure that the
|
||||||
|
* display processing path is powered up and ready to receive that update.
|
||||||
|
*/
|
||||||
|
DISPLAY_UPDATE_IMMINENT,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Below hints are currently not sent in Android framework but OEM might choose to
|
* Below hints are currently not sent in Android framework but OEM might choose to
|
||||||
* implement for power/perf optimizations.
|
* implement for power/perf optimizations.
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ interface IPower {
|
|||||||
*/
|
*/
|
||||||
boolean isModeSupported(in Mode type);
|
boolean isModeSupported(in Mode type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* setBoost() indicates the device may need to boost some resources, as the
|
* setBoost() indicates the device may need to boost some resources, as the
|
||||||
* the load is likely to increase before the kernel governors can react.
|
* the load is likely to increase before the kernel governors can react.
|
||||||
* Depending on the boost, it may be appropriate to raise the frequencies of
|
* Depending on the boost, it may be appropriate to raise the frequencies of
|
||||||
|
|||||||
@@ -38,6 +38,50 @@ enum Mode {
|
|||||||
*/
|
*/
|
||||||
SUSTAINED_PERFORMANCE,
|
SUSTAINED_PERFORMANCE,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the device to a fixed performance level which can be sustained under
|
||||||
|
* normal indoor conditions for at least 10 minutes.
|
||||||
|
*
|
||||||
|
* This is similar to sustained performance mode, except that whereas
|
||||||
|
* sustained performance mode puts an upper bound on performance in the
|
||||||
|
* interest of long-term stability, fixed performance mode puts both upper
|
||||||
|
* and lower bounds on performance such that any workload run while in a
|
||||||
|
* fixed performance mode should complete in a repeatable amount of time
|
||||||
|
* (except if the device is under thermal throttling).
|
||||||
|
*
|
||||||
|
* This mode is not intended for general purpose use, but rather to enable
|
||||||
|
* games and other performance-sensitive applications to reduce the number
|
||||||
|
* of variables during profiling and performance debugging. As such, while
|
||||||
|
* it is valid to set the device to minimum clocks for all subsystems in
|
||||||
|
* this mode, it is preferable to attempt to make the relative performance
|
||||||
|
* of the CPU, GPU, and other subsystems match typical usage, even if the
|
||||||
|
* frequencies have to be reduced to provide sustainability.
|
||||||
|
*
|
||||||
|
* To calibrate this mode, follow these steps:
|
||||||
|
*
|
||||||
|
* 1) Build and push the HWUI macrobench as described in
|
||||||
|
* //frameworks/base/libs/hwui/tests/macrobench/how_to_run.txt
|
||||||
|
* 2) Run the macrobench as follows:
|
||||||
|
* while true; do \
|
||||||
|
* adb shell /data/benchmarktest/hwuimacro/hwuimacro shadowgrid2 -c 200 -r 10; \
|
||||||
|
* done
|
||||||
|
* 3) Determine a fixed set of device clocks such that the loop in (2) can
|
||||||
|
* run for at least 10 minutes, starting from an idle device on a desk
|
||||||
|
* at room temperature (roughly 22 Celsius), without hitting thermal
|
||||||
|
* throttling.
|
||||||
|
* 4) After setting those clocks, set the system property
|
||||||
|
* ro.power.fixed_performance_scale_factor to a value N, where N is the
|
||||||
|
* number of times the loop from (2) runs during the 10 minute test
|
||||||
|
* cycle. It is expected that in FIXED_PERFORMANCE mode, unless there is
|
||||||
|
* thermal throttling, the loop will run N to N+1 times (inclusive).
|
||||||
|
*
|
||||||
|
* After calibrating this, while in FIXED_PERFORMANCE mode, the macrobench
|
||||||
|
* results obtained while running the loop in (2) should be consistent both
|
||||||
|
* within a given run and from the first run in the 10 minute window through
|
||||||
|
* the last run in the window.
|
||||||
|
*/
|
||||||
|
FIXED_PERFORMANCE,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This mode indicates VR Mode is activated or not. VR mode is intended
|
* This mode indicates VR Mode is activated or not. VR mode is intended
|
||||||
* to provide minimum guarantee for performance for the amount of time the
|
* to provide minimum guarantee for performance for the amount of time the
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <aidl/Gtest.h>
|
#include <aidl/Gtest.h>
|
||||||
#include <aidl/Vintf.h>
|
#include <aidl/Vintf.h>
|
||||||
|
|
||||||
|
#include <android-base/properties.h>
|
||||||
#include <android/hardware/power/Boost.h>
|
#include <android/hardware/power/Boost.h>
|
||||||
#include <android/hardware/power/IPower.h>
|
#include <android/hardware/power/IPower.h>
|
||||||
#include <android/hardware/power/Mode.h>
|
#include <android/hardware/power/Mode.h>
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
using android::ProcessState;
|
using android::ProcessState;
|
||||||
using android::sp;
|
using android::sp;
|
||||||
using android::String16;
|
using android::String16;
|
||||||
|
using android::base::GetUintProperty;
|
||||||
using android::binder::Status;
|
using android::binder::Status;
|
||||||
using android::hardware::power::Boost;
|
using android::hardware::power::Boost;
|
||||||
using android::hardware::power::IPower;
|
using android::hardware::power::IPower;
|
||||||
@@ -77,7 +79,7 @@ TEST_P(PowerAidl, isModeSupported) {
|
|||||||
for (const auto& mode : kInvalidModes) {
|
for (const auto& mode : kInvalidModes) {
|
||||||
bool supported;
|
bool supported;
|
||||||
ASSERT_TRUE(power->isModeSupported(mode, &supported).isOk());
|
ASSERT_TRUE(power->isModeSupported(mode, &supported).isOk());
|
||||||
// Should return false for values outsides enum
|
// Should return false for values outside enum
|
||||||
ASSERT_FALSE(supported);
|
ASSERT_FALSE(supported);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -103,11 +105,27 @@ TEST_P(PowerAidl, isBoostSupported) {
|
|||||||
for (const auto& boost : kInvalidBoosts) {
|
for (const auto& boost : kInvalidBoosts) {
|
||||||
bool supported;
|
bool supported;
|
||||||
ASSERT_TRUE(power->isBoostSupported(boost, &supported).isOk());
|
ASSERT_TRUE(power->isBoostSupported(boost, &supported).isOk());
|
||||||
// Should return false for values outsides enum
|
// Should return false for values outside enum
|
||||||
ASSERT_FALSE(supported);
|
ASSERT_FALSE(supported);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXED_PERFORMANCE mode is required for all devices which ship on Android 11
|
||||||
|
// or later
|
||||||
|
TEST_P(PowerAidl, hasFixedPerformance) {
|
||||||
|
auto apiLevel = GetUintProperty<uint64_t>("ro.product.first_api_level", 0);
|
||||||
|
if (apiLevel == 0) {
|
||||||
|
apiLevel = GetUintProperty<uint64_t>("ro.build.version.sdk", 0);
|
||||||
|
}
|
||||||
|
ASSERT_NE(apiLevel, 0);
|
||||||
|
|
||||||
|
if (apiLevel >= 30) {
|
||||||
|
bool supported;
|
||||||
|
ASSERT_TRUE(power->isModeSupported(Mode::FIXED_PERFORMANCE, &supported).isOk());
|
||||||
|
ASSERT_TRUE(supported);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
INSTANTIATE_TEST_SUITE_P(Power, PowerAidl,
|
INSTANTIATE_TEST_SUITE_P(Power, PowerAidl,
|
||||||
testing::ValuesIn(android::getAidlHalInstanceNames(IPower::descriptor)),
|
testing::ValuesIn(android::getAidlHalInstanceNames(IPower::descriptor)),
|
||||||
android::PrintInstanceNameToString);
|
android::PrintInstanceNameToString);
|
||||||
|
|||||||
Reference in New Issue
Block a user