Loading services/surfaceflinger/SurfaceFlinger.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -1688,22 +1688,26 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); } nsecs_t SurfaceFlinger::getExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { DisplayStatInfo stats; mScheduler->getDisplayStatInfo(&stats); const nsecs_t presentTime = mScheduler->getDispSyncExpectedPresentTime(); // Inflate the expected present time if we're targetting the next vsync. const nsecs_t correctedTime = mExpectedPresentTime = mVsyncModulator.getOffsets().sf < mPhaseOffsets->getOffsetThresholdForNextVsync() ? presentTime : presentTime + stats.vsyncPeriod; return correctedTime; } void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { ATRACE_CALL(); switch (what) { case MessageQueue::INVALIDATE: { // calculate the expected present time once and use the cached // value throughout this frame to make sure all layers are // seeing this same value. populateExpectedPresentTime(); bool frameMissed = previousFrameMissed(); bool hwcFrameMissed = mHadDeviceComposition && frameMissed; bool gpuFrameMissed = mHadClientComposition && frameMissed; Loading services/surfaceflinger/SurfaceFlinger.h +5 −2 Original line number Diff line number Diff line Loading @@ -301,10 +301,11 @@ public: // TODO: this should be made accessible only to MessageQueue void onMessageReceived(int32_t what); // Returns the expected present time for this frame. // populates the expected present time for this frame. // When we are in negative offsets, we perform a correction so that the // predicted vsync for the *next* frame is used instead. nsecs_t getExpectedPresentTime(); void populateExpectedPresentTime(); nsecs_t getExpectedPresentTime() const { return mExpectedPresentTime; } // for debugging only // TODO: this should be made accessible only to HWComposer Loading Loading @@ -1184,6 +1185,8 @@ private: // Flags to capture the state of Vsync in HWC HWC2::Vsync mHWCVsyncState = HWC2::Vsync::Disable; HWC2::Vsync mHWCVsyncPendingState = HWC2::Vsync::Disable; nsecs_t mExpectedPresentTime; }; } // namespace android Loading
services/surfaceflinger/SurfaceFlinger.cpp +7 −3 Original line number Diff line number Diff line Loading @@ -1688,22 +1688,26 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); } nsecs_t SurfaceFlinger::getExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { DisplayStatInfo stats; mScheduler->getDisplayStatInfo(&stats); const nsecs_t presentTime = mScheduler->getDispSyncExpectedPresentTime(); // Inflate the expected present time if we're targetting the next vsync. const nsecs_t correctedTime = mExpectedPresentTime = mVsyncModulator.getOffsets().sf < mPhaseOffsets->getOffsetThresholdForNextVsync() ? presentTime : presentTime + stats.vsyncPeriod; return correctedTime; } void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { ATRACE_CALL(); switch (what) { case MessageQueue::INVALIDATE: { // calculate the expected present time once and use the cached // value throughout this frame to make sure all layers are // seeing this same value. populateExpectedPresentTime(); bool frameMissed = previousFrameMissed(); bool hwcFrameMissed = mHadDeviceComposition && frameMissed; bool gpuFrameMissed = mHadClientComposition && frameMissed; Loading
services/surfaceflinger/SurfaceFlinger.h +5 −2 Original line number Diff line number Diff line Loading @@ -301,10 +301,11 @@ public: // TODO: this should be made accessible only to MessageQueue void onMessageReceived(int32_t what); // Returns the expected present time for this frame. // populates the expected present time for this frame. // When we are in negative offsets, we perform a correction so that the // predicted vsync for the *next* frame is used instead. nsecs_t getExpectedPresentTime(); void populateExpectedPresentTime(); nsecs_t getExpectedPresentTime() const { return mExpectedPresentTime; } // for debugging only // TODO: this should be made accessible only to HWComposer Loading Loading @@ -1184,6 +1185,8 @@ private: // Flags to capture the state of Vsync in HWC HWC2::Vsync mHWCVsyncState = HWC2::Vsync::Disable; HWC2::Vsync mHWCVsyncPendingState = HWC2::Vsync::Disable; nsecs_t mExpectedPresentTime; }; } // namespace android