separate transactions from updates

with this changes, SF transactions are handled as soon as possible
but do not trigger updates. the update is delayed until the next
vsync.

this allows us to work much better without requiring triple-buffering.

Change-Id: I1fa10794d0cf742129f0877698b7b1e1f2ec7401
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 2dd4da1..bf30608 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -80,6 +80,7 @@
     virtual wp<IBinder> getSurfaceTextureBinder() const;
 
     virtual void onLayerDisplayed();
+    virtual bool onPreComposition();
 
     // only for debugging
     inline const sp<GraphicBuffer>& getActiveBuffer() const { return mActiveBuffer; }
@@ -115,14 +116,17 @@
     uint32_t mCurrentTransform;
     uint32_t mCurrentScalingMode;
     bool mCurrentOpacity;
+    size_t mRefreshPending;
     bool mFrameLatencyNeeded;
     int mFrameLatencyOffset;
+
     struct Statistics {
         Statistics() : timestamp(0), set(0), vsync(0) { }
         nsecs_t timestamp;  // buffer timestamp
         nsecs_t set;        // buffer displayed timestamp
         nsecs_t vsync;      // vsync immediately before set
     };
+
     // protected by mLock
     Statistics mFrameStats[128];