From cb6fee5502805a9b65bf5e905cc98f6989b389dd Mon Sep 17 00:00:00 2001 From: Peiyong Lin Date: Thu, 29 Sep 2022 21:15:15 +0000 Subject: [PATCH] Add power efficiency hint for power hint session. Background threads sometimes can be very CPU intensive but not critical from a user's perspective or senstive to a target deadline. Such workload often time consumes some extra power with no user benefit. This newly added power efficiency hint allows client to express threads within the power hint session should be applied with a power-effiecient-first scheduling strategy, and hence allows the power implementation to apply such strategy confidently. Bug: b/244216750 Test: atest VtsHalPowerTargetTest Change-Id: Iac10b090b208b37f0b7b18a34a45f2da8ecc419b --- .../current/android/hardware/power/SessionHint.aidl | 1 + power/aidl/android/hardware/power/SessionHint.aidl | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl index b19c77b525..9c1f381543 100644 --- a/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl +++ b/power/aidl/aidl_api/android.hardware.power/current/android/hardware/power/SessionHint.aidl @@ -38,4 +38,5 @@ enum SessionHint { CPU_LOAD_DOWN = 1, CPU_LOAD_RESET = 2, CPU_LOAD_RESUME = 3, + POWER_EFFICIENCY = 4, } diff --git a/power/aidl/android/hardware/power/SessionHint.aidl b/power/aidl/android/hardware/power/SessionHint.aidl index 6a95035d35..a172e12746 100644 --- a/power/aidl/android/hardware/power/SessionHint.aidl +++ b/power/aidl/android/hardware/power/SessionHint.aidl @@ -25,22 +25,31 @@ enum SessionHint { * This hint must be sent before reporting the actual duration to the session. */ CPU_LOAD_UP = 0, + /** * This hint indicates a decrease in CPU workload intensity. It means that * this hint session can reduce CPU resources and still meet the target duration. */ CPU_LOAD_DOWN = 1, - /* + + /** * This hint indicates an upcoming CPU workload that is completely changed and * unknown. It means that the hint session should reset CPU resources to a known * baseline to prepare for an arbitrary load, and must wake up if inactive. */ CPU_LOAD_RESET = 2, - /* + + /** * This hint indicates that the most recent CPU workload is resuming after a * period of inactivity. It means that the hint session should allocate similar * CPU resources to what was used previously, and must wake up if inactive. */ CPU_LOAD_RESUME = 3, + /** + * This hint indicates that this power hint session should be applied with a + * power-efficient-first scheduling strategy. This means the work of this + * power hint session is noncritical despite its CPU intensity. + */ + POWER_EFFICIENCY = 4, }