drm_hwcomposer: Rework KMS composition planner + plane sharing support

Rewrite Layer-to-Plane planner. Get rid of ~200 redundant lines of code
+ added plane sharing functionality.

Closes: https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer/-/issues/11
Signed-off-by: Roman Stratiienko <roman.o.stratiienko@globallogic.com>
diff --git a/compositor/DrmDisplayCompositor.h b/compositor/DrmDisplayCompositor.h
index bff3de7..b556268 100644
--- a/compositor/DrmDisplayCompositor.h
+++ b/compositor/DrmDisplayCompositor.h
@@ -17,8 +17,6 @@
 #ifndef ANDROID_DRM_DISPLAY_COMPOSITOR_H_
 #define ANDROID_DRM_DISPLAY_COMPOSITOR_H_
 
-#include <hardware/hardware.h>
-#include <hardware/hwcomposer.h>
 #include <pthread.h>
 
 #include <functional>
@@ -27,7 +25,8 @@
 #include <sstream>
 #include <tuple>
 
-#include "DrmDisplayComposition.h"
+#include "DrmKmsPlan.h"
+#include "drm/DrmPlane.h"
 #include "drm/ResourceManager.h"
 #include "drm/VSyncWorker.h"
 #include "drmhwcomposer.h"
@@ -39,7 +38,7 @@
   bool test_only = false;
   std::optional<DrmMode> display_mode;
   std::optional<bool> active;
-  std::shared_ptr<DrmDisplayComposition> composition;
+  std::shared_ptr<DrmKmsPlan> composition;
   /* 'clear' should never be used together with 'composition' */
   bool clear_active_composition = false;
 
@@ -68,7 +67,7 @@
 
   struct KmsState {
     /* Required to cleanup unused planes */
-    std::vector<DrmPlane *> used_planes;
+    std::vector<std::shared_ptr<BindingOwner<DrmPlane>>> used_planes;
     /* We have to hold a reference to framebuffer while displaying it ,
      * otherwise picture will blink */
     std::vector<std::shared_ptr<DrmFbIdHandle>> used_framebuffers;