am 50be1df7: Merge "SF: Track missed frames and optionally drop them" into mnc-dr-dev

* commit '50be1df76e2c84fc3c893ec3d3e51ba427dd3ee6':
  SF: Track missed frames and optionally drop them
This commit is contained in:
Dan Stoza 2015-08-05 18:55:39 +00:00 committed by Android Git Automerger
commit 04eeb28825
2 changed files with 29 additions and 6 deletions

View File

@ -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()

View File

@ -445,6 +445,7 @@ private:
RenderEngine* mRenderEngine;
nsecs_t mBootTime;
bool mGpuToCpuSupported;
bool mDropMissedFrames;
sp<EventThread> mEventThread;
sp<EventThread> mSFEventThread;
sp<EventControlThread> mEventControlThread;