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

Commit 227aef2d authored by Rachel Lee's avatar Rachel Lee
Browse files

Add GTE compatibility enum to ANativeWindow.

This moves and renames the enum into ANativeWindow where it is
accessible in the public NDK.

Test: atest SetFrameRateTest
Test: atest libsurfaceflinger_unittest
Test: atest LayerHistoryIntegrationTest
Bug: 380949716
Flag: EXEMPT ndk
Change-Id: I5216c3ceb223f7b9a0571be14544e83d7f8859ea
parent c6bc5f54
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -42,7 +42,7 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, int8_t changeFrame

    if (compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT &&
        compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE &&
        compatibility != ANATIVEWINDOW_FRAME_RATE_GTE &&
        compatibility != ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE &&
        (!privileged ||
         (compatibility != ANATIVEWINDOW_FRAME_RATE_EXACT &&
          compatibility != ANATIVEWINDOW_FRAME_RATE_NO_VOTE))) {
+1 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@ TEST(FrameRateUtilsTest, ValidateFrameRate) {
                                  ANATIVEWINDOW_CHANGE_FRAME_RATE_ALWAYS, ""));
    EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE,
                                  ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, ""));
    EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_GTE,
    EXPECT_TRUE(ValidateFrameRate(60.0f, ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE,
                                  ANATIVEWINDOW_CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS, ""));

    // Privileged APIs.
+9 −3
Original line number Diff line number Diff line
@@ -243,8 +243,7 @@ enum ANativeWindow_FrameRateCompatibility {
     * There are no inherent restrictions on the frame rate of this window. When
     * the system selects a frame rate other than what the app requested, the
     * app will be able to run at the system frame rate without requiring pull
     * down. This value should be used when displaying game content, UIs, and
     * anything that isn't video.
     * down. This value should be used when displaying game content.
     */
    ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_DEFAULT = 0,
    /**
@@ -256,7 +255,14 @@ enum ANativeWindow_FrameRateCompatibility {
     * stuttering) than it would be if the system had chosen the app's requested
     * frame rate. This value should be used for video content.
     */
    ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1
    ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1,

    /**
     * The window requests a frame rate that is greater than or equal to the specified frame rate.
     * This value should be used for UIs, animations, scrolling, and anything that is not a game
     * or video.
     */
    ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE = 2
};

/**
+1 −6
Original line number Diff line number Diff line
@@ -1060,12 +1060,7 @@ enum {
    /**
     * This surface will vote for the minimum refresh rate.
     */
    ANATIVEWINDOW_FRAME_RATE_MIN,

    /**
     * The surface requests a frame rate that is greater than or equal to `frameRate`.
     */
    ANATIVEWINDOW_FRAME_RATE_GTE
    ANATIVEWINDOW_FRAME_RATE_MIN
};

/*
+1 −1
Original line number Diff line number Diff line
@@ -504,7 +504,7 @@ FrameRateCompatibility LayerInfo::FrameRate::convertCompatibility(int8_t compati
            return FrameRateCompatibility::Exact;
        case ANATIVEWINDOW_FRAME_RATE_MIN:
            return FrameRateCompatibility::Min;
        case ANATIVEWINDOW_FRAME_RATE_GTE:
        case ANATIVEWINDOW_FRAME_RATE_COMPATIBILITY_GTE:
            return FrameRateCompatibility::Gte;
        case ANATIVEWINDOW_FRAME_RATE_NO_VOTE:
            return FrameRateCompatibility::NoVote;
Loading