summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/android/performance_hint.h315
-rw-r--r--include/input/AccelerationCurve.h11
-rw-r--r--include/private/performance_hint_private.h6
3 files changed, 219 insertions, 113 deletions
diff --git a/include/android/performance_hint.h b/include/android/performance_hint.h
index 9ea6549e8a..52dbb61ac5 100644
--- a/include/android/performance_hint.h
+++ b/include/android/performance_hint.h
@@ -29,7 +29,7 @@
* workloads are taking. The framework will then compare the actual durations to the target
* duration and attempt to help the client reach a steady state under the target.
*
- * Unlike reportActualWorkDuration, the "notify..." hints are intended to be sent in
+ * Unlike reportActualWorkDuration, the "notifyWorkload..." hints are intended to be sent in
* advance of large changes in the workload, to prevent them from going over the target
* when there is a sudden, unforseen change. Their effects are intended to last for only
* one cycle, after which reportActualWorkDuration will have a chance to catch up.
@@ -71,6 +71,10 @@
#include <stdint.h>
#include <unistd.h>
+#if !defined(__DEPRECATED_IN)
+#define __DEPRECATED_IN(__api_level, ...) __attribute__((__deprecated__))
+#endif
+
__BEGIN_DECLS
struct APerformanceHintManager;
@@ -116,13 +120,13 @@ typedef struct APerformanceHintManager APerformanceHintManager;
* An opaque type representing a handle to a performance hint session creation configuration.
* It is consumed by {@link APerformanceHint_createSessionUsingConfig}.
*
- * A session creation config encapsulates the required information for a session.
- * Additionally, the caller can set various settings for the session,
- * to be passed during creation, streamlining the session setup process.
- *
- * The caller may reuse this object and modify the settings in it
- * to create additional sessions.
+ * A session creation config encapsulates the required information for creating a session. The only
+ * mandatory parameter is the set of TIDs, set using {@link ASessionCreationConfig_setTids}. Only
+ * parameters relevant to the session need to be set, and any unspecified functionality will be
+ * treated as unused on the session. Configurations without a valid set of TIDs, or which try to
+ * enable automatic timing without the graphics pipeline mode, are considered invalid.
*
+ * The caller may reuse this object and modify the settings in it to create additional sessions.
*/
typedef struct ASessionCreationConfig ASessionCreationConfig;
@@ -181,27 +185,43 @@ APerformanceHintSession* _Nullable APerformanceHint_createSession(
int64_t initialTargetWorkDurationNanos) __INTRODUCED_IN(__ANDROID_API_T__);
/**
- * Creates a session for the given set of threads that are graphics pipeline threads
- * and set their initial target work duration.
+ * Creates a session using arguments from a corresponding {@link ASessionCreationConfig}.
+ *
+ * Note: when using graphics pipeline mode, using too many cumulative graphics pipeline threads is
+ * not a failure and will still create a session, but it will cause all graphics pipeline sessions
+ * to have undefined behavior and the method will return EBUSY.
*
* @param manager The performance hint manager instance.
* @param config The configuration struct containing required information
* to create a session.
- * @return APerformanceHintSession pointer on success, nullptr on failure.
+ * @param sessionOut A client-provided pointer, which will be set to the new APerformanceHintSession
+ * on success or EBUSY, and to nullptr on failure.
+ *
+ * @return 0 on success.
+ * EINVAL if the creation config is in an invalid state.
+ * EPIPE if communication failed.
+ * ENOTSUP if hint sessions are not supported, or if auto timing is enabled but unsupported.
+ * EBUSY if too many graphics pipeline threads are passed.
*/
-APerformanceHintSession* _Nullable APerformanceHint_createSessionUsingConfig(
+int APerformanceHint_createSessionUsingConfig(
APerformanceHintManager* _Nonnull manager,
- ASessionCreationConfig* _Nonnull config)
- __INTRODUCED_IN(36);
+ ASessionCreationConfig* _Nonnull config,
+ APerformanceHintSession * _Nullable * _Nonnull sessionOut) __INTRODUCED_IN(36);
/**
* Get preferred update rate information for this device.
*
+ * @deprecated Client side rate limiting is not necessary, rate limiting is handled in the
+ * framework. If you were using this to check for hint session support, please use
+ * {@link APerformanceHint_isFeatureSupported} instead.
+ *
* @param manager The performance hint manager instance.
* @return the preferred update rate supported by device software.
*/
int64_t APerformanceHint_getPreferredUpdateRateNanos(
- APerformanceHintManager* _Nonnull manager) __INTRODUCED_IN(__ANDROID_API_T__);
+ APerformanceHintManager* _Nonnull manager)
+ __INTRODUCED_IN(__ANDROID_API_T__) __DEPRECATED_IN(36, "Client-side rate limiting is not"
+ " necessary, use APerformanceHint_isFeatureSupported for support checking.");
/**
* Get maximum number of graphics pipieline threads per-app for this device.
@@ -216,9 +236,11 @@ int64_t APerformanceHint_getPreferredUpdateRateNanos(
* Updates this session's target duration for each cycle of work.
*
* @param session The performance hint session instance to update.
- * @param targetDurationNanos The new desired duration in nanoseconds. This must be positive.
+ * @param targetDurationNanos The new desired duration in nanoseconds. This must be positive for the
+ * session to report work durations, and may be zero to disable this functionality.
+ *
* @return 0 on success.
- * EINVAL if targetDurationNanos is not positive.
+ * EINVAL if targetDurationNanos is less than zero.
* EPIPE if communication with the system service has failed.
*/
int APerformanceHint_updateTargetWorkDuration(
@@ -235,7 +257,7 @@ int APerformanceHint_updateTargetWorkDuration(
* @param actualDurationNanos The duration of time the thread group took to complete its last
* task in nanoseconds. This must be positive.
* @return 0 on success.
- * EINVAL if actualDurationNanos is not positive.
+ * EINVAL if actualDurationNanos is not positive or the target it not positive.
* EPIPE if communication with the system service has failed.
*/
int APerformanceHint_reportActualWorkDuration(
@@ -258,15 +280,20 @@ void APerformanceHint_closeSession(
* Set a list of threads to the performance hint session. This operation will replace
* the current list of threads with the given list of threads.
*
+ * Note: when using a session with the graphics pipeline mode enabled, using too many cumulative
+ * graphics pipeline threads is not a failure, but it will cause all graphics pipeline sessions to
+ * have undefined behavior and the method will return EBUSY.
+ *
* @param session The performance hint session instance to update.
* @param threadIds The list of threads to be associated with this session. They must be part of
* this app's thread group.
* @param size The size of the list of threadIds.
* @return 0 on success.
* EINVAL if the list of thread ids is empty or if any of the thread ids are not part of
- the thread group.
+ * the thread group.
* EPIPE if communication with the system service has failed.
* EPERM if any thread id doesn't belong to the application.
+ * EBUSY if too many graphics pipeline threads were passed.
*/
int APerformanceHint_setThreads(
APerformanceHintSession* _Nonnull session,
@@ -311,89 +338,102 @@ int APerformanceHint_reportActualWorkDuration2(
AWorkDuration* _Nonnull workDuration) __INTRODUCED_IN(__ANDROID_API_V__);
/**
- * Informs the framework of an upcoming increase in the workload of a graphics pipeline
- * bound to this session. The user can specify whether the increase is expected to be
- * on the CPU, GPU, or both.
+ * Informs the framework of an upcoming increase in the workload of this session.
+ * The user can specify whether the increase 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.
+ * These hints should be sent shortly before the start of the cycle where the workload is going to
+ * change, or as early as possible during that cycle for maximum effect. Hints sent towards the end
+ * of the cycle may be interpreted as applying to the next cycle. Any unsupported hints will be
+ * silently dropped, to avoid the need for excessive support checking each time they are sent, and
+ * sending a hint for both CPU and GPU will count as two separate hints for the rate limiter. These
+ * hints should not be sent repeatedly for an ongoing expensive workload, as workload time reporting
+ * is intended to handle this.
*
+ * @param session The {@link APerformanceHintSession} instance to send a hint for.
* @param cpu Indicates if the workload increase is expected to affect the CPU.
* @param gpu Indicates if the workload increase 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.
+ * @param identifier A required string used to distinguish this specific hint, using utf-8 encoding.
+ * This string will only be held for the duration of the method, and can be 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_notifyWorkloadIncrease(
APerformanceHintSession* _Nonnull session,
- bool cpu, bool gpu, const char* _Nonnull debugName) __INTRODUCED_IN(36);
+ bool cpu, bool gpu, const char* _Nonnull identifier) __INTRODUCED_IN(36);
/**
- * Informs the framework of an upcoming reset in the workload of a graphics pipeline
- * bound to this session, or the imminent start of a new workload. The user can specify
- * whether the reset is expected to affect the CPU, GPU, or both.
+ * Informs the framework that the workload associated with this session is about to start, or that
+ * it is about to completely change, and that the system should discard any assumptions about its
+ * characteristics inferred from previous activity. The user can specify whether the reset is
+ * expected to affect the CPU, GPU, or both.
*
- * Sending hints for both CPU and GPU counts as two separate hints for the purposes of the
- * this load tracking.
+ * These hints should be sent shortly before the start of the cycle where the workload is going to
+ * change, or as early as possible during that cycle for maximum effect. Hints sent towards the end
+ * of the cycle may be interpreted as applying to the next cycle. Any unsupported hints will be
+ * silently dropped, to avoid the need for excessive support checking each time they are sent, and
+ * sending a hint for both CPU and GPU will count as two separate hints for the rate limiter. These
+ * hints should not be sent repeatedly for an ongoing expensive workload, as workload time reporting
+ * is intended to handle this.
*
+ * @param session The {@link APerformanceHintSession} instance to send a hint for.
* @param cpu Indicates if the workload reset is expected to affect the CPU.
* @param gpu Indicates if the workload reset 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.
+ * @param identifier A required string used to distinguish this specific hint, using utf-8 encoding.
+ * This string will only be held for the duration of the method, and can be 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_notifyWorkloadReset(
APerformanceHintSession* _Nonnull session,
- bool cpu, bool gpu, const char* _Nonnull debugName) __INTRODUCED_IN(36);
+ bool cpu, bool gpu, const char* _Nonnull identifier) __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.
+ * Informs the framework of an upcoming one-off expensive workload cycle for a given session.
+ * This cycle 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.
+ * These hints should be sent shortly before the start of the cycle where the workload is going to
+ * change, or as early as possible during that cycle for maximum effect. Hints sent towards the end
+ * of the cycle may be interpreted as applying to the next cycle. Any unsupported hints will be
+ * silently dropped, to avoid the need for excessive support checking each time they are sent, and
+ * sending a hint for both CPU and GPU will count as two separate hints for the rate limiter. These
+ * hints should not be sent repeatedly for an ongoing expensive workload, as workload time reporting
+ * is intended to handle this.
*
+ * @param session The {@link APerformanceHintSession} instance to send a hint for.
* @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.
+ * @param identifier A required string used to distinguish this specific hint, using utf-8 encoding.
+ * This string will only be held for the duration of the method, and can be 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);
+ bool cpu, bool gpu, const char* _Nonnull identifier) __INTRODUCED_IN(36);
/**
* Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow}
- * instances managed by this session.
+ * instances managed by this session. Any previously associated objects that are not passed
+ * in again lose their association. Invalid or dead instances are ignored, and passing both
+ * lists as null drops all current associations.
*
* This method is primarily intended for sessions that manage the timing of an entire
- * graphics pipeline end-to-end, such as those using the
+ * graphics pipeline end-to-end for frame pacing, such as those using the
* {@link ASessionCreationConfig_setGraphicsPipeline} API. However, any session directly
* or indirectly managing a graphics pipeline should still associate themselves with
* directly relevant ASurfaceControl or ANativeWindow instances for better optimization.
+ * Additionally, if the surface associated with a session changes, this method should be called
+ * again to re-create the association.
*
- * To see any benefit from this method, the client must make sure they are updating the framerate
+ * To see any benefit from this method, the client must make sure they are updating the frame rate
* of attached surfaces using methods such as {@link ANativeWindow_setFrameRate}, or by updating
* any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}.
*
@@ -407,16 +447,77 @@ int APerformanceHint_notifyWorkloadSpike(
*
* @return 0 on success.
* EPIPE if communication has failed.
- * ENOTSUP if unsupported.
- * EINVAL if invalid or empty arguments passed.
+ * ENOTSUP if this is not supported on the device.
*/
int APerformanceHint_setNativeSurfaces(APerformanceHintSession* _Nonnull session,
- ANativeWindow* _Nonnull* _Nullable nativeWindows, int nativeWindowsSize,
- ASurfaceControl* _Nonnull* _Nullable surfaceControls, int surfaceControlsSize)
+ ANativeWindow* _Nonnull* _Nullable nativeWindows, size_t nativeWindowsSize,
+ ASurfaceControl* _Nonnull* _Nullable surfaceControls, size_t surfaceControlsSize)
__INTRODUCED_IN(36);
/**
+ * This enum represents different aspects of performance hint functionality. These can be passed
+ * to {@link APerformanceHint_isFeatureSupported} to determine whether the device exposes support
+ * for that feature.
+ *
+ * Some of these features will not expose failure to the client if used when unsupported, to prevent
+ * the client from needing to worry about handling different logic for each possible support
+ * configuration. The exception to this is features with important user-facing side effects, such as
+ * {@link APERF_HINT_AUTO_CPU} and {@link APERF_HINT_AUTO_GPU} modes which expect the client not to
+ * report durations while they are active.
+ */
+typedef enum APerformanceHintFeature : int32_t {
+ /**
+ * This value represents all APerformanceHintSession functionality. Using the Performance Hint
+ * API at all if this is not enabled will likely result in either
+ * {@link APerformanceHintManager} or {@link APerformanceHintSession} failing to create, or the
+ * session having little to no benefit even if creation succeeds.
+ */
+ APERF_HINT_SESSIONS,
+
+ /**
+ * This value represents the power efficiency mode, as exposed by
+ * {@link ASessionCreationConfig_setPreferPowerEfficiency} and
+ * {@link APerformanceHint_setPreferPowerEfficiency}.
+ */
+ APERF_HINT_POWER_EFFICIENCY,
+
+ /**
+ * This value the ability for sessions to bind to surfaces using
+ * {@link APerformanceHint_setNativeSurfaces} or
+ * {@link ASessionCreationConfig_setNativeSurfaces}
+ */
+ APERF_HINT_SURFACE_BINDING,
+
+ /**
+ * This value represents the "graphics pipeline" mode, as exposed by
+ * {@link ASessionCreationConfig_setGraphicsPipeline}.
+ */
+ APERF_HINT_GRAPHICS_PIPELINE,
+
+ /**
+ * This value represents the automatic CPU timing feature, as exposed by
+ * {@link ASessionCreationConfig_setUseAutoTiming}.
+ */
+ APERF_HINT_AUTO_CPU,
+
+ /**
+ * This value represents the automatic GPU timing feature, as exposed by
+ * {@link ASessionCreationConfig_setUseAutoTiming}.
+ */
+ APERF_HINT_AUTO_GPU,
+} APerformanceHintFeature;
+
+/**
+ * Checks whether the device exposes support for a specific feature.
+ *
+ * @param feature The specific feature enum to check.
+ *
+ * @return false if unsupported, true if supported.
+ */
+bool APerformanceHint_isFeatureSupported(APerformanceHintFeature feature) __INTRODUCED_IN(36);
+
+/**
* Creates a new AWorkDuration. When the client finishes using {@link AWorkDuration}, it should
* call {@link AWorkDuration_release()} to destroy {@link AWorkDuration} and release all resources
* associated with it.
@@ -507,7 +608,6 @@ APerformanceHintSession* _Nonnull APerformanceHint_borrowSessionFromJava(
ASessionCreationConfig* _Nonnull ASessionCreationConfig_create()
__INTRODUCED_IN(36);
-
/**
* Destroys a {@link ASessionCreationConfig} and frees all
* resources associated with it.
@@ -526,11 +626,8 @@ void ASessionCreationConfig_release(
* @param tids The list of tids to be associated with this session. They must be part of
* this process' thread group.
* @param size The size of the list of tids.
- *
- * @return 0 on success.
- * EINVAL if invalid array pointer or the value of size
*/
-int ASessionCreationConfig_setTids(
+void ASessionCreationConfig_setTids(
ASessionCreationConfig* _Nonnull config,
const pid_t* _Nonnull tids, size_t size) __INTRODUCED_IN(36);
@@ -539,15 +636,11 @@ int ASessionCreationConfig_setTids(
*
* @param config The {@link ASessionCreationConfig}
* created by calling {@link ASessionCreationConfig_create()}.
- * @param targetWorkDurationNanos The parameter to specify a target duration
- * in nanoseconds for the new session; this value must be positive to use
- * the work duration API.
- *
- * @return 0 on success.
- * ENOTSUP if unsupported
- * EINVAL if invalid value
+ * @param targetWorkDurationNanos The parameter to specify a target duration in nanoseconds for the
+ * new session; this value must be positive to use the work duration API, and may be ignored
+ * otherwise or set to zero. Negative values are invalid.
*/
-int ASessionCreationConfig_setTargetWorkDurationNanos(
+void ASessionCreationConfig_setTargetWorkDurationNanos(
ASessionCreationConfig* _Nonnull config,
int64_t targetWorkDurationNanos) __INTRODUCED_IN(36);
@@ -559,12 +652,8 @@ int ASessionCreationConfig_setTargetWorkDurationNanos(
* @param config The {@link ASessionCreationConfig}
* created by calling {@link ASessionCreationConfig_create()}.
* @param enabled Whether power efficiency mode will be enabled.
- *
- * @return 0 on success.
- * ENOTSUP if unsupported
- * EINVAL if invalid pointer to creation config
*/
-int ASessionCreationConfig_setPreferPowerEfficiency(
+void ASessionCreationConfig_setPreferPowerEfficiency(
ASessionCreationConfig* _Nonnull config, bool enabled) __INTRODUCED_IN(36);
/**
@@ -574,24 +663,31 @@ int ASessionCreationConfig_setPreferPowerEfficiency(
* buffer is fully finished drawing.
*
* It should include any threads on the critical path of that pipeline,
- * up to a limit accessible from {@link getMaxGraphicsPipelineThreadsCount()}.
+ * up to a limit accessible from {@link APerformanceHint_getMaxGraphicsPipelineThreadsCount()}.
*
* @param config The {@link ASessionCreationConfig}
* created by calling {@link ASessionCreationConfig_create()}.
* @param enabled Whether this session manages a graphics pipeline's critical path.
- *
- * @return 0 on success.
- * ENOTSUP if unsupported
- * EINVAL if invalid pointer to creation config or maximum threads for graphics
- pipeline is reached.
*/
-int ASessionCreationConfig_setGraphicsPipeline(
+void ASessionCreationConfig_setGraphicsPipeline(
ASessionCreationConfig* _Nonnull config, bool enabled) __INTRODUCED_IN(36);
/**
- * Associates a session with any {@link ASurfaceControl} or {@link ANativeWindow}
- * instances managed by this session. See {@link APerformanceHint_setNativeSurfaces}
- * for more details.
+ * Associates the created session with any {@link ASurfaceControl} or {@link ANativeWindow}
+ * instances it will be managing. Invalid or dead instances are ignored.
+ *
+ * This method is primarily intended for sessions that manage the timing of an entire
+ * graphics pipeline end-to-end for frame pacing, such as those using the
+ * {@link ASessionCreationConfig_setGraphicsPipeline} API. However, any session directly
+ * or indirectly managing a graphics pipeline should still associate themselves with
+ * directly relevant ASurfaceControl or ANativeWindow instances for better optimization.
+ * Additionally, if the surface associated with a session changes, this method should be called
+ * again to re-create the association.
+ *
+ * To see any benefit from this method, the client must make sure they are updating the frame rate
+ * of attached surfaces using methods such as {@link ANativeWindow_setFrameRate}, or by updating
+ * any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}.
+ *
*
* @param config The {@link ASessionCreationConfig}
* created by calling {@link ASessionCreationConfig_create()}.
@@ -601,49 +697,46 @@ int ASessionCreationConfig_setGraphicsPipeline(
* @param surfaceControls A pointer to a list of ASurfaceControls associated with this session.
* nullptr can be passed to indicate there are no associated ASurfaceControls.
* @param surfaceControlsSize The number of ASurfaceControls in the list.
- *
- * @return 0 on success.
- * ENOTSUP if unsupported.
- * EINVAL if invalid or empty arguments passed.
*/
-int ASessionCreationConfig_setNativeSurfaces(
+void ASessionCreationConfig_setNativeSurfaces(
ASessionCreationConfig* _Nonnull config,
- ANativeWindow* _Nonnull* _Nullable nativeWindows, int nativeWindowsSize,
- ASurfaceControl* _Nonnull* _Nullable surfaceControls, int surfaceControlsSize)
+ ANativeWindow* _Nonnull* _Nullable nativeWindows, size_t nativeWindowsSize,
+ ASurfaceControl* _Nonnull* _Nullable surfaceControls, size_t surfaceControlsSize)
__INTRODUCED_IN(36);
/**
* Enable automatic timing mode for sessions using the GRAPHICS_PIPELINE API with an attached
- * surface. In this mode, sessions do not need to report actual durations and only need
- * to keep their thread list up-to-date, set a native surface, call
- * {@link ASessionCreationConfig_setGraphicsPipeline()} to signal that the session is in
- * "graphics pipeline" mode, and then set whether automatic timing is desired for the
- * CPU, GPU, or both, using this method.
+ * surface. In this mode, sessions do not need to report timing data for the CPU, GPU, or both
+ * depending on the configuration. To use this mode, sessions should set a native surface
+ * using {@ASessionCreationConfig_setNativeSurfaces}, enable graphics pipeline mode with
+ * {@link ASessionCreationConfig_setGraphicsPipeline()}, and then call this method to set whether
+ * automatic timing is desired for the CPU, GPU, or both. Trying to enable this without also
+ * enabling the graphics pipeline mode will cause session creation to fail.
*
* It is still be beneficial to set an accurate target time, as this may help determine
* timing information for some workloads where there is less information available from
* the framework, such as games. Additionally, reported CPU durations will be ignored
* while automatic CPU timing is enabled, and similarly GPU durations will be ignored
* when automatic GPU timing is enabled. When both are enabled, the entire
- * reportActualWorkDuration call will be ignored, and the session will be managed
- * completely automatically.
+ * {@link APerformanceHint_reportActualWorkDuration} call will be ignored, and the session will be
+ * managed completely automatically.
*
- * This mode will not work unless the client makes sure they are updating the framerate
- * of attached surfaces with methods such as {@link ANativeWindow_setFrameRate}, or updating
- * any associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate}.
+ * If the client is manually controlling their frame rate for those surfaces, then they must make
+ * sure they are updating the frame rate with {@link ANativeWindow_setFrameRate}, or updating any
+ * associated ASurfaceControls with transactions that have {ASurfaceTransaction_setFrameRate} set.
+ *
+ * The user of this API should ensure this feature is supported by checking
+ * {@link APERF_HINT_AUTO_CPU} and {@link APERF_HINT_AUTO_GPU} with
+ * {@link APerformanceHint_isFeatureSupported} and falling back to manual timing if it is not.
+ * Trying to use automatic timing when it is unsupported will cause session creation to fail.
*
* @param config The {@link ASessionCreationConfig}
* created by calling {@link ASessionCreationConfig_create()}.
* @param cpu Whether to enable automatic timing for the CPU for this session.
* @param gpu Whether to enable automatic timing for the GPU for this session.
- *
- * @return 0 on success.
- * ENOTSUP if unsupported.
*/
-int ASessionCreationConfig_setUseAutoTiming(
- ASessionCreationConfig* _Nonnull config,
- bool cpu, bool gpu)
- __INTRODUCED_IN(36);
+void ASessionCreationConfig_setUseAutoTiming(
+ ASessionCreationConfig* _Nonnull config, bool cpu, bool gpu) __INTRODUCED_IN(36);
__END_DECLS
diff --git a/include/input/AccelerationCurve.h b/include/input/AccelerationCurve.h
index 0cf648a2f7..8a4a5d429b 100644
--- a/include/input/AccelerationCurve.h
+++ b/include/input/AccelerationCurve.h
@@ -46,4 +46,15 @@ struct AccelerationCurveSegment {
std::vector<AccelerationCurveSegment> createAccelerationCurveForPointerSensitivity(
int32_t sensitivity);
+/*
+ * Creates a flat acceleration curve for disabling pointer acceleration.
+ *
+ * This method generates a single AccelerationCurveSegment with specific values
+ * to effectively disable acceleration for both mice and touchpads.
+ * A flat acceleration curve ensures a constant gain, meaning that the output
+ * velocity is directly proportional to the input velocity, resulting in
+ * a 1:1 movement ratio between the input device and the on-screen pointer.
+ */
+std::vector<AccelerationCurveSegment> createFlatAccelerationCurve(int32_t sensitivity);
+
} // namespace android
diff --git a/include/private/performance_hint_private.h b/include/private/performance_hint_private.h
index e3f98badbe..a468313341 100644
--- a/include/private/performance_hint_private.h
+++ b/include/private/performance_hint_private.h
@@ -125,8 +125,10 @@ APerformanceHintSession* APerformanceHint_createSessionInternal(APerformanceHint
/**
* Creates a session using ASessionCreationConfig
*/
-APerformanceHintSession* APerformanceHint_createSessionUsingConfigInternal(
- APerformanceHintManager* manager, ASessionCreationConfig* sessionCreationConfig,
+int APerformanceHint_createSessionUsingConfigInternal(
+ APerformanceHintManager* manager,
+ ASessionCreationConfig* config,
+ APerformanceHintSession** sessionOut,
SessionTag tag);
/**