libhwc2.1: Add helper function for fb interface

This patch adds functions for conversion of type
between hal type and fb interface specific type.

Change-Id: I3669a315d9471ffb77142086e6007ec55d67ecc0
Signed-off-by: HyunKyung Kim <hk310.kim@samsung.com>
diff --git a/libhwc2.1/libhwchelper/ExynosHWCHelper.cpp b/libhwc2.1/libhwchelper/ExynosHWCHelper.cpp
index 34f0fda..3c1e876 100644
--- a/libhwc2.1/libhwchelper/ExynosHWCHelper.cpp
+++ b/libhwc2.1/libhwchelper/ExynosHWCHelper.cpp
@@ -341,6 +341,51 @@
     return dataSpace;
 }
 
+enum decon_blending halBlendingToS3CBlending(int32_t blending)
+{
+    switch (blending) {
+    case HWC2_BLEND_MODE_NONE:
+        return DECON_BLENDING_NONE;
+    case HWC2_BLEND_MODE_PREMULTIPLIED:
+        return DECON_BLENDING_PREMULT;
+    case HWC2_BLEND_MODE_COVERAGE:
+        return DECON_BLENDING_COVERAGE;
+
+    default:
+        return DECON_BLENDING_MAX;
+    }
+}
+
+enum dpp_rotate halTransformToS3CRot(uint32_t halTransform)
+{
+    switch (halTransform) {
+    case HAL_TRANSFORM_FLIP_H:
+        return DPP_ROT_YFLIP;
+    case HAL_TRANSFORM_FLIP_V:
+        return DPP_ROT_XFLIP;
+    case HAL_TRANSFORM_ROT_180:
+        return DPP_ROT_180;
+    case HAL_TRANSFORM_ROT_90:
+        return DPP_ROT_90;
+    case (HAL_TRANSFORM_ROT_90|HAL_TRANSFORM_FLIP_H):
+        /*
+         * HAL: HAL_TRANSFORM_FLIP_H -> HAL_TRANSFORM_ROT_90
+         * VPP: ROT_90 -> XFLIP
+         */
+        return DPP_ROT_90_XFLIP;
+    case (HAL_TRANSFORM_ROT_90|HAL_TRANSFORM_FLIP_V):
+        /*
+         * HAL: HAL_TRANSFORM_FLIP_V -> HAL_TRANSFORM_ROT_90
+         * VPP: ROT_90 -> YFLIP
+         */
+        return DPP_ROT_90_YFLIP;
+    case HAL_TRANSFORM_ROT_270:
+        return DPP_ROT_270;
+    default:
+        return DPP_ROT_NORMAL;
+    }
+}
+
 void dumpHandle(uint32_t type, private_handle_t *h)
 {
     if (h == NULL)
diff --git a/libhwc2.1/libhwchelper/ExynosHWCHelper.h b/libhwc2.1/libhwchelper/ExynosHWCHelper.h
index b4114dd..7c09265 100644
--- a/libhwc2.1/libhwchelper/ExynosHWCHelper.h
+++ b/libhwc2.1/libhwchelper/ExynosHWCHelper.h
@@ -304,6 +304,9 @@
 int S3CFormatToDrmFormat(int format);
 uint8_t formatToBpp(int format);
 uint8_t DeconFormatToBpp(decon_pixel_format format);
+enum decon_blending halBlendingToS3CBlending(int32_t blending);
+enum dpp_rotate halTransformToS3CRot(uint32_t halTransform);
+
 bool isFormatRgb(int format);
 bool isFormatYUV(int format);
 bool isFormatYUV420(int format);