SF Bounds caching 1/3: Defer calls that use layer bounds until the cached bounds are available.

End goal is to calculate the bounds once in the surface flinger loop. The bounds are invalidated
if the visible region changes. The first step is to defer any functions that use the cache to after
the bounds is calculated.

- Defer updating display dirty region when latching buffers.
- Defer updating cursor and input flinger until all the buffers have been latched.
- Recompute visible regions if transformToDisplayInverse flag changes

Test: go/wm-smoke
Test: atest -a libinput_tests inputflinger_tests SurfaceFlinger_test libsurfaceflinger_unittest SurfaceParcelable_test libgui_test
Change-Id: Ife6e0f06939d9f4fb051b68cb2b1c9f5bd180b57
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index f099df6..c5b172f 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -517,8 +517,8 @@
      * operation, so this should be set only if needed). Typically this is used
      * to figure out if the content or size of a surface has changed.
      */
-    virtual Region latchBuffer(bool& /*recomputeVisibleRegions*/, nsecs_t /*latchTime*/,
-                               const sp<Fence>& /*releaseFence*/) {
+    virtual bool latchBuffer(bool& /*recomputeVisibleRegions*/, nsecs_t /*latchTime*/,
+                             const sp<Fence>& /*releaseFence*/) {
         return {};
     }