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/libqdutils/qdMetaData.cpp b/libqdutils/qdMetaData.cpp
index a53ba07..cc7e44a 100644
--- a/libqdutils/qdMetaData.cpp
+++ b/libqdutils/qdMetaData.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -43,6 +43,10 @@
         ALOGE("%s: Bad fd for extra data!", __func__);
         return -1;
     }
+    if (!param) {
+        ALOGE("%s: input param is null!", __func__);
+        return -1;
+    }
     unsigned long size = ROUND_UP_PAGESIZE(sizeof(MetaData_t));
     void *base = mmap(NULL, size, PROT_READ|PROT_WRITE, MAP_SHARED,
         handle->fd_metadata, 0);
@@ -65,6 +69,12 @@
         case PP_PARAM_INTERLACED:
             data->interlaced = *((int32_t *)param);
             break;
+        case PP_PARAM_IGC:
+            memcpy((void *)&data->igcData, param, sizeof(IGCData_t));
+            break;
+        case PP_PARAM_SHARP2:
+            memcpy((void *)&data->Sharp2Data, param, sizeof(Sharp2Data_t));
+            break;
         default:
             ALOGE("Unknown paramType %d", paramType);
             break;
diff --git a/libqdutils/qdMetaData.h b/libqdutils/qdMetaData.h
index e60daed..bbca4b6 100644
--- a/libqdutils/qdMetaData.h
+++ b/libqdutils/qdMetaData.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2013, The Linux Foundation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions are
@@ -30,27 +30,45 @@
 #ifndef _QDMETADATA_H
 #define _QDMETADATA_H
 
+#define MAX_IGC_LUT_ENTRIES 256
 
-typedef struct {
+struct HSICData_t {
     int32_t hue;
     float   saturation;
     int32_t intensity;
     float   contrast;
-} HSICData_t;
+};
 
-typedef struct {
+struct Sharp2Data_t {
+    int32_t strength;
+    uint32_t edge_thr;
+    uint32_t smooth_thr;
+    uint32_t noise_thr;
+};
+
+struct IGCData_t{
+    uint16_t c0[MAX_IGC_LUT_ENTRIES];
+    uint16_t c1[MAX_IGC_LUT_ENTRIES];
+    uint16_t c2[MAX_IGC_LUT_ENTRIES];
+};
+
+struct MetaData_t {
     int32_t operation;
     int32_t interlaced;
     HSICData_t hsicData;
     int32_t sharpness;
     int32_t video_interface;
-} MetaData_t;
+    IGCData_t igcData;
+    Sharp2Data_t Sharp2Data;
+};
 
 typedef enum {
     PP_PARAM_HSIC       = 0x0001,
     PP_PARAM_SHARPNESS  = 0x0002,
     PP_PARAM_INTERLACED = 0x0004,
-    PP_PARAM_VID_INTFC  = 0x0008
+    PP_PARAM_VID_INTFC  = 0x0008,
+    PP_PARAM_IGC        = 0x0010,
+    PP_PARAM_SHARP2     = 0x0020,
 } DispParamType;
 
 int setMetaData(private_handle_t *handle, DispParamType paramType, void *param);