drm_hwcomposer: Propagate PlanStage error

All existing stage planers(PlanStageGreedy, PlanStageProtected,
PlanStageHiSi) silently ignore if they couldn't allocate a drmplane
for a drmhwclayer and return success.

That doesn't go well with the assumptions from ValidateDisplay,
where if the atomic check succeeds we just assume that we could do
Device composition for a maximum of num_of_drm_planes layers. But,
since we silently dropped some drmhwclayer we never put those in the
atomic check and we won't put it in the final atomic commit, so we end
up with a wrong composition on the screen.

What this proposes is propagating the error, which will make
ValidateDisplay to fallback on client composition.

Signed-off-by: Alexandru Gheorghe <alexandru-cosmin.gheorghe@arm.com>
diff --git a/platform.cpp b/platform.cpp
index 9e0eb45..b7a47c7 100644
--- a/platform.cpp
+++ b/platform.cpp
@@ -118,8 +118,10 @@
 
     ret = Emplace(composition, planes, DrmCompositionPlane::Type::kLayer, crtc,
                   std::make_pair(i->first, i->second));
-    if (ret)
+    if (ret) {
       ALOGE("Failed to dedicate protected layer! Dropping it.");
+      return ret;
+    }
 
     protected_zorder = i->first;
     i = layers.erase(i);
@@ -139,8 +141,10 @@
     // We don't have any planes left
     if (ret == -ENOENT)
       break;
-    else if (ret)
+    else if (ret) {
       ALOGE("Failed to emplace layer %zu, dropping it", i->first);
+      return ret;
+    }
   }
 
   return 0;