summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libs/gui/VsyncEventData.cpp4
-rw-r--r--libs/gui/fuzzer/libgui_displayEvent_fuzzer.cpp2
-rw-r--r--libs/gui/include/gui/VsyncEventData.h6
-rw-r--r--libs/gui/tests/DisplayEventStructLayout_test.cpp8
-rw-r--r--libs/gui/tests/VsyncEventData_test.cpp2
-rw-r--r--libs/nativedisplay/AChoreographer.cpp6
-rw-r--r--services/surfaceflinger/Scheduler/EventThread.cpp4
-rw-r--r--services/surfaceflinger/tests/DisplayEventReceiver_test.cpp2
-rw-r--r--services/surfaceflinger/tests/unittests/EventThreadTest.cpp10
9 files changed, 22 insertions, 22 deletions
diff --git a/libs/gui/VsyncEventData.cpp b/libs/gui/VsyncEventData.cpp
index 91fc9c0ffe..8e00c2fe32 100644
--- a/libs/gui/VsyncEventData.cpp
+++ b/libs/gui/VsyncEventData.cpp
@@ -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;
diff --git a/libs/gui/fuzzer/libgui_displayEvent_fuzzer.cpp b/libs/gui/fuzzer/libgui_displayEvent_fuzzer.cpp
index 6d5ae49635..6e4f074825 100644
--- a/libs/gui/fuzzer/libgui_displayEvent_fuzzer.cpp
+++ b/libs/gui/fuzzer/libgui_displayEvent_fuzzer.cpp
@@ -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>();
diff --git a/libs/gui/include/gui/VsyncEventData.h b/libs/gui/include/gui/VsyncEventData.h
index 9ddb7cd82b..b40a84099c 100644
--- a/libs/gui/include/gui/VsyncEventData.h
+++ b/libs/gui/include/gui/VsyncEventData.h
@@ -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;
diff --git a/libs/gui/tests/DisplayEventStructLayout_test.cpp b/libs/gui/tests/DisplayEventStructLayout_test.cpp
index b7b4ab605a..3949d70aac 100644
--- a/libs/gui/tests/DisplayEventStructLayout_test.cpp
+++ b/libs/gui/tests/DisplayEventStructLayout_test.cpp
@@ -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);
diff --git a/libs/gui/tests/VsyncEventData_test.cpp b/libs/gui/tests/VsyncEventData_test.cpp
index 6e039ee6e7..a2138f2144 100644
--- a/libs/gui/tests/VsyncEventData_test.cpp
+++ b/libs/gui/tests/VsyncEventData_test.cpp
@@ -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);
diff --git a/libs/nativedisplay/AChoreographer.cpp b/libs/nativedisplay/AChoreographer.cpp
index 80b0041923..8f005a56f8 100644
--- a/libs/nativedisplay/AChoreographer.cpp
+++ b/libs/nativedisplay/AChoreographer.cpp
@@ -213,7 +213,7 @@ AVsyncId AChoreographerFrameCallbackData_getFrameTimelineVsyncId(
AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
"Data is only valid in callback");
- LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesLength, "Index out of bounds");
+ LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesCapacity, "Index out of bounds");
return frameCallbackData->vsyncEventData.frameTimelines[index].vsyncId;
}
int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTimeNanos(
@@ -222,7 +222,7 @@ int64_t AChoreographerFrameCallbackData_getFrameTimelineExpectedPresentationTime
AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
"Data is only valid in callback");
- LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesLength, "Index out of bounds");
+ LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesCapacity, "Index out of bounds");
return frameCallbackData->vsyncEventData.frameTimelines[index].expectedPresentationTime;
}
int64_t AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos(
@@ -231,7 +231,7 @@ int64_t AChoreographerFrameCallbackData_getFrameTimelineDeadlineNanos(
AChoreographerFrameCallbackData_to_ChoreographerFrameCallbackDataImpl(data);
LOG_ALWAYS_FATAL_IF(!frameCallbackData->choreographer->inCallback(),
"Data is only valid in callback");
- LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesLength, "Index out of bounds");
+ LOG_ALWAYS_FATAL_IF(index >= VsyncEventData::kFrameTimelinesCapacity, "Index out of bounds");
return frameCallbackData->vsyncEventData.frameTimelines[index].deadlineTimestamp;
}
diff --git a/services/surfaceflinger/Scheduler/EventThread.cpp b/services/surfaceflinger/Scheduler/EventThread.cpp
index f79688dfe0..7b59ca5203 100644
--- a/services/surfaceflinger/Scheduler/EventThread.cpp
+++ b/services/surfaceflinger/Scheduler/EventThread.cpp
@@ -600,8 +600,8 @@ void EventThread::generateFrameTimeline(VsyncEventData& outVsyncEventData, nsecs
nsecs_t preferredDeadlineTimestamp) const {
uint32_t currentIndex = 0;
// Add 1 to ensure the preferredFrameTimelineIndex entry (when multiplier == 0) is included.
- for (int64_t multiplier = -VsyncEventData::kFrameTimelinesLength + 1;
- currentIndex < VsyncEventData::kFrameTimelinesLength; multiplier++) {
+ for (int64_t multiplier = -VsyncEventData::kFrameTimelinesCapacity + 1;
+ currentIndex < VsyncEventData::kFrameTimelinesCapacity; multiplier++) {
nsecs_t deadlineTimestamp = preferredDeadlineTimestamp + multiplier * frameInterval;
// Valid possible frame timelines must have future values, so find a later frame timeline.
if (deadlineTimestamp <= timestamp) {
diff --git a/services/surfaceflinger/tests/DisplayEventReceiver_test.cpp b/services/surfaceflinger/tests/DisplayEventReceiver_test.cpp
index 761ac8c538..4c26017241 100644
--- a/services/surfaceflinger/tests/DisplayEventReceiver_test.cpp
+++ b/services/surfaceflinger/tests/DisplayEventReceiver_test.cpp
@@ -36,7 +36,7 @@ TEST_F(DisplayEventReceiverTest, getLatestVsyncEventData) {
EXPECT_GT(static_cast<int64_t>(vsyncEventData.frameTimelinesLength), 0)
<< "Frame timelines length should be greater than 0";
EXPECT_LE(static_cast<int64_t>(vsyncEventData.frameTimelinesLength),
- VsyncEventData::kFrameTimelinesLength)
+ VsyncEventData::kFrameTimelinesCapacity)
<< "Frame timelines length should not exceed max capacity";
EXPECT_GT(vsyncEventData.frameTimelines[0].deadlineTimestamp, now)
<< "Deadline timestamp should be greater than frame time";
diff --git a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
index 6debbaae2d..5fed9b45a6 100644
--- a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
+++ b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
@@ -299,7 +299,7 @@ void EventThreadTest::expectVsyncEventDataFrameTimelinesValidLength(
EXPECT_LE(vsyncEventData.frameTimelinesLength, nonPreferredTimelinesAmount + 1)
<< "Amount of non-preferred frame timelines too many;"
<< " expected presentation time will be over threshold";
- EXPECT_LT(nonPreferredTimelinesAmount, VsyncEventData::kFrameTimelinesLength)
+ EXPECT_LT(nonPreferredTimelinesAmount, VsyncEventData::kFrameTimelinesCapacity)
<< "Amount of non-preferred frame timelines should be less than max capacity";
EXPECT_GT(static_cast<int64_t>(vsyncEventData.frameTimelinesLength), 0)
<< "Frame timelines length should be greater than 0";
@@ -428,11 +428,11 @@ TEST_F(EventThreadTest, requestNextVsyncEventFrameTimelinesCorrect) {
}
TEST_F(EventThreadTest, requestNextVsyncEventFrameTimelinesValidLength) {
- // The VsyncEventData should not have kFrameTimelinesLength amount of valid frame timelines, due
- // to longer vsync period and kEarlyLatchMaxThreshold.
- // Use length-2 to avoid decimal truncation (e.g. 60Hz has 16.6... ms vsync period).
+ // The VsyncEventData should not have kFrameTimelinesCapacity amount of valid frame timelines,
+ // due to longer vsync period and kEarlyLatchMaxThreshold. Use length-2 to avoid decimal
+ // truncation (e.g. 60Hz has 16.6... ms vsync period).
std::chrono::nanoseconds vsyncPeriod(scheduler::VsyncConfig::kEarlyLatchMaxThreshold /
- (VsyncEventData::kFrameTimelinesLength - 2));
+ (VsyncEventData::kFrameTimelinesCapacity - 2));
setupEventThread(vsyncPeriod);
// Signal that we want the next vsync event to be posted to the connection