Skip to content

Commit 2de26dd

Browse files
Rachel LeeAndroid (Google) Code Review
authored andcommitted
Merge "Revert "Add new ANativeWindow_setFrameRateParams API"" into main
2 parents fff2390 + 6ac21ec commit 2de26dd

4 files changed

Lines changed: 3 additions & 101 deletions

File tree

libs/nativewindow/ANativeWindow.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -265,16 +265,6 @@ int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, floa
265265
return native_window_set_frame_rate(window, frameRate, compatibility, changeFrameRateStrategy);
266266
}
267267

268-
int32_t ANativeWindow_setFrameRateParams(
269-
ANativeWindow* window, float desiredMinRate, float desiredMaxRate, float fixedSourceRate,
270-
ANativeWindow_ChangeFrameRateStrategy changeFrameRateStrategy) {
271-
if (!window || !query(window, NATIVE_WINDOW_IS_VALID)) {
272-
return -EINVAL;
273-
}
274-
return native_window_set_frame_rate_params(window, desiredMinRate, desiredMaxRate,
275-
fixedSourceRate, changeFrameRateStrategy);
276-
}
277-
278268
/**************************************************************************************************
279269
* vndk-stable
280270
**************************************************************************************************/

libs/nativewindow/include/android/native_window.h

Lines changed: 3 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
#ifndef ANDROID_NATIVE_WINDOW_H
3434
#define ANDROID_NATIVE_WINDOW_H
3535

36-
#include <stdbool.h>
3736
#include <stdint.h>
37+
#include <stdbool.h>
3838
#include <sys/cdefs.h>
3939

4040
#include <android/data_space.h>
@@ -282,7 +282,7 @@ int32_t ANativeWindow_setFrameRate(ANativeWindow* window, float frameRate, int8_
282282
void ANativeWindow_tryAllocateBuffers(ANativeWindow* window) __INTRODUCED_IN(30);
283283

284284
/** Change frame rate strategy value for ANativeWindow_setFrameRate. */
285-
typedef enum ANativeWindow_ChangeFrameRateStrategy : int8_t {
285+
enum ANativeWindow_ChangeFrameRateStrategy {
286286
/**
287287
* Change the frame rate only if the transition is going to be seamless.
288288
*/
@@ -292,7 +292,7 @@ typedef enum ANativeWindow_ChangeFrameRateStrategy : int8_t {
292292
* i.e. with visual interruptions for the user.
293293
*/
294294
ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS = 1
295-
} ANativeWindow_ChangeFrameRateStrategy __INTRODUCED_IN(31);
295+
} __INTRODUCED_IN(31);
296296

297297
/**
298298
* Sets the intended frame rate for this window.
@@ -344,76 +344,6 @@ int32_t ANativeWindow_setFrameRateWithChangeStrategy(ANativeWindow* window, floa
344344
int8_t compatibility, int8_t changeFrameRateStrategy)
345345
__INTRODUCED_IN(31);
346346

347-
/**
348-
* Sets the intended frame rate for this window.
349-
*
350-
* On devices that are capable of running the display at different frame rates,
351-
* the system may choose a display refresh rate to better match this surface's frame
352-
* rate. Usage of this API won't introduce frame rate throttling, or affect other
353-
* aspects of the application's frame production pipeline. However, because the system
354-
* may change the display refresh rate, calls to this function may result in changes
355-
* to Choreographer callback timings, and changes to the time interval at which the
356-
* system releases buffers back to the application.
357-
*
358-
* Note that this only has an effect for surfaces presented on the display. If this
359-
* surface is consumed by something other than the system compositor, e.g. a media
360-
* codec, this call has no effect.
361-
*
362-
* You can register for changes in the refresh rate using
363-
* \a AChoreographer_registerRefreshRateCallback.
364-
*
365-
* See ANativeWindow_clearFrameRate().
366-
*
367-
* Available since API level 36.
368-
*
369-
* \param window pointer to an ANativeWindow object.
370-
*
371-
* \param desiredMinRate The desired minimum frame rate (inclusive) for the window, specifying that
372-
* the surface prefers the device render rate to be at least `desiredMinRate`.
373-
*
374-
* <p>Set `desiredMinRate` = `desiredMaxRate` to indicate the surface prefers an exact frame rate.
375-
*
376-
* <p>Set `desiredMinRate` = 0 to indicate the window has no preference
377-
* and any frame rate is acceptable.
378-
*
379-
* <p>The value should be greater than or equal to 0.
380-
*
381-
* \param desiredMaxRate The desired maximum frame rate (inclusive) for the window, specifying that
382-
* the surface prefers the device render rate to be at most `desiredMaxRate`.
383-
*
384-
* <p>Set `desiredMaxRate` = `desiredMinRate` to indicate the surface prefers an exact frame rate.
385-
*
386-
* <p>Set `desiredMaxRate` = positive infinity to indicate the window has no preference
387-
* and any frame rate is acceptable.
388-
*
389-
* <p>The value should be greater than or equal to `desiredMinRate`.
390-
*
391-
* \param fixedSourceRate The "fixed source" frame rate of the window if the content has an
392-
* inherently fixed frame rate, e.g. a video that has a specific frame rate.
393-
*
394-
* <p>When the frame rate chosen for the surface is the `fixedSourceRate` or a
395-
* multiple, the surface can render without frame pulldown, for optimal smoothness. For
396-
* example, a 30 fps video (`fixedSourceRate`=30) renders just as smoothly on 30 fps,
397-
* 60 fps, 90 fps, 120 fps, and so on.
398-
*
399-
* <p>Setting the fixed source rate can also be used together with a desired
400-
* frame rate min and max via setting `desiredMinRate` and `desiredMaxRate`. This still
401-
* means the window's content has a fixed frame rate of `fixedSourceRate`, but additionally
402-
* specifies the preference to be in the range [`desiredMinRate`, `desiredMaxRate`]. For example, an
403-
* app might want to specify there is 30 fps video (`fixedSourceRate`=30) as well as a smooth
404-
* animation on the same window which looks good when drawing within a frame rate range such as
405-
* [`desiredMinRate`, `desiredMaxRate`] = [60,120].
406-
*
407-
* \param changeFrameRateStrategy Whether display refresh rate transitions caused by this surface
408-
* should be seamless. A seamless transition is one that doesn't have any visual interruptions, such
409-
* as a black screen for a second or two.
410-
*
411-
* \return 0 for success, -EINVAL if the arguments are invalid.
412-
*/
413-
int32_t ANativeWindow_setFrameRateParams(
414-
ANativeWindow* window, float desiredMinRate, float desiredMaxRate, float fixedSourceRate,
415-
ANativeWindow_ChangeFrameRateStrategy changeFrameRateStrategy) __INTRODUCED_IN(36);
416-
417347
/**
418348
* Clears the frame rate which is set for this window.
419349
*

libs/nativewindow/include/system/window.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1156,23 +1156,6 @@ static inline int native_window_set_frame_rate(struct ANativeWindow* window, flo
11561156
(int)compatibility, (int)changeFrameRateStrategy);
11571157
}
11581158

1159-
static inline int native_window_set_frame_rate_params(struct ANativeWindow* window,
1160-
float desiredMinRate, float desiredMaxRate,
1161-
float fixedSourceRate,
1162-
int8_t changeFrameRateStrategy) {
1163-
// TODO(b/362798998): Fix plumbing to send whole params
1164-
int compatibility = fixedSourceRate == 0 ? ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT
1165-
: ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE;
1166-
double frameRate = compatibility == ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE
1167-
? fixedSourceRate
1168-
: desiredMinRate;
1169-
if (desiredMaxRate < desiredMinRate) {
1170-
return -EINVAL;
1171-
}
1172-
return window->perform(window, NATIVE_WINDOW_SET_FRAME_RATE, frameRate, compatibility,
1173-
changeFrameRateStrategy);
1174-
}
1175-
11761159
struct ANativeWindowFrameTimelineInfo {
11771160
// Frame Id received from ANativeWindow_getNextFrameId.
11781161
uint64_t frameNumber;

libs/nativewindow/libnativewindow.map.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ LIBNATIVEWINDOW {
5353
ANativeWindow_setBuffersTransform;
5454
ANativeWindow_setDequeueTimeout; # systemapi introduced=30
5555
ANativeWindow_setFrameRate; # introduced=30
56-
ANativeWindow_setFrameRateParams; # introduced=36
5756
ANativeWindow_setFrameRateWithChangeStrategy; # introduced=31
5857
ANativeWindow_setSharedBufferMode; # llndk
5958
ANativeWindow_setSwapInterval; # llndk

0 commit comments

Comments
 (0)