DO NOT MERGE: drm_hwcomposer: Use Planner interface to provision planes

Use the new Planner interface to handle the layer->plane mapping.
This allows us to simplify the Plan() function by offloading the
plane provisioning to the platform specific code.

BUG=b/28117135
TEST=Tested on ryu with a variety of window layouts/workloads

Signed-off-by: Sean Paul <seanpaul@chromium.org>
Change-Id: I75a0c5d87a9096e7a83ecbc848c75fee42ee1131
diff --git a/drmcompositor.cpp b/drmcompositor.cpp
index 09da6bf..c1f3ed8 100644
--- a/drmcompositor.cpp
+++ b/drmcompositor.cpp
@@ -19,6 +19,7 @@
 #include "drmcompositor.h"
 #include "drmdisplaycompositor.h"
 #include "drmresources.h"
+#include "platform.h"
 
 #include <sstream>
 #include <stdlib.h>
@@ -42,6 +43,11 @@
       return ret;
     }
   }
+  planner_ = Planner::CreateInstance(drm_);
+  if (!planner_) {
+    ALOGE("Failed to create planner instance for composition");
+    return -ENOMEM;
+  }
 
   return 0;
 }
@@ -49,7 +55,7 @@
 std::unique_ptr<DrmComposition> DrmCompositor::CreateComposition(
     Importer *importer) {
   std::unique_ptr<DrmComposition> composition(
-      new DrmComposition(drm_, importer));
+      new DrmComposition(drm_, importer, planner_.get()));
   int ret = composition->Init(++frame_no_);
   if (ret) {
     ALOGE("Failed to initialize drm composition %d", ret);