hwc/overlay: validate and prepare frame

Send the entire frame (array of overlays) to driver, so that it would
check pipes params and the whole frame wrt bandwidth and SMP.

Now, the overlay's commit API just prepares an overlay object but
makes no ioctl calls.

If the driver finds the frame, as a whole, to be not ok, the
validation fails and overlay/hwc return silently.

If a certain overlay object is mis-configured or pipes are
unavailable, the driver sets the number of objects it processed.
Overlay uses this to dump the incorrect config.

Change-Id: Ifb2b7fadc6bd6d9d94a35ba3908fbd832f41447f
diff --git a/liboverlay/overlayCtrlData.h b/liboverlay/overlayCtrlData.h
index dbf328a..26202ec 100644
--- a/liboverlay/overlayCtrlData.h
+++ b/liboverlay/overlayCtrlData.h
@@ -84,6 +84,8 @@
     /* Return the dump in the specified buffer */
     void getDump(char *buf, size_t len);
 
+    static bool validateAndSet(Ctrl* ctrlArray[], const int& count,
+            const int& fbFd);
 private:
     // mdp ctrl struct(info e.g.)
     MdpCtrl *mMdp;
@@ -181,6 +183,19 @@
     mMdp->updateSrcFormat(rotDstFmt);
 }
 
+inline bool Ctrl::validateAndSet(Ctrl* ctrlArray[], const int& count,
+        const int& fbFd) {
+    MdpCtrl* mdpCtrlArray[count];
+    memset(&mdpCtrlArray, 0, sizeof(mdpCtrlArray));
+
+    for(int i = 0; i < count; i++) {
+        mdpCtrlArray[i] = ctrlArray[i]->mMdp;
+    }
+
+    bool ret = MdpCtrl::validateAndSet(mdpCtrlArray, count, fbFd);
+    return ret;
+}
+
 inline utils::Dim Ctrl::getCrop() const {
     return mMdp->getSrcRectDim();
 }