Remove hwcDuration from FrameTimeline
We added hwcDuration previously to give some fixed threshold for
composer. However, this isn't accurate or useful since the calls to
client composition are not blocking on the GPU and hence a fixed
duration threshold will not work there. Instead, we will consider the
end time for SF as the time postComposition is called. This removes any
ambiguity and just takes the whole CPU time (excluding postComposition)
that SF ran for the frame.
Bug: 169876734
Test: libsurfaceflinger_unittest
Change-Id: I0e8f0b15f82d8baa884db5e9177c5696257fe11f
diff --git a/services/surfaceflinger/FrameTimeline/FrameTimeline.h b/services/surfaceflinger/FrameTimeline/FrameTimeline.h
index 3f04592..373216b 100644
--- a/services/surfaceflinger/FrameTimeline/FrameTimeline.h
+++ b/services/surfaceflinger/FrameTimeline/FrameTimeline.h
@@ -355,7 +355,7 @@
class DisplayFrame {
public:
DisplayFrame(std::shared_ptr<TimeStats> timeStats, JankClassificationThresholds thresholds,
- nsecs_t hwcDuration, TraceCookieCounter* traceCookieCounter);
+ TraceCookieCounter* traceCookieCounter);
virtual ~DisplayFrame() = default;
// Dumpsys interface - dumps only if the DisplayFrame itself is janky or is at least one
// SurfaceFrame is janky.
@@ -410,7 +410,6 @@
TimelineItem mSurfaceFlingerActuals;
std::shared_ptr<TimeStats> mTimeStats;
const JankClassificationThresholds mJankClassificationThresholds;
- const nsecs_t mHwcDuration;
// Collection of predictions and actual values sent over by Layers
std::vector<std::shared_ptr<SurfaceFrame>> mSurfaceFrames;
@@ -436,8 +435,7 @@
};
FrameTimeline(std::shared_ptr<TimeStats> timeStats, pid_t surfaceFlingerPid,
- JankClassificationThresholds thresholds = {},
- nsecs_t hwcDuration = kDefaultHwcDuration);
+ JankClassificationThresholds thresholds = {});
~FrameTimeline() = default;
frametimeline::TokenManager* getTokenManager() override { return &mTokenManager; }
@@ -482,11 +480,6 @@
std::shared_ptr<TimeStats> mTimeStats;
const pid_t mSurfaceFlingerPid;
const JankClassificationThresholds mJankClassificationThresholds;
- // In SF Predictions, both end & present are the same. The predictions consider the time used by
- // composer as well, but we have no way to estimate how much time the composer needs. We are
- // assuming an arbitrary time for the composer work.
- const nsecs_t mHwcDuration;
- static constexpr nsecs_t kDefaultHwcDuration = std::chrono::nanoseconds(3ms).count();
static constexpr uint32_t kDefaultMaxDisplayFrames = 64;
// The initial container size for the vector<SurfaceFrames> inside display frame. Although
// this number doesn't represent any bounds on the number of surface frames that can go in a