diff options
| author | 2024-12-03 17:18:33 -0800 | |
|---|---|---|
| committer | 2024-12-04 12:07:46 -0800 | |
| commit | fd2b786912b72f53f52a39880a4c1cad74ff2841 (patch) | |
| tree | c8d0b8d062224a02a07307fcd941bd1ddd529052 | |
| parent | 8a19587f2832b1c852d2a8740e5a2b85a6a2fd68 (diff) | |
Add CPU/GPU_LOAD_SPIKE hints for one-off expensive workloads
Currently there is ambiguity between single-frame expensive ops
(eg: shader compilation) and longer-duration expensive ops (eg:
SF client compositon). This load hint aims to resolve this by
explicitly annotating one-time expensive workloads so they can
be given unique boost and hysteresis expectations.
For example, a load_spike aware tracker might want to ignore
the timing that comes from a LOAD_SPIKE-marked frame, as it is
known to not be representative of the overall workload.
Flag: EXEMPT NDK
Test: atest PerformanceHintNativeTestCases
Test: atest PerformanceHintManagerTest
Bug: 367803904
Change-Id: I22458f0d8f0819499f3463aa36e8bb7eb7af15be
| -rw-r--r-- | include/android/performance_hint.h | 25 | ||||
| -rw-r--r-- | include/private/performance_hint_private.h | 14 |
2 files changed, 39 insertions, 0 deletions
diff --git a/include/android/performance_hint.h b/include/android/performance_hint.h index ca86c2730f..2b4a5f5f53 100644 --- a/include/android/performance_hint.h +++ b/include/android/performance_hint.h @@ -359,6 +359,31 @@ int APerformanceHint_notifyWorkloadReset( bool cpu, bool gpu, const char* _Nonnull debugName) __INTRODUCED_IN(36); /** + * Informs the framework of an upcoming one-off expensive frame for a graphics pipeline + * bound to this session. This frame will be treated as not representative of the workload as a + * whole, and it will be discarded the purposes of load tracking. The user can specify + * whether the workload spike is expected to be on the CPU, GPU, or both. + * + * Sending hints for both CPU and GPU counts as two separate hints for the purposes of the + * rate limiter. + * + * @param cpu Indicates if the workload spike is expected to affect the CPU. + * @param gpu Indicates if the workload spike is expected to affect the GPU. + * @param debugName A required string used to identify this specific hint during + * tracing. This debug string will only be held for the duration of the + * method, and can be safely discarded after. + * + * @return 0 on success. + * EINVAL if no hints were requested. + * EBUSY if the hint was rate limited. + * EPIPE if communication with the system service has failed. + * ENOTSUP if the hint is not supported. + */ +int APerformanceHint_notifyWorkloadSpike( + APerformanceHintSession* _Nonnull session, + bool cpu, bool gpu, const char* _Nonnull debugName) __INTRODUCED_IN(36); + +/** * Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow} * instances managed by this session. * diff --git a/include/private/performance_hint_private.h b/include/private/performance_hint_private.h index f150fb1f3e..e3f98badbe 100644 --- a/include/private/performance_hint_private.h +++ b/include/private/performance_hint_private.h @@ -74,6 +74,20 @@ enum SessionHint: int32_t { * baseline to prepare for an arbitrary load, and must wake up if inactive. */ GPU_LOAD_RESET = 7, + + /** + * This hint indicates an upcoming CPU workload that is abnormally large and + * not representative of the workload. This should be used for rare, one-time + * operations and should be ignored by any load tracking or session hysteresis. + */ + CPU_LOAD_SPIKE = 8, + + /** + * This hint indicates an upcoming GPU workload that is abnormally large and + * not representative of the workload. This should be used for rare, one-time + * operations and should be ignored by any load tracking or session hysteresis. + */ + GPU_LOAD_SPIKE = 9, }; // Allows access to PowerHAL's SessionTags without needing to import its AIDL |