diff options
author | Dan Stoza <stoza@google.com> | 2015-08-05 19:02:53 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2015-08-05 19:02:53 +0000 |
commit | 2121b93725bb1eb3e2bae79d645d59009c8df259 (patch) | |
tree | b0c5817631ab0327b500127d4e537bb3968267f5 | |
parent | da7645d6aba7c56b70c4b854685baf421a0c40f0 (diff) | |
parent | 04eeb2882567412cdcec5981b50c9e7c024b03cc (diff) | |
download | frameworks_native-2121b93725bb1eb3e2bae79d645d59009c8df259.zip frameworks_native-2121b93725bb1eb3e2bae79d645d59009c8df259.tar.gz frameworks_native-2121b93725bb1eb3e2bae79d645d59009c8df259.tar.bz2 |
am 04eeb288: am 50be1df7: Merge "SF: Track missed frames and optionally drop them" into mnc-dr-dev
* commit '04eeb2882567412cdcec5981b50c9e7c024b03cc':
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 9b9867d..01ffac2 100644 --- a/services/surfaceflinger/SurfaceFlinger.cpp +++ b/services/surfaceflinger/SurfaceFlinger.cpp @@ -163,6 +163,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); @@ -919,12 +922,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 3759a92..b3baadd 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; |