Change hwui jank detection to use deadline & gpu completion (2/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: Ia1cae9f0c5358d1cd3bf043289ea8b4d26154737
diff --git a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
index 7cc0032..b4a1481 100644
--- a/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
+++ b/services/surfaceflinger/tests/unittests/EventThreadTest.cpp
@@ -44,7 +44,7 @@
constexpr PhysicalDisplayId INTERNAL_DISPLAY_ID(111);
constexpr PhysicalDisplayId EXTERNAL_DISPLAY_ID(222);
constexpr PhysicalDisplayId DISPLAY_ID_64BIT(0xabcd12349876fedcULL);
-
+constexpr std::chrono::duration VSYNC_PERIOD(16ms);
class MockVSyncSource : public VSyncSource {
public:
const char* getName() const override { return "test"; }
@@ -166,11 +166,14 @@
mThrottleVsyncCallRecorder.getInvocable()(expectedVsyncTimestamp, uid);
return (uid == mThrottledConnectionUid);
};
+ const auto getVsyncPeriod = [](uid_t uid) {
+ return VSYNC_PERIOD.count();
+ };
mThread = std::make_unique<impl::EventThread>(std::move(source),
/*tokenManager=*/nullptr,
mInterceptVSyncCallRecorder.getInvocable(),
- throttleVsync);
+ throttleVsync, getVsyncPeriod);
// EventThread should register itself as VSyncSource callback.
mCallback = expectVSyncSetCallbackCallReceived();