From 0655a9157bc7ab4771202d2d4e206f91d5352481 Mon Sep 17 00:00:00 2001 From: Rachel Lee Date: Thu, 20 Apr 2023 19:54:18 -0700 Subject: Fix Choreographer affecting ASurfaceControlTest Fixes `testSurfaceTransaction_setFrameTimeline_notPreferredIndex` case on devices that do not have high refresh rates (e.g. max 60Hz). This occurred because the transaction-ready logic in SF does not consider transactions to be too early if the expected presentation time is over 100ms in the future, so the frame would just be deemed ready and presented asap. Thus, no longer provide frame timelines that are far into the future, which are not useful as well. Test: atest ASurfaceControlTest Test: atest ChoreographerTest Test: atest ChoreographerNativeTest Test: atest DisplayEventStructLayoutTest Test: atest ParcelableVsyncEventData Test: atest libsurfacefligner_unittest Fixes: 270612751 Change-Id: Ic05717bc153a9b07409b8d7912a1c40e1e31a57e --- libs/gui/VsyncEventData.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'libs/gui/VsyncEventData.cpp') diff --git a/libs/gui/VsyncEventData.cpp b/libs/gui/VsyncEventData.cpp index 76c60c23c4..91fc9c0ffe 100644 --- a/libs/gui/VsyncEventData.cpp +++ b/libs/gui/VsyncEventData.cpp @@ -46,11 +46,15 @@ status_t ParcelableVsyncEventData::readFromParcel(const Parcel* parcel) { SAFE_PARCEL(parcel->readInt64, &vsync.frameInterval); - uint64_t uintPreferredFrameTimelineIndex; - SAFE_PARCEL(parcel->readUint64, &uintPreferredFrameTimelineIndex); + uint32_t uintPreferredFrameTimelineIndex; + SAFE_PARCEL(parcel->readUint32, &uintPreferredFrameTimelineIndex); vsync.preferredFrameTimelineIndex = static_cast(uintPreferredFrameTimelineIndex); - for (int i = 0; i < VsyncEventData::kFrameTimelinesLength; i++) { + uint32_t uintFrameTimelinesLength; + SAFE_PARCEL(parcel->readUint32, &uintFrameTimelinesLength); + vsync.frameTimelinesLength = static_cast(uintFrameTimelinesLength); + + for (size_t i = 0; i < vsync.frameTimelinesLength; i++) { SAFE_PARCEL(parcel->readInt64, &vsync.frameTimelines[i].vsyncId); SAFE_PARCEL(parcel->readInt64, &vsync.frameTimelines[i].deadlineTimestamp); SAFE_PARCEL(parcel->readInt64, &vsync.frameTimelines[i].expectedPresentationTime); @@ -60,8 +64,9 @@ status_t ParcelableVsyncEventData::readFromParcel(const Parcel* parcel) { } status_t ParcelableVsyncEventData::writeToParcel(Parcel* parcel) const { SAFE_PARCEL(parcel->writeInt64, vsync.frameInterval); - SAFE_PARCEL(parcel->writeUint64, vsync.preferredFrameTimelineIndex); - for (int i = 0; i < VsyncEventData::kFrameTimelinesLength; i++) { + SAFE_PARCEL(parcel->writeUint32, vsync.preferredFrameTimelineIndex); + SAFE_PARCEL(parcel->writeUint32, vsync.frameTimelinesLength); + for (size_t i = 0; i < vsync.frameTimelinesLength; i++) { SAFE_PARCEL(parcel->writeInt64, vsync.frameTimelines[i].vsyncId); SAFE_PARCEL(parcel->writeInt64, vsync.frameTimelines[i].deadlineTimestamp); SAFE_PARCEL(parcel->writeInt64, vsync.frameTimelines[i].expectedPresentationTime); -- cgit v1.2.3-59-g8ed1b