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

Commit abf5f9aa authored by Kriti Dang's avatar Kriti Dang Committed by Android (Google) Code Review
Browse files

Merge "Add clearFrameRate API in ndk"

parents b7c88afd 4113fc17
Loading
Loading
Loading
Loading
+27 −0
Original line number Diff line number Diff line
@@ -545,6 +545,8 @@ void ASurfaceTransaction_setFrameRate(ASurfaceTransaction* transaction,
 * You can register for changes in the refresh rate using
 * \a AChoreographer_registerRefreshRateCallback.
 *
 * See ASurfaceTransaction_clearFrameRate().
 *
 * \param frameRate is the intended frame rate of this surface, in frames per second. 0 is a special
 * value that indicates the app will accept the system's choice for the display frame rate, which is
 * the default behavior if this function isn't called. The frameRate param does <em>not</em> need to
@@ -567,6 +569,31 @@ void ASurfaceTransaction_setFrameRateWithChangeStrategy(ASurfaceTransaction* tra
                                      int8_t compatibility, int8_t changeFrameRateStrategy)
                                      __INTRODUCED_IN(31);

/**
 * Clears the frame rate which is set for \a surface_control.
 *
 * This is equivalent to calling
 * ASurfaceTransaction_setFrameRateWithChangeStrategy(
 * transaction, 0, compatibility, changeFrameRateStrategy).
 *
 * Usage of this API won't directly affect the application's frame production pipeline. However,
 * because the system may change the display refresh rate, calls to this function may result in
 * changes to Choreographer callback timings, and changes to the time interval at which the system
 * releases buffers back to the application.
 *
 * See ASurfaceTransaction_setFrameRateWithChangeStrategy()
 *
 * You can register for changes in the refresh rate using
 * \a AChoreographer_registerRefreshRateCallback.
 *
 * See ASurfaceTransaction_setFrameRateWithChangeStrategy().
 *
 * Available since API level 34.
 */
void ASurfaceTransaction_clearFrameRate(ASurfaceTransaction* transaction,
                                        ASurfaceControl* surface_control)
                                        __INTRODUCED_IN(__ANDROID_API_U__);

/**
 * Indicate whether to enable backpressure for buffer submission to a given SurfaceControl.
 *
+9 −0
Original line number Diff line number Diff line
@@ -220,6 +220,15 @@ int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, floa
    return native_window_set_frame_rate(window, frameRate, compatibility, changeFrameRateStrategy);
}

int32_t ANativeWindow_clearFrameRate(ANativeWindow* window) {
    if (!window || !query(window, NATIVE_WINDOW_IS_VALID)) {
        return -EINVAL;
    }
    return native_window_set_frame_rate(window, 0,
            ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT,
            ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS);
}

/**************************************************************************************************
 * vndk-stable
 **************************************************************************************************/
+33 −0
Original line number Diff line number Diff line
@@ -313,6 +313,8 @@ enum ANativeWindow_ChangeFrameRateStrategy {
 * You can register for changes in the refresh rate using
 * \a AChoreographer_registerRefreshRateCallback.
 *
 * See ANativeWindow_clearFrameRate().
 *
 * Available since API level 31.
 *
 * \param window pointer to an ANativeWindow object.
@@ -342,6 +344,37 @@ int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, floa
        int8_t compatibility, int8_t changeFrameRateStrategy)
        __INTRODUCED_IN(31);

/**
 * Clears the frame rate which is set for this window.
 *
 * This is equivalent to calling
 * ANativeWindow_setFrameRateWithChangeStrategy(window, 0, compatibility, changeFrameRateStrategy).
 *
 * Usage of this API won't introduce frame rate throttling,
 * or affect other aspects of the application's frame production
 * pipeline. However, because the system may change the display refresh rate,
 * calls to this function may result in changes to Choreographer callback
 * timings, and changes to the time interval at which the system releases
 * buffers back to the application.
 *
 * Note that this only has an effect for windows presented on the display. If
 * this ANativeWindow is consumed by something other than the system compositor,
 * e.g. a media codec, this call has no effect.
 *
 * You can register for changes in the refresh rate using
 * \a AChoreographer_registerRefreshRateCallback.
 *
 * See ANativeWindow_setFrameRateWithChangeStrategy().
 *
 * Available since API level 34.
 *
 * \param window pointer to an ANativeWindow object.
 *
 * \return 0 for success, -EINVAL if the window value is invalid.
 */
int32_t ANativeWindow_clearFrameRate(ANativeWindow* window)
        __INTRODUCED_IN(__ANDROID_API_U__);

#ifdef __cplusplus
};
#endif
+1 −0
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ LIBNATIVEWINDOW {
    ANativeWindow_setDequeueTimeout; # systemapi # introduced=30
    ANativeWindow_setFrameRate; # introduced=30
    ANativeWindow_setFrameRateWithChangeStrategy; # introduced=31
    ANativeWindow_clearFrameRate; # introduced=UpsideDownCake
    ANativeWindow_setSharedBufferMode; # llndk
    ANativeWindow_setSwapInterval; # llndk
    ANativeWindow_setUsage; # llndk