From 10f328c580fe1e897b51a7e4b38ee4c341d970f1 Mon Sep 17 00:00:00 2001 From: Jorim Jaggi Date: Tue, 19 Jan 2021 00:08:02 +0100 Subject: 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 --- libs/hwui/FrameInfo.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'libs/hwui/FrameInfo.h') diff --git a/libs/hwui/FrameInfo.h b/libs/hwui/FrameInfo.h index 62ac4ca5fdad..2a134fa214e7 100644 --- a/libs/hwui/FrameInfo.h +++ b/libs/hwui/FrameInfo.h @@ -28,7 +28,7 @@ namespace android { namespace uirenderer { -static constexpr size_t UI_THREAD_FRAME_INFO_SIZE = 11; +static constexpr size_t UI_THREAD_FRAME_INFO_SIZE = 12; enum class FrameInfoIndex { Flags = 0, @@ -42,6 +42,7 @@ enum class FrameInfoIndex { DrawStart, FrameDeadline, FrameStartTime, + FrameInterval, // End of UI frame info SyncQueued, @@ -77,6 +78,9 @@ enum { class UiFrameInfoBuilder { public: static constexpr int64_t INVALID_VSYNC_ID = -1; + static constexpr int64_t UNKNOWN_DEADLINE = std::numeric_limits::max(); + static constexpr int64_t UNKNOWN_FRAME_INTERVAL = -1; + explicit UiFrameInfoBuilder(int64_t* buffer) : mBuffer(buffer) { memset(mBuffer, 0, UI_THREAD_FRAME_INFO_SIZE * sizeof(int64_t)); @@ -89,7 +93,7 @@ public: } UiFrameInfoBuilder& setVsync(nsecs_t vsyncTime, nsecs_t intendedVsync, - int64_t vsyncId, int64_t frameDeadline) { + int64_t vsyncId, int64_t frameDeadline, nsecs_t frameInterval) { set(FrameInfoIndex::FrameTimelineVsyncId) = vsyncId; set(FrameInfoIndex::Vsync) = vsyncTime; set(FrameInfoIndex::IntendedVsync) = intendedVsync; @@ -100,6 +104,7 @@ public: set(FrameInfoIndex::PerformTraversalsStart) = vsyncTime; set(FrameInfoIndex::DrawStart) = vsyncTime; set(FrameInfoIndex::FrameDeadline) = frameDeadline; + set(FrameInfoIndex::FrameInterval) = frameInterval; return *this; } -- cgit v1.2.3-59-g8ed1b