diff options
author | 2015-08-05 20:36:29 +0000 | |
---|---|---|
committer | 2015-08-05 20:36:29 +0000 | |
commit | 47b11d38b3ce686bf5feeccb5e151f4542a7c301 (patch) | |
tree | 22f54512f21690736519c256d9a0d63e2801af2b | |
parent | 7d226163cd03a455f8dd1133f6448826072f071d (diff) | |
parent | bc120be8d7ff639408048fc3f105abd0aa6cfbe2 (diff) |
am bc120be8: am 2121b937: am 04eeb288: am 50be1df7: Merge "SF: Track missed frames and optionally drop them" into mnc-dr-dev
* commit 'bc120be8d7ff639408048fc3f105abd0aa6cfbe2':
SF: Track missed frames and optionally drop them
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.cpp | 34 | ||||
-rw-r--r-- | services/surfaceflinger/SurfaceFlinger.h | 1 |
2 files changed, 29 insertions, 6 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp index 6798a87ad9..f74f599e32 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -164,6 +164,9 @@ SurfaceFlinger::SurfaceFlinger() property_get("ro.bq.gpu_to_cpu_unsupported", value, "0"); mGpuToCpuSupported = !atoi(value); + property_get("debug.sf.drop_missed_frames", value, "0"); + mDropMissedFrames = atoi(value); + property_get("debug.sf.showupdates", value, "0"); mDebugRegion = atoi(value); @@ -924,12 +927,31 @@ bool SurfaceFlinger::handleMessageInvalidate() { void SurfaceFlinger::handleMessageRefresh() { ATRACE_CALL(); - preComposition(); - rebuildLayerStacks(); - setUpHWComposer(); - doDebugFlashRegions(); - doComposition(); - postComposition(); + + static nsecs_t previousExpectedPresent = 0; + nsecs_t expectedPresent = mPrimaryDispSync.computeNextRefresh(0); + static bool previousFrameMissed = false; + bool frameMissed = (expectedPresent == previousExpectedPresent); + if (frameMissed != previousFrameMissed) { + ATRACE_INT("FrameMissed", static_cast<int>(frameMissed)); + } + previousFrameMissed = frameMissed; + + if (CC_UNLIKELY(mDropMissedFrames && frameMissed)) { + // Latch buffers, but don't send anything to HWC, then signal another + // wakeup for the next vsync + preComposition(); + repaintEverything(); + } else { + preComposition(); + rebuildLayerStacks(); + setUpHWComposer(); + doDebugFlashRegions(); + doComposition(); + postComposition(); + } + + previousExpectedPresent = mPrimaryDispSync.computeNextRefresh(0); } void SurfaceFlinger::doDebugFlashRegions() diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h index 3759a92400..b3baadd46b 100644 --- a/services/surfaceflinger/SurfaceFlinger.h +++ b/services/surfaceflinger/SurfaceFlinger.h @@ -445,6 +445,7 @@ private: RenderEngine* mRenderEngine; nsecs_t mBootTime; bool mGpuToCpuSupported; + bool mDropMissedFrames; sp<EventThread> mEventThread; sp<EventThread> mSFEventThread; sp<EventControlThread> mEventControlThread; |