Merge "power: Add DPF and update imminent hints to AIDL"
diff --git a/power/aidl/android/hardware/power/Boost.aidl b/power/aidl/android/hardware/power/Boost.aidl
index 162a36a..c992fd3 100644
--- a/power/aidl/android/hardware/power/Boost.aidl
+++ b/power/aidl/android/hardware/power/Boost.aidl
@@ -29,6 +29,13 @@
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
* implement for power/perf optimizations.
*/
diff --git a/power/aidl/android/hardware/power/IPower.aidl b/power/aidl/android/hardware/power/IPower.aidl
index 9fb3fc0..2c4bd86 100644
--- a/power/aidl/android/hardware/power/IPower.aidl
+++ b/power/aidl/android/hardware/power/IPower.aidl
@@ -43,7 +43,7 @@
*/
boolean isModeSupported(in Mode type);
- /**
+ /**
* setBoost() indicates the device may need to boost some resources, as the
* 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
diff --git a/power/aidl/android/hardware/power/Mode.aidl b/power/aidl/android/hardware/power/Mode.aidl
index 1792add..ae113e3 100644
--- a/power/aidl/android/hardware/power/Mode.aidl
+++ b/power/aidl/android/hardware/power/Mode.aidl
@@ -39,6 +39,50 @@
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
* to provide minimum guarantee for performance for the amount of time the
* device can sustain it.
diff --git a/power/aidl/vts/VtsHalPowerTargetTest.cpp b/power/aidl/vts/VtsHalPowerTargetTest.cpp
index c0e0858..25a385e 100644
--- a/power/aidl/vts/VtsHalPowerTargetTest.cpp
+++ b/power/aidl/vts/VtsHalPowerTargetTest.cpp
@@ -16,6 +16,7 @@
#include <aidl/Gtest.h>
#include <aidl/Vintf.h>
+#include <android-base/properties.h>
#include <android/hardware/power/Boost.h>
#include <android/hardware/power/IPower.h>
#include <android/hardware/power/Mode.h>
@@ -27,6 +28,7 @@
using android::ProcessState;
using android::sp;
using android::String16;
+using android::base::GetUintProperty;
using android::binder::Status;
using android::hardware::power::Boost;
using android::hardware::power::IPower;
@@ -77,7 +79,7 @@
for (const auto& mode : kInvalidModes) {
bool supported;
ASSERT_TRUE(power->isModeSupported(mode, &supported).isOk());
- // Should return false for values outsides enum
+ // Should return false for values outside enum
ASSERT_FALSE(supported);
}
}
@@ -103,11 +105,27 @@
for (const auto& boost : kInvalidBoosts) {
bool supported;
ASSERT_TRUE(power->isBoostSupported(boost, &supported).isOk());
- // Should return false for values outsides enum
+ // Should return false for values outside enum
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,
testing::ValuesIn(android::getAidlHalInstanceNames(IPower::descriptor)),
android::PrintInstanceNameToString);