Add correct damage and visible regions for cached buffers.

To ensure that these are reasonably accurate when using caching so that
we're robust to partial update support in composer:

1. Set the visible region to be the union of visible regions for all
cached layers.
2. When the cached set is first created, set the surface damage to be
the cached set. For subsequent frames, set the surface damage to be
empty.

Bug: 183456093
Test: libcompositionengine_test

Change-Id: I2b7b3b4b5630011323a802908c5a80917bdb86ef
diff --git a/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp b/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp
index 0f6804d..efd23dc 100644
--- a/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp
+++ b/services/surfaceflinger/CompositionEngine/src/OutputLayerCompositionState.cpp
@@ -73,6 +73,12 @@
     dumpVal(out, "override display frame", overrideInfo.displayFrame);
     dumpVal(out, "override dataspace", toString(overrideInfo.dataspace), overrideInfo.dataspace);
     dumpVal(out, "override display space", to_string(overrideInfo.displaySpace));
+    std::string damageRegionString;
+    overrideInfo.damageRegion.dump(damageRegionString, "");
+    dumpVal(out, "override damage region", damageRegionString);
+    std::string visibleRegionString;
+    overrideInfo.visibleRegion.dump(visibleRegionString, "");
+    dumpVal(out, "override visible region", visibleRegionString);
 
     if (hwc) {
         dumpHwc(*hwc, out);