Loading services/surfaceflinger/BufferLayer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -355,6 +355,13 @@ bool BufferLayer::onPostComposition(const DisplayDevice* display, mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber, clientCompositionTimestamp, FrameTracer::FrameEvent::FALLBACK_COMPOSITION); // Update the SurfaceFrames in the drawing state if (mDrawingState.bufferSurfaceFrameTX) { mDrawingState.bufferSurfaceFrameTX->setGpuComposition(); } for (auto& [token, surfaceFrame] : mDrawingState.bufferlessSurfaceFramesTX) { surfaceFrame->setGpuComposition(); } } std::shared_ptr<FenceTime> frameReadyFence = mBufferInfo.mFenceTime; Loading services/surfaceflinger/BufferStateLayer.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -692,7 +692,6 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse // are processing the next state. addSurfaceFramePresentedForBuffer(bufferSurfaceFrame, mDrawingState.acquireFence->getSignalTime(), latchTime); bufferSurfaceFrame.reset(); } mCurrentStateModified = false; Loading services/surfaceflinger/FrameTimeline/FrameTimeline.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -348,6 +348,11 @@ void SurfaceFrame::setRenderRate(Fps renderRate) { mRenderRate = renderRate; } void SurfaceFrame::setGpuComposition() { std::scoped_lock lock(mMutex); mGpuComposition = true; } std::optional<int32_t> SurfaceFrame::getJankType() const { std::scoped_lock lock(mMutex); if (mPresentState == PresentState::Dropped) { Loading Loading @@ -828,10 +833,14 @@ void FrameTimeline::setSfWakeUp(int64_t token, nsecs_t wakeUpTime, Fps refreshRa } void FrameTimeline::setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence) { const std::shared_ptr<FenceTime>& presentFence, bool gpuComposition) { ATRACE_CALL(); std::scoped_lock lock(mMutex); mCurrentDisplayFrame->setActualEndTime(sfPresentTime); if (gpuComposition) { mCurrentDisplayFrame->setGpuComposition(); } mPendingPresentFences.emplace_back(std::make_pair(presentFence, mCurrentDisplayFrame)); flushPendingPresentFences(); finalizeCurrentDisplayFrame(); Loading Loading @@ -869,6 +878,10 @@ void FrameTimeline::DisplayFrame::setActualEndTime(nsecs_t actualEndTime) { mSurfaceFlingerActuals.endTime = actualEndTime; } void FrameTimeline::DisplayFrame::setGpuComposition() { mGpuComposition = true; } void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t& deltaToVsync) { if (mPredictionState == PredictionState::Expired || mSurfaceFlingerActuals.presentTime == Fence::SIGNAL_TIME_INVALID) { Loading services/surfaceflinger/FrameTimeline/FrameTimeline.h +9 −7 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ public: void setDropTime(nsecs_t dropTime); void setPresentState(PresentState presentState, nsecs_t lastLatchTime = 0); void setRenderRate(Fps renderRate); void setGpuComposition(); // When a bufferless SurfaceFrame is promoted to a buffer SurfaceFrame, we also have to update // isBuffer. Loading Loading @@ -292,11 +293,11 @@ public: // the token and sets the actualSfWakeTime for the current DisplayFrame. virtual void setSfWakeUp(int64_t token, nsecs_t wakeupTime, Fps refreshRate) = 0; // Sets the sfPresentTime and finalizes the current DisplayFrame. Tracks the given present fence // until it's signaled, and updates the present timestamps of all presented SurfaceFrames in // that vsync. virtual void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence) = 0; // Sets the sfPresentTime, gpuComposition and finalizes the current DisplayFrame. Tracks the // given present fence until it's signaled, and updates the present timestamps of all presented // SurfaceFrames in that vsync. virtual void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence, bool gpuComposition) = 0; // Args: // -jank : Dumps only the Display Frames that are either janky themselves Loading Loading @@ -375,6 +376,7 @@ public: void setPredictions(PredictionState predictionState, TimelineItem predictions); void setActualStartTime(nsecs_t actualStartTime); void setActualEndTime(nsecs_t actualEndTime); void setGpuComposition(); // BaseTime is the smallest timestamp in a DisplayFrame. // Used for dumping all timestamps relative to the oldest, making it easy to read. Loading Loading @@ -444,8 +446,8 @@ public: int32_t layerId, std::string layerName, std::string debugName, bool isBuffer) override; void addSurfaceFrame(std::shared_ptr<frametimeline::SurfaceFrame> surfaceFrame) override; void setSfWakeUp(int64_t token, nsecs_t wakeupTime, Fps refreshRate) override; void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence) override; void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence, bool gpuComposition = false) override; void parseArgs(const Vector<String16>& args, std::string& result) override; void setMaxDisplayFrames(uint32_t size) override; float computeFps(const std::unordered_set<int32_t>& layerIds) override; Loading services/surfaceflinger/SurfaceFlinger.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -2111,7 +2111,8 @@ void SurfaceFlinger::postComposition() { // information from previous' frame classification is already available when sending jank info // to clients, so they get jank classification as early as possible. mFrameTimeline->setSfPresent(systemTime(), std::make_shared<FenceTime>(mPreviousPresentFences[0])); std::make_shared<FenceTime>(mPreviousPresentFences[0]), glCompositionDoneFenceTime != FenceTime::NO_FENCE); nsecs_t dequeueReadyTime = systemTime(); for (const auto& layer : mLayersWithQueuedFrames) { Loading Loading
services/surfaceflinger/BufferLayer.cpp +7 −0 Original line number Diff line number Diff line Loading @@ -355,6 +355,13 @@ bool BufferLayer::onPostComposition(const DisplayDevice* display, mFlinger->mFrameTracer->traceTimestamp(layerId, getCurrentBufferId(), mCurrentFrameNumber, clientCompositionTimestamp, FrameTracer::FrameEvent::FALLBACK_COMPOSITION); // Update the SurfaceFrames in the drawing state if (mDrawingState.bufferSurfaceFrameTX) { mDrawingState.bufferSurfaceFrameTX->setGpuComposition(); } for (auto& [token, surfaceFrame] : mDrawingState.bufferlessSurfaceFramesTX) { surfaceFrame->setGpuComposition(); } } std::shared_ptr<FenceTime> frameReadyFence = mBufferInfo.mFenceTime; Loading
services/surfaceflinger/BufferStateLayer.cpp +0 −1 Original line number Diff line number Diff line Loading @@ -692,7 +692,6 @@ status_t BufferStateLayer::updateTexImage(bool& /*recomputeVisibleRegions*/, nse // are processing the next state. addSurfaceFramePresentedForBuffer(bufferSurfaceFrame, mDrawingState.acquireFence->getSignalTime(), latchTime); bufferSurfaceFrame.reset(); } mCurrentStateModified = false; Loading
services/surfaceflinger/FrameTimeline/FrameTimeline.cpp +14 −1 Original line number Diff line number Diff line Loading @@ -348,6 +348,11 @@ void SurfaceFrame::setRenderRate(Fps renderRate) { mRenderRate = renderRate; } void SurfaceFrame::setGpuComposition() { std::scoped_lock lock(mMutex); mGpuComposition = true; } std::optional<int32_t> SurfaceFrame::getJankType() const { std::scoped_lock lock(mMutex); if (mPresentState == PresentState::Dropped) { Loading Loading @@ -828,10 +833,14 @@ void FrameTimeline::setSfWakeUp(int64_t token, nsecs_t wakeUpTime, Fps refreshRa } void FrameTimeline::setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence) { const std::shared_ptr<FenceTime>& presentFence, bool gpuComposition) { ATRACE_CALL(); std::scoped_lock lock(mMutex); mCurrentDisplayFrame->setActualEndTime(sfPresentTime); if (gpuComposition) { mCurrentDisplayFrame->setGpuComposition(); } mPendingPresentFences.emplace_back(std::make_pair(presentFence, mCurrentDisplayFrame)); flushPendingPresentFences(); finalizeCurrentDisplayFrame(); Loading Loading @@ -869,6 +878,10 @@ void FrameTimeline::DisplayFrame::setActualEndTime(nsecs_t actualEndTime) { mSurfaceFlingerActuals.endTime = actualEndTime; } void FrameTimeline::DisplayFrame::setGpuComposition() { mGpuComposition = true; } void FrameTimeline::DisplayFrame::classifyJank(nsecs_t& deadlineDelta, nsecs_t& deltaToVsync) { if (mPredictionState == PredictionState::Expired || mSurfaceFlingerActuals.presentTime == Fence::SIGNAL_TIME_INVALID) { Loading
services/surfaceflinger/FrameTimeline/FrameTimeline.h +9 −7 Original line number Diff line number Diff line Loading @@ -180,6 +180,7 @@ public: void setDropTime(nsecs_t dropTime); void setPresentState(PresentState presentState, nsecs_t lastLatchTime = 0); void setRenderRate(Fps renderRate); void setGpuComposition(); // When a bufferless SurfaceFrame is promoted to a buffer SurfaceFrame, we also have to update // isBuffer. Loading Loading @@ -292,11 +293,11 @@ public: // the token and sets the actualSfWakeTime for the current DisplayFrame. virtual void setSfWakeUp(int64_t token, nsecs_t wakeupTime, Fps refreshRate) = 0; // Sets the sfPresentTime and finalizes the current DisplayFrame. Tracks the given present fence // until it's signaled, and updates the present timestamps of all presented SurfaceFrames in // that vsync. virtual void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence) = 0; // Sets the sfPresentTime, gpuComposition and finalizes the current DisplayFrame. Tracks the // given present fence until it's signaled, and updates the present timestamps of all presented // SurfaceFrames in that vsync. virtual void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence, bool gpuComposition) = 0; // Args: // -jank : Dumps only the Display Frames that are either janky themselves Loading Loading @@ -375,6 +376,7 @@ public: void setPredictions(PredictionState predictionState, TimelineItem predictions); void setActualStartTime(nsecs_t actualStartTime); void setActualEndTime(nsecs_t actualEndTime); void setGpuComposition(); // BaseTime is the smallest timestamp in a DisplayFrame. // Used for dumping all timestamps relative to the oldest, making it easy to read. Loading Loading @@ -444,8 +446,8 @@ public: int32_t layerId, std::string layerName, std::string debugName, bool isBuffer) override; void addSurfaceFrame(std::shared_ptr<frametimeline::SurfaceFrame> surfaceFrame) override; void setSfWakeUp(int64_t token, nsecs_t wakeupTime, Fps refreshRate) override; void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence) override; void setSfPresent(nsecs_t sfPresentTime, const std::shared_ptr<FenceTime>& presentFence, bool gpuComposition = false) override; void parseArgs(const Vector<String16>& args, std::string& result) override; void setMaxDisplayFrames(uint32_t size) override; float computeFps(const std::unordered_set<int32_t>& layerIds) override; Loading
services/surfaceflinger/SurfaceFlinger.cpp +2 −1 Original line number Diff line number Diff line Loading @@ -2111,7 +2111,8 @@ void SurfaceFlinger::postComposition() { // information from previous' frame classification is already available when sending jank info // to clients, so they get jank classification as early as possible. mFrameTimeline->setSfPresent(systemTime(), std::make_shared<FenceTime>(mPreviousPresentFences[0])); std::make_shared<FenceTime>(mPreviousPresentFences[0]), glCompositionDoneFenceTime != FenceTime::NO_FENCE); nsecs_t dequeueReadyTime = systemTime(); for (const auto& layer : mLayersWithQueuedFrames) { Loading