Merge "SF TimeStats: fix missed frame logic" into pi-dev am: fbcca043cf
am: f54bed5d70

Change-Id: Ia92110c169292ba6c8af8ebb5f5910897702a5f3
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index c4a1191..669fb45 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1459,13 +1459,12 @@
                     (mPreviousPresentFence->getSignalTime() ==
                             Fence::SIGNAL_TIME_PENDING);
             ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
-            if (mPropagateBackpressure && frameMissed) {
-                mTimeStats.incrementMissedFrames(true);
-                signalLayerUpdate();
-                break;
-            }
             if (frameMissed) {
-                mTimeStats.incrementMissedFrames(false);
+                mTimeStats.incrementMissedFrames();
+                if (mPropagateBackpressure) {
+                    signalLayerUpdate();
+                    break;
+                }
             }
 
             // Now that we're going to make it to the handleMessageTransaction()
diff --git a/services/surfaceflinger/TimeStats/TimeStats.cpp b/services/surfaceflinger/TimeStats/TimeStats.cpp
index 5f2dd32..a6833a5 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.cpp
+++ b/services/surfaceflinger/TimeStats/TimeStats.cpp
@@ -87,15 +87,12 @@
     timeStats.totalFrames++;
 }
 
-void TimeStats::incrementMissedFrames(bool propagateBackpressure) {
+void TimeStats::incrementMissedFrames() {
     if (!mEnabled.load()) return;
 
     ATRACE_CALL();
 
     std::lock_guard<std::mutex> lock(mMutex);
-    if (propagateBackpressure) {
-        timeStats.totalFrames--;
-    }
     timeStats.missedFrames++;
 }
 
diff --git a/services/surfaceflinger/TimeStats/TimeStats.h b/services/surfaceflinger/TimeStats/TimeStats.h
index 2410265..f76a62e 100644
--- a/services/surfaceflinger/TimeStats/TimeStats.h
+++ b/services/surfaceflinger/TimeStats/TimeStats.h
@@ -64,7 +64,7 @@
     static TimeStats& getInstance();
     void parseArgs(bool asProto, const Vector<String16>& args, size_t& index, String8& result);
     void incrementTotalFrames();
-    void incrementMissedFrames(bool propagateBackpressure);
+    void incrementMissedFrames();
     void incrementClientCompositionFrames();
 
     void setPostTime(const std::string& layerName, uint64_t frameNumber, nsecs_t postTime);