Skip to content

Commit ee81a84

Browse files
Rachel LeeAndroid (Google) Code Review
authored andcommitted
Merge "Add GTE compatibility enum to ANativeWindow." into main
2 parents dac897d + 227aef2 commit ee81a84

6 files changed

Lines changed: 15 additions & 14 deletions

File tree

libs/gui/FrameRateUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, int8_t changeFrame
4242

4343
if (compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT &&
4444
compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE &&
45-
compatibility != ANATIVEWINDOW_FRAME_RATE_GTE &&
45+
compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE &&
4646
(!privileged ||
4747
(compatibility != ANATIVEWINDOW_FRAME_RATE_EXACT &&
4848
compatibility != ANATIVEWINDOW_FRAME_RATE_NO_VOTE))) {

libs/gui/tests/FrameRateUtilsTest.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ TEST(FrameRateUtilsTest, ValidateFrameRate) {
3434
ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS, ""));
3535
EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
3636
ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, ""));
37-
EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_GTE,
37+
EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE,
3838
ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, ""));
3939

4040
// Privileged APIs.

libs/nativewindow/include/android/native_window.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,7 @@ enum ANativeWindow_FrameRateCompatibility {
243243
* There are no inherent restrictions on the frame rate of this window. When
244244
* the system selects a frame rate other than what the app requested, the
245245
* app will be able to run at the system frame rate without requiring pull
246-
* down. This value should be used when displaying game content, UIs, and
247-
* anything that isn't video.
246+
* down. This value should be used when displaying game content.
248247
*/
249248
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0,
250249
/**
@@ -256,7 +255,14 @@ enum ANativeWindow_FrameRateCompatibility {
256255
* stuttering) than it would be if the system had chosen the app's requested
257256
* frame rate. This value should be used for video content.
258257
*/
259-
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1
258+
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1,
259+
260+
/**
261+
* The window requests a frame rate that is greater than or equal to the specified frame rate.
262+
* This value should be used for UIs, animations, scrolling, and anything that is not a game
263+
* or video.
264+
*/
265+
ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE = 2
260266
};
261267

262268
/**

libs/nativewindow/include/system/window.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1060,12 +1060,7 @@ enum {
10601060
/**
10611061
* This surface will vote for the minimum refresh rate.
10621062
*/
1063-
ANATIVEWINDOW_FRAME_RATE_MIN,
1064-
1065-
/**
1066-
* The surface requests a frame rate that is greater than or equal to `frameRate`.
1067-
*/
1068-
ANATIVEWINDOW_FRAME_RATE_GTE
1063+
ANATIVEWINDOW_FRAME_RATE_MIN
10691064
};
10701065

10711066
/*

services/surfaceflinger/Scheduler/LayerInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ FrameRateCompatibility LayerInfo::FrameRate::convertCompatibility(int8_t compati
504504
return FrameRateCompatibility::Exact;
505505
case ANATIVEWINDOW_FRAME_RATE_MIN:
506506
return FrameRateCompatibility::Min;
507-
case ANATIVEWINDOW_FRAME_RATE_GTE:
507+
case ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE:
508508
return FrameRateCompatibility::Gte;
509509
case ANATIVEWINDOW_FRAME_RATE_NO_VOTE:
510510
return FrameRateCompatibility::NoVote;

services/surfaceflinger/tests/unittests/LayerHistoryIntegrationTest.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ TEST_F(LayerHistoryIntegrationTest, oneLayerExplicitGte_vrr) {
584584

585585
auto layer = createLegacyAndFrontedEndLayer(1);
586586
showLayer(1);
587-
setFrameRate(1, (33_Hz).getValue(), ANATIVEWINDOW_FRAME_RATE_GTE,
587+
setFrameRate(1, (33_Hz).getValue(), ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE,
588588
ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS);
589589
setFrameRateCategory(1, 0);
590590

@@ -623,7 +623,7 @@ TEST_F(LayerHistoryIntegrationTest, oneLayerExplicitGte_nonVrr) {
623623

624624
auto layer = createLegacyAndFrontedEndLayer(1);
625625
showLayer(1);
626-
setFrameRate(1, (33_Hz).getValue(), ANATIVEWINDOW_FRAME_RATE_GTE,
626+
setFrameRate(1, (33_Hz).getValue(), ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE,
627627
ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS);
628628
setFrameRateCategory(1, 0);
629629

0 commit comments

Comments
 (0)