Loading services/surfaceflinger/SurfaceFlinger.cpp +20 −3 Original line number Original line Diff line number Diff line Loading @@ -1681,7 +1681,8 @@ void SurfaceFlinger::updateVrFlinger() { setTransactionFlags(eDisplayTransactionNeeded); setTransactionFlags(eDisplayTransactionNeeded); } } bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { bool SurfaceFlinger::previousFrameMissed(int graceTimeMs) NO_THREAD_SAFETY_ANALYSIS { ATRACE_CALL(); // We are storing the last 2 present fences. If sf's phase offset is to be // We are storing the last 2 present fences. If sf's phase offset is to be // woken up before the actual vsync but targeting the next vsync, we need to check // woken up before the actual vsync but targeting the next vsync, we need to check // fence N-2 // fence N-2 Loading @@ -1690,7 +1691,15 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { ? mPreviousPresentFences[0] ? mPreviousPresentFences[0] : mPreviousPresentFences[1]; : mPreviousPresentFences[1]; return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); if (fence == Fence::NO_FENCE) { return false; } if (graceTimeMs > 0 && fence->getStatus() == Fence::Status::Unsignaled) { fence->wait(graceTimeMs); } return (fence->getStatus() == Fence::Status::Unsignaled); } } void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { Loading @@ -1713,7 +1722,15 @@ void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { // seeing this same value. // seeing this same value. populateExpectedPresentTime(); populateExpectedPresentTime(); bool frameMissed = previousFrameMissed(); // When Backpressure propagation is enabled we want to give a small grace period // for the present fence to fire instead of just giving up on this frame to handle cases // where present fence is just about to get signaled. const int graceTimeForPresentFenceMs = (mPropagateBackpressure && (mPropagateBackpressureClientComposition || !mHadClientComposition)) ? 1 : 0; bool frameMissed = previousFrameMissed(graceTimeForPresentFenceMs); bool hwcFrameMissed = mHadDeviceComposition && frameMissed; bool hwcFrameMissed = mHadDeviceComposition && frameMissed; bool gpuFrameMissed = mHadClientComposition && frameMissed; bool gpuFrameMissed = mHadClientComposition && frameMissed; ATRACE_INT("FrameMissed", static_cast<int>(frameMissed)); ATRACE_INT("FrameMissed", static_cast<int>(frameMissed)); Loading services/surfaceflinger/SurfaceFlinger.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -851,7 +851,7 @@ private: return hwcDisplayId ? getHwComposer().toPhysicalDisplayId(*hwcDisplayId) : std::nullopt; return hwcDisplayId ? getHwComposer().toPhysicalDisplayId(*hwcDisplayId) : std::nullopt; } } bool previousFrameMissed(); bool previousFrameMissed(int graceTimeMs = 0); void setVsyncEnabledInHWC(DisplayId displayId, HWC2::Vsync enabled); void setVsyncEnabledInHWC(DisplayId displayId, HWC2::Vsync enabled); /* /* Loading Loading
services/surfaceflinger/SurfaceFlinger.cpp +20 −3 Original line number Original line Diff line number Diff line Loading @@ -1681,7 +1681,8 @@ void SurfaceFlinger::updateVrFlinger() { setTransactionFlags(eDisplayTransactionNeeded); setTransactionFlags(eDisplayTransactionNeeded); } } bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { bool SurfaceFlinger::previousFrameMissed(int graceTimeMs) NO_THREAD_SAFETY_ANALYSIS { ATRACE_CALL(); // We are storing the last 2 present fences. If sf's phase offset is to be // We are storing the last 2 present fences. If sf's phase offset is to be // woken up before the actual vsync but targeting the next vsync, we need to check // woken up before the actual vsync but targeting the next vsync, we need to check // fence N-2 // fence N-2 Loading @@ -1690,7 +1691,15 @@ bool SurfaceFlinger::previousFrameMissed() NO_THREAD_SAFETY_ANALYSIS { ? mPreviousPresentFences[0] ? mPreviousPresentFences[0] : mPreviousPresentFences[1]; : mPreviousPresentFences[1]; return fence != Fence::NO_FENCE && (fence->getStatus() == Fence::Status::Unsignaled); if (fence == Fence::NO_FENCE) { return false; } if (graceTimeMs > 0 && fence->getStatus() == Fence::Status::Unsignaled) { fence->wait(graceTimeMs); } return (fence->getStatus() == Fence::Status::Unsignaled); } } void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { void SurfaceFlinger::populateExpectedPresentTime() NO_THREAD_SAFETY_ANALYSIS { Loading @@ -1713,7 +1722,15 @@ void SurfaceFlinger::onMessageReceived(int32_t what) NO_THREAD_SAFETY_ANALYSIS { // seeing this same value. // seeing this same value. populateExpectedPresentTime(); populateExpectedPresentTime(); bool frameMissed = previousFrameMissed(); // When Backpressure propagation is enabled we want to give a small grace period // for the present fence to fire instead of just giving up on this frame to handle cases // where present fence is just about to get signaled. const int graceTimeForPresentFenceMs = (mPropagateBackpressure && (mPropagateBackpressureClientComposition || !mHadClientComposition)) ? 1 : 0; bool frameMissed = previousFrameMissed(graceTimeForPresentFenceMs); bool hwcFrameMissed = mHadDeviceComposition && frameMissed; bool hwcFrameMissed = mHadDeviceComposition && frameMissed; bool gpuFrameMissed = mHadClientComposition && frameMissed; bool gpuFrameMissed = mHadClientComposition && frameMissed; ATRACE_INT("FrameMissed", static_cast<int>(frameMissed)); ATRACE_INT("FrameMissed", static_cast<int>(frameMissed)); Loading
services/surfaceflinger/SurfaceFlinger.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -851,7 +851,7 @@ private: return hwcDisplayId ? getHwComposer().toPhysicalDisplayId(*hwcDisplayId) : std::nullopt; return hwcDisplayId ? getHwComposer().toPhysicalDisplayId(*hwcDisplayId) : std::nullopt; } } bool previousFrameMissed(); bool previousFrameMissed(int graceTimeMs = 0); void setVsyncEnabledInHWC(DisplayId displayId, HWC2::Vsync enabled); void setVsyncEnabledInHWC(DisplayId displayId, HWC2::Vsync enabled); /* /* Loading