drm_hwcomposer: implement the safe handling of layers

This is a sweeping change to discard our usage of struct hwc_layer_t outside
hwcomposer.cpp. That was a dangerous struct that was a source of many of our
errors. Replacing it with safer RAII-style classes reduces the amount and
complexity of our code.

Change-Id: I580cafdf89bd1e7e6583f3073858b8e78e6018ba
diff --git a/drmcomposition.cpp b/drmcomposition.cpp
index 864c5e5..634b0bb 100644
--- a/drmcomposition.cpp
+++ b/drmcomposition.cpp
@@ -69,15 +69,15 @@
 }
 
 int DrmComposition::SetLayers(size_t num_displays,
-                              const DrmCompositionDisplayLayersMap *maps) {
+                              DrmCompositionDisplayLayersMap *maps) {
   int ret = 0;
   for (size_t display_index = 0; display_index < num_displays;
        display_index++) {
-    const DrmCompositionDisplayLayersMap &map = maps[display_index];
+    DrmCompositionDisplayLayersMap &map = maps[display_index];
     int display = map.display;
 
     ret = composition_map_[display]->SetLayers(
-        map.layers, map.num_layers, map.layer_indices, &primary_planes_,
+        map.layers.data(), map.layers.size(), &primary_planes_,
         &overlay_planes_);
     if (ret)
       return ret;