diff options
author | Jorim Jaggi <jjaggi@google.com> | 2021-01-19 00:08:02 +0100 |
---|---|---|
committer | Jorim Jaggi <jjaggi@google.com> | 2021-04-13 15:18:27 +0000 |
commit | 10f328c580fe1e897b51a7e4b38ee4c341d970f1 (patch) | |
tree | b5719df2aa8460ef2925440e72ecec07020557b1 /libs/hwui/JankTracker.h | |
parent | a373e1ed5a59997b2cc8ac86615963d8597e4a2b (diff) |
Change hwui jank detection to use deadline & gpu completion (1/2)
- Use GPU finish time as well as actual deadline to determine jank
rate.
- Use dynamic interval to adjust for 60/90hz switching
- Move frame metrics reporting into JankTracker to adjust the
deadline communicated to the app when in stuffing scenario.
- Adjust double-stuffing detection to be a bit more readable.
Test: GraphicsStatsValidationTest.java
Test: adb shell dumpsys gfxinfo
Test: FrameMetricsListenerTest
Test: Log output of FrameMetricsObserver
Bug: 169858044
Change-Id: I3a6b8ed163e2cf9cf2b67667110340ebe35f98a1
Diffstat (limited to 'libs/hwui/JankTracker.h')
-rw-r--r-- | libs/hwui/JankTracker.h | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/libs/hwui/JankTracker.h b/libs/hwui/JankTracker.h index 096455372923..0d2574cb8640 100644 --- a/libs/hwui/JankTracker.h +++ b/libs/hwui/JankTracker.h @@ -17,6 +17,7 @@ #define JANKTRACKER_H_ #include "FrameInfo.h" +#include "FrameMetricsReporter.h" #include "ProfileData.h" #include "ProfileDataContainer.h" #include "renderthread/TimeLord.h" @@ -56,9 +57,11 @@ public: } FrameInfo* startFrame() { return &mFrames.next(); } - void finishFrame(const FrameInfo& frame); - void finishGpuDraw(const FrameInfo& frame); + void finishFrame(FrameInfo& frame, std::unique_ptr<FrameMetricsReporter>& reporter); + // Calculates the 'legacy' jank information, i.e. with outdated refresh rate information and + // without GPU completion or deadlined information. + void calculateLegacyJank(FrameInfo& frame); void dumpStats(int fd) { dumpData(fd, &mDescription, mData.get()); } void dumpFrames(int fd); void reset(); @@ -68,14 +71,16 @@ public: RingBuffer<FrameInfo, 120>& frames() { return mFrames; } private: - void setFrameInterval(nsecs_t frameIntervalNanos); - + void recomputeThresholds(int64_t frameInterval); static void dumpData(int fd, const ProfileDataDescription* description, const ProfileData* data); - std::array<int64_t, NUM_BUCKETS> mThresholds; - int64_t mFrameInterval; - nsecs_t mSwapDeadline = -1; + // Last frame budget for which mThresholds were computed. + int64_t mThresholdsFrameBudget GUARDED_BY(mDataMutex); + std::array<int64_t, NUM_BUCKETS> mThresholds GUARDED_BY(mDataMutex); + + int64_t mFrameIntervalLegacy; + nsecs_t mSwapDeadlineLegacy = -1; // The amount of time we will erase from the total duration to account // for SF vsync offsets with HWC2 blocking dequeueBuffers. // (Vsync + mDequeueBlockTolerance) is the point at which we expect @@ -83,7 +88,9 @@ private: // point in time by comparing to (IssueDrawCommandsStart + DequeueDuration) // This is only used if we are in pipelined mode and are using HWC2, // otherwise it's 0. - nsecs_t mDequeueTimeForgiveness = 0; + nsecs_t mDequeueTimeForgivenessLegacy = 0; + + nsecs_t mNextFrameStartUnstuffed GUARDED_BY(mDataMutex) = -1; ProfileDataContainer mData GUARDED_BY(mDataMutex); ProfileDataContainer* mGlobalData GUARDED_BY(mDataMutex); ProfileDataDescription mDescription; |