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

Commit 40aef42d authored by Rachel Lee's avatar Rachel Lee
Browse files

Rename const to kFrameTimelinesCapacity

From `kFrameTimelinesLength`.

Bug: 270612751
Test: build
Change-Id: I83e61a19254ab4a63479a2004124cfd2c082da35
parent 0655a915
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -23,8 +23,8 @@

namespace android::gui {

static_assert(VsyncEventData::kFrameTimelinesLength == 7,
              "Must update value in DisplayEventReceiver.java#FRAME_TIMELINES_LENGTH (and here)");
static_assert(VsyncEventData::kFrameTimelinesCapacity == 7,
              "Must update value in DisplayEventReceiver.java#FRAME_TIMELINES_CAPACITY (and here)");

int64_t VsyncEventData::preferredVsyncId() const {
    return frameTimelines[preferredFrameTimelineIndex].vsyncId;
+1 −1
Original line number Diff line number Diff line
@@ -51,7 +51,7 @@ DisplayEventReceiver::Event buildDisplayEvent(FuzzedDataProvider* fdp, uint32_t
            event.vsync.count = fdp->ConsumeIntegral<uint32_t>();
            event.vsync.vsyncData.frameInterval = fdp->ConsumeIntegral<uint64_t>();
            event.vsync.vsyncData.preferredFrameTimelineIndex = fdp->ConsumeIntegral<uint32_t>();
            for (size_t idx = 0; idx < gui::VsyncEventData::kFrameTimelinesLength; ++idx) {
            for (size_t idx = 0; idx < gui::VsyncEventData::kFrameTimelinesCapacity; ++idx) {
                event.vsync.vsyncData.frameTimelines[idx].vsyncId = fdp->ConsumeIntegral<int64_t>();
                event.vsync.vsyncData.frameTimelines[idx].deadlineTimestamp =
                        fdp->ConsumeIntegral<uint64_t>();
+3 −3
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ namespace android::gui {
// DisplayEventReceiver::Event union.
struct VsyncEventData {
    // Max capacity of frame timelines is arbitrarily set to be reasonable.
    static constexpr int64_t kFrameTimelinesLength = 7;
    static constexpr int64_t kFrameTimelinesCapacity = 7;

    // The current frame interval in ns when this frame was scheduled.
    int64_t frameInterval;
@@ -33,7 +33,7 @@ struct VsyncEventData {
    // Index into the frameTimelines that represents the platform's preferred frame timeline.
    uint32_t preferredFrameTimelineIndex;

    // Size of frame timelines provided by the platform; max is kFrameTimelinesLength.
    // Size of frame timelines provided by the platform; max is kFrameTimelinesCapacity.
    uint32_t frameTimelinesLength;

    struct alignas(8) FrameTimeline {
@@ -48,7 +48,7 @@ struct VsyncEventData {

        // The anticipated Vsync presentation time in nanos.
        int64_t expectedPresentationTime;
    } frameTimelines[kFrameTimelinesLength]; // Sorted possible frame timelines.
    } frameTimelines[kFrameTimelinesCapacity]; // Sorted possible frame timelines.

    // Gets the preferred frame timeline's vsync ID.
    int64_t preferredVsyncId() const;
+4 −4
Original line number Diff line number Diff line
@@ -45,16 +45,16 @@ TEST(DisplayEventStructLayoutTest, TestEventAlignment) {
    // Also test the offsets of the last frame timeline. A loop is not used because the non-const
    // index cannot be used in static_assert.
    const int lastFrameTimelineOffset = /* Start of array */ 24 +
            (VsyncEventData::kFrameTimelinesLength - 1) * /* Size of FrameTimeline */ 24;
            (VsyncEventData::kFrameTimelinesCapacity - 1) * /* Size of FrameTimeline */ 24;
    CHECK_OFFSET(DisplayEventReceiver::Event::VSync,
                 vsyncData.frameTimelines[VsyncEventData::kFrameTimelinesLength - 1].vsyncId,
                 vsyncData.frameTimelines[VsyncEventData::kFrameTimelinesCapacity - 1].vsyncId,
                 lastFrameTimelineOffset);
    CHECK_OFFSET(DisplayEventReceiver::Event::VSync,
                 vsyncData.frameTimelines[VsyncEventData::kFrameTimelinesLength - 1]
                 vsyncData.frameTimelines[VsyncEventData::kFrameTimelinesCapacity - 1]
                         .deadlineTimestamp,
                 lastFrameTimelineOffset + 8);
    CHECK_OFFSET(DisplayEventReceiver::Event::VSync,
                 vsyncData.frameTimelines[VsyncEventData::kFrameTimelinesLength - 1]
                 vsyncData.frameTimelines[VsyncEventData::kFrameTimelinesCapacity - 1]
                         .expectedPresentationTime,
                 lastFrameTimelineOffset + 16);

+1 −1
Original line number Diff line number Diff line
@@ -47,7 +47,7 @@ TEST(ParcelableVsyncEventData, Parcelling) {
    ASSERT_EQ(data.vsync.frameInterval, data2.vsync.frameInterval);
    ASSERT_EQ(data.vsync.preferredFrameTimelineIndex, data2.vsync.preferredFrameTimelineIndex);
    ASSERT_EQ(data.vsync.frameTimelinesLength, data2.vsync.frameTimelinesLength);
    for (int i = 0; i < VsyncEventData::kFrameTimelinesLength; i++) {
    for (int i = 0; i < VsyncEventData::kFrameTimelinesCapacity; i++) {
        ASSERT_EQ(data.vsync.frameTimelines[i].vsyncId, data2.vsync.frameTimelines[i].vsyncId);
        ASSERT_EQ(data.vsync.frameTimelines[i].deadlineTimestamp,
                  data2.vsync.frameTimelines[i].deadlineTimestamp);
Loading