HWC2: Backpressure on transactions as well

Modifies the backpressure detection to skip transactions as well as
buffer updates.

Bug: 29413700
Change-Id: I97cda920e7fc1cd7151f0a4df1b00f96b84f4145
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 37b3757..e156e1a 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -913,6 +913,15 @@
     ATRACE_CALL();
     switch (what) {
         case MessageQueue::INVALIDATE: {
+            bool frameMissed = !mHadClientComposition &&
+                    mPreviousPresentFence != Fence::NO_FENCE &&
+                    mPreviousPresentFence->getSignalTime() == INT64_MAX;
+            ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
+            if (frameMissed) {
+                signalLayerUpdate();
+                break;
+            }
+
             bool refreshNeeded = handleMessageTransaction();
             refreshNeeded |= handleMessageInvalidate();
             refreshNeeded |= mRepaintEverything;
@@ -942,14 +951,6 @@
 
 bool SurfaceFlinger::handleMessageInvalidate() {
     ATRACE_CALL();
-    bool frameMissed = !mHadClientComposition &&
-            mPreviousPresentFence != Fence::NO_FENCE &&
-            mPreviousPresentFence->getSignalTime() == INT64_MAX;
-    ATRACE_INT("FrameMissed", static_cast<int>(frameMissed));
-    if (frameMissed) {
-        signalLayerUpdate();
-        return false;
-    }
     return handlePageFlip();
 }