SF: Fix the delivery of visible and damage rects to HWC
The storage space for the visible and damage regions was inside the
HWCLayerVersion1 class, which is temporarily allocated while using
an iterator. As such, the storage has been deleted by the time the
HWC gets a pointer to it sometime later and hence the HWC reads
garbage in all layers.
This commit moves the storage into the DisplayData structure and hence
it persists until the next frame.
Bug 28200888
Change-Id: If7cc8d2de49e3e66e9d17cc45934d8e544576026
diff --git a/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h b/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h
index f5f7d77..c861817 100644
--- a/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h
+++ b/services/surfaceflinger/DisplayHardware/HWComposer_hwc1.h
@@ -346,6 +346,13 @@
// protected by mEventControlLock
int32_t events;
+
+ // We need to hold "copies" of these for memory management purposes. The
+ // actual hwc_layer_1_t holds pointers to the memory within. Vector<>
+ // internally doesn't copy the memory unless one of the copies is
+ // modified.
+ Vector<Region> visibleRegions;
+ Vector<Region> surfaceDamageRegions;
};
sp<SurfaceFlinger> mFlinger;