Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 33216a47 authored by Rob Carr's avatar Rob Carr Committed by Android (Google) Code Review
Browse files

Merge "ASurfaceTransaction: Add setEnableBackpressure" into sc-dev

parents 33324ae8 f08168d9
Loading
Loading
Loading
Loading
+29 −0
Original line number Diff line number Diff line
@@ -497,6 +497,35 @@ void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* tra
                                      int8_t compatibility, int8_t changeFrameRateStrategy)
                                      __INTRODUCED_IN(31);

/**
 * Indicate whether to enable backpressure for buffer submission to a given SurfaceControl.
 *
 * By default backpressure is disabled, which means submitting a buffer prior to receiving
 * a callback for the previous buffer could lead to that buffer being "dropped". In cases
 * where you are selecting for latency, this may be a desirable behavior! We had a new buffer
 * ready, why shouldn't we show it?
 *
 * When back pressure is enabled, each buffer will be required to be presented
 * before it is released and the callback delivered
 * (absent the whole SurfaceControl being removed).
 *
 * Most apps are likely to have some sort of backpressure internally, e.g. you are
 * waiting on the callback from frame N-2 before starting frame N. In high refresh
 * rate scenarios there may not be much time between SurfaceFlinger completing frame
 * N-1 (and therefore releasing buffer N-2) and beginning frame N. This means
 * your app may not have enough time to respond in the callback. Using this flag
 * and pushing buffers earlier for server side queuing will be advantageous
 * in such cases.
 *
 * \param transaction The transaction in which to make the change.
 * \param surface_control The ASurfaceControl on which to control buffer backpressure behavior.
 * \param enableBackPressure Whether to enable back pressure.
 */
void ASurfaceTransaction_setEnableBackPressure(ASurfaceTransaction* transaction,
                                               ASurfaceControl* surface_control,
                                               bool enableBackPressure)
                                               __INTRODUCED_IN(31);

__END_DECLS

#endif // ANDROID_SURFACE_CONTROL_H