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
diff --git a/libs/hwui/FrameInfo.h b/libs/hwui/FrameInfo.h
index 62ac4ca..2a134fa 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 @@
DrawStart,
FrameDeadline,
FrameStartTime,
+ FrameInterval,
// End of UI frame info
SyncQueued,
@@ -77,6 +78,9 @@
class UiFrameInfoBuilder {
public:
static constexpr int64_t INVALID_VSYNC_ID = -1;
+ static constexpr int64_t UNKNOWN_DEADLINE = std::numeric_limits<int64_t>::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 @@
}
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 @@
set(FrameInfoIndex::PerformTraversalsStart) = vsyncTime;
set(FrameInfoIndex::DrawStart) = vsyncTime;
set(FrameInfoIndex::FrameDeadline) = frameDeadline;
+ set(FrameInfoIndex::FrameInterval) = frameInterval;
return *this;
}