From 84be783ff179fd6589bd01091f08f174f1f6a95d Mon Sep 17 00:00:00 2001 From: John Dias Date: Tue, 18 Jun 2019 17:05:26 -0700 Subject: SF: delay region sampling when short on time In a number of janky traces, particularly at high frame rates, we've seen the surfaceflinger thread overrunning its time slot. In some of those cases, the surfaceflinger thread is doing region-sampling. This change causes region-sampling to check how much time is left until the next vsync before deciding whether to sample this frame. If low on time, it will defer the sampling to a later frame. Bug: 133779857 Test: trace inspection from scrolling in various apps Change-Id: I92c2368e80033c1ba6e27f947a456d14db02064c --- services/surfaceflinger/RegionSamplingThread.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'services/surfaceflinger/RegionSamplingThread.h') diff --git a/services/surfaceflinger/RegionSamplingThread.h b/services/surfaceflinger/RegionSamplingThread.h index 3c6fcf3872..96ffe207e4 100644 --- a/services/surfaceflinger/RegionSamplingThread.h +++ b/services/surfaceflinger/RegionSamplingThread.h @@ -117,7 +117,7 @@ private: std::condition_variable_any mCondition; bool mRunning GUARDED_BY(mThreadControlMutex) = true; bool mSampleRequested GUARDED_BY(mThreadControlMutex) = false; - bool mDiscardedFrames GUARDED_BY(mThreadControlMutex) = false; + uint32_t mDiscardedFrames GUARDED_BY(mThreadControlMutex) = 0; std::chrono::nanoseconds lastSampleTime GUARDED_BY(mThreadControlMutex); std::mutex mSamplingMutex; -- cgit v1.2.3-59-g8ed1b