drm_hwcomposer: Add z order support

Currently, the planner just pops the first available drm plane and if
that can't be used for the DrmHwcLayer it just returns error.

This proposes a slighlty smarter way to do that by trying to see if
any of the DrmPlane can be used for the DrmHwcLayer in question.

More, if the drm_plane doesn't have a fix zorder then we could re-add
him to the list of unused planes, so it could be used for hosting
other less demanding DrmHwcLayers.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
diff --git a/drmdisplaycompositor.cpp b/drmdisplaycompositor.cpp
index cd6d4b2..a1ccdc7 100644
--- a/drmdisplaycompositor.cpp
+++ b/drmdisplaycompositor.cpp
@@ -359,6 +359,17 @@
         }
       }
 
+      if (plane->zpos_property().id() && !plane->zpos_property().immutable()) {
+        ret = drmModeAtomicAddProperty(pset, plane->id(),
+                                       plane->zpos_property().id(),
+                                       source_layers.front()) < 0;
+        if (ret) {
+          ALOGE("Failed to add zpos property %d to plane %d",
+                plane->zpos_property().id(), plane->id());
+          break;
+        }
+      }
+
       rotation = 0;
       if (layer.transform & DrmHwcTransform::kFlipH)
         rotation |= DRM_MODE_REFLECT_X;