SurfaceFlinger: run refresh  directly after invalidate

Run the refresh immediately after invalidate as there is no point going
thru the message queue again, and to ensure that we actually refresh
the screen instead of handling other messages that were queued us already
n the MessageQueue.

Bug: 182214053
Test: SF unit tests
Test: Launch an app and observe syatraces
Change-Id: Iff647415d46c4b155b20b60b9e7cc07253339100
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 727386c..4931bc1 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -1879,7 +1879,12 @@
             // underestimated.
             mFrameStartTime = frameStart;
         }
-        signalRefresh();
+
+        // Run the refresh immediately after invalidate as there is no point going thru the message
+        // queue again, and to ensure that we actually refresh the screen instead of handling
+        // other messages that were queued us already in the MessageQueue.
+        mRefreshPending = true;
+        onMessageRefresh();
     }
 }