diff options
Diffstat (limited to 'libs/gui/FrameTimestamps.cpp')
-rw-r--r-- | libs/gui/FrameTimestamps.cpp | 59 |
1 files changed, 32 insertions, 27 deletions
diff --git a/libs/gui/FrameTimestamps.cpp b/libs/gui/FrameTimestamps.cpp index c9b894833b..46ca97470a 100644 --- a/libs/gui/FrameTimestamps.cpp +++ b/libs/gui/FrameTimestamps.cpp @@ -241,33 +241,6 @@ void ProducerFrameEventHistory::updateAcquireFence( } } -static void applyFenceDelta(FenceTimeline* timeline, - std::shared_ptr<FenceTime>* dst, const FenceTime::Snapshot& src) { - if (CC_UNLIKELY(dst == nullptr)) { - ALOGE("applyFenceDelta: dst is null."); - return; - } - - switch (src.state) { - case FenceTime::Snapshot::State::EMPTY: - return; - case FenceTime::Snapshot::State::FENCE: - if (CC_UNLIKELY((*dst)->isValid())) { - ALOGE("applyFenceDelta: Unexpected fence."); - } - *dst = std::make_shared<FenceTime>(src.fence); - timeline->push(*dst); - return; - case FenceTime::Snapshot::State::SIGNAL_TIME: - if ((*dst)->isValid()) { - (*dst)->applyTrustedSnapshot(src); - } else { - *dst = std::make_shared<FenceTime>(src.signalTime); - } - return; - } -} - void ProducerFrameEventHistory::applyDelta( const FrameEventHistoryDelta& delta) { for (auto& d : delta.mDeltas) { @@ -320,6 +293,38 @@ void ProducerFrameEventHistory::updateSignalTimes() { mReleaseTimeline.updateSignalTimes(); } +void ProducerFrameEventHistory::applyFenceDelta(FenceTimeline* timeline, + std::shared_ptr<FenceTime>* dst, const FenceTime::Snapshot& src) const { + if (CC_UNLIKELY(dst == nullptr)) { + ALOGE("applyFenceDelta: dst is null."); + return; + } + + switch (src.state) { + case FenceTime::Snapshot::State::EMPTY: + return; + case FenceTime::Snapshot::State::FENCE: + if (CC_UNLIKELY((*dst)->isValid())) { + ALOGE("applyFenceDelta: Unexpected fence."); + } + *dst = createFenceTime(src.fence); + timeline->push(*dst); + return; + case FenceTime::Snapshot::State::SIGNAL_TIME: + if ((*dst)->isValid()) { + (*dst)->applyTrustedSnapshot(src); + } else { + *dst = std::make_shared<FenceTime>(src.signalTime); + } + return; + } +} + +std::shared_ptr<FenceTime> ProducerFrameEventHistory::createFenceTime( + const sp<Fence>& fence) const { + return std::make_shared<FenceTime>(fence); +} + // ============================================================================ // ConsumerFrameEventHistory |