hwc: Add MetaData support in overlay path.

DONE:
    1. HSIC(SPA) test.
    2. IGC R/G/B channel test.
    3. QSEED2 sharpening/smooth test verified through register value check.

Change-Id: Ia9472f489c013df22a3411eeaac3c8d1e6e22ac0
diff --git a/libhwcomposer/hwc_utils.cpp b/libhwcomposer/hwc_utils.cpp
index 3a85d47..eced7a4 100644
--- a/libhwcomposer/hwc_utils.cpp
+++ b/libhwcomposer/hwc_utils.cpp
@@ -594,6 +594,13 @@
             ovutils::setMdpFlags(mdpFlags,  ovutils::OV_MDP_FLIP_V);
         }
     }
+
+    if(metadata &&
+        ((metadata->operation & PP_PARAM_HSIC)
+        || (metadata->operation & PP_PARAM_IGC)
+        || (metadata->operation & PP_PARAM_SHARP2))) {
+        ovutils::setMdpFlags(mdpFlags, ovutils::OV_MDP_PP_EN);
+    }
 }
 
 static inline int configRotator(Rotator *rot, const Whf& whf,
@@ -609,7 +616,8 @@
 
 static inline int configMdp(Overlay *ov, const PipeArgs& parg,
         const eTransform& orient, const hwc_rect_t& crop,
-        const hwc_rect_t& pos, const eDest& dest) {
+        const hwc_rect_t& pos, const MetaData_t *metadata,
+        const eDest& dest) {
     ov->setSource(parg, dest);
     ov->setTransform(orient, dest);
 
@@ -623,6 +631,9 @@
     Dim position(pos.left, pos.top, posW, posH);
     ov->setPosition(position, dest);
 
+    if (metadata)
+        ov->setVisualParams(*metadata, dest);
+
     if (!ov->commit(dest)) {
         return -1;
     }
@@ -654,6 +665,8 @@
         return -1;
     }
 
+    MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
+
     hwc_rect_t crop = layer->sourceCrop;
     hwc_rect_t dst = layer->displayFrame;
     int transform = layer->transform;
@@ -695,7 +708,7 @@
     transform = 0;
 
     PipeArgs parg(mdpFlags, whf, z, isFg, static_cast<eRotFlags>(rotFlags));
-    if(configMdp(ctx->mOverlay, parg, orient, crop, dst, dest) < 0) {
+    if(configMdp(ctx->mOverlay, parg, orient, crop, dst, metadata, dest) < 0) {
         ALOGE("%s: commit failed for low res panel", __FUNCTION__);
         return -1;
     }
@@ -712,6 +725,8 @@
         return -1;
     }
 
+    MetaData_t *metadata = (MetaData_t *)hnd->base_metadata;
+
     int hw_w = ctx->dpyAttr[dpy].xres;
     int hw_h = ctx->dpyAttr[dpy].yres;
     hwc_rect_t crop = layer->sourceCrop;
@@ -787,7 +802,7 @@
         PipeArgs pargL(mdpFlagsL, whf, z, isFg,
                 static_cast<eRotFlags>(rotFlags));
         if(configMdp(ctx->mOverlay, pargL, orient,
-                tmp_cropL, tmp_dstL, lDest) < 0) {
+                tmp_cropL, tmp_dstL, metadata, lDest) < 0) {
             ALOGE("%s: commit failed for left mixer config", __FUNCTION__);
             return -1;
         }
@@ -798,7 +813,7 @@
         PipeArgs pargR(mdpFlagsR, whf, z, isFg,
                 static_cast<eRotFlags>(rotFlags));
         if(configMdp(ctx->mOverlay, pargR, orient,
-                tmp_cropR, tmp_dstR, rDest) < 0) {
+                tmp_cropR, tmp_dstR, metadata, rDest) < 0) {
             ALOGE("%s: commit failed for right mixer config", __FUNCTION__);
             return -1;
         }