omx: use G2D CSC for encoding surface textures

Change-Id: I1c7297f35b7740a5a9f0ce040c005135125c15fe
Signed-off-by: Greg Hackmann <ghackmann@google.com>
diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk b/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk
index 0d3e767..2435e0f 100644
--- a/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk
+++ b/exynos_omx/openmax/exynos_omx/component/video/enc/Android.mk
@@ -9,7 +9,7 @@
 LOCAL_ARM_MODE := arm
 LOCAL_MODULE_TAGS := optional
 
-LOCAL_CFLAGS := -DUSE_CSC_GSCALER -DCSC_GSCALER_IDX=3
+LOCAL_CFLAGS := -DUSE_CSC_G2D
 
 LOCAL_C_INCLUDES := $(EXYNOS_OMX_INC)/khronos \
 	$(EXYNOS_OMX_INC)/exynos \
diff --git a/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c b/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
index 8831608..22efe36 100644
--- a/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
+++ b/exynos_omx/openmax/exynos_omx/component/video/enc/Exynos_OMX_Venc.c
@@ -222,7 +222,7 @@
 
             Exynos_OSAL_LockANBHandle((OMX_U32)ppBuf[0], nFrameWidth, nFrameHeight, OMX_COLOR_FormatAndroidOpaque, planes);
 
-#ifdef USE_CSC_GSCALER
+#if defined(USE_CSC_GSCALER) || defined(USE_CSC_G2D)
             csc_method = CSC_METHOD_HW;
 #endif
             pSrcBuf[0] = planes[0].addr;
@@ -1150,9 +1150,13 @@
         goto EXIT;
     }
     pVideoEnc->csc_set_format = OMX_FALSE;
-#if defined(USE_CSC_GSCALER)
+#if defined(USE_CSC_GSCALER) && defined(USE_CSC_G2D)
+#error USE_CSC_GSCALER and USE_CSC_G2D are mutually exclusive
+#elif defined(USE_CSC_GSCALER)
     csc_set_hw_property(pVideoEnc->csc_handle, CSC_HW_PROPERTY_FIXED_NODE, CSC_GSCALER_IDX);
     csc_set_hw_property(pVideoEnc->csc_handle, CSC_HW_PROPERTY_HW_TYPE, CSC_HW_TYPE_GSCALER);
+#elif defined(USE_CSC_G2D)
+    csc_set_hw_property(pVideoEnc->csc_handle, CSC_HW_PROPERTY_HW_TYPE, CSC_HW_TYPE_G2D);
 #endif
 
     pExynosComponent->bMultiThreadProcess = OMX_TRUE;