From f77a2a9dcd345a812c842087dfc2dd2687305fc2 Mon Sep 17 00:00:00 2001 From: SeungBeom Kim Date: Fri, 20 Jul 2012 16:44:11 +0900 Subject: [PATCH] exynos5: libcsc: change CSC API for DMABUF support. Change csc_set_src_buffer and csc_set_dst_buffer API, Change-Id: I6630ea3b11680b3a99c7610e5635d02c27ed6ccd Signed-off-by: SeungBeom Kim --- libcsc/csc.c | 45 +++++++++++++-------------------------------- libcsc/csc.h | 16 ++++++---------- 2 files changed, 19 insertions(+), 42 deletions(-) diff --git a/libcsc/csc.c b/libcsc/csc.c index a0b9479..255f462 100644 --- a/libcsc/csc.c +++ b/libcsc/csc.c @@ -54,7 +54,6 @@ #endif #define GSCALER_IMG_ALIGN 16 -#define CSC_MAX_PLANES 3 #define ALIGN(x, a) (((x) + (a) - 1) & ~((a) - 1)) typedef enum _CSC_PLANE { @@ -83,8 +82,7 @@ typedef struct _CSC_FORMAT { } CSC_FORMAT; typedef struct _CSC_BUFFER { - unsigned char *planes[CSC_MAX_PLANES]; - int ion_fd; + void *planes[CSC_MAX_PLANES]; } CSC_BUFFER; typedef struct _CSC_HW_PROPERTY { @@ -430,28 +428,19 @@ static CSC_ERRORCODE csc_set_buffer( { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; - void *src_addr[3] = {NULL, }; - void *dst_addr[3] = {NULL, }; if (handle == NULL) return CSC_ErrorNotInit; csc_handle = (CSC_HANDLE *)handle; if (csc_handle->csc_method == CSC_METHOD_HW) { - src_addr[0] = csc_handle->src_buffer.planes[CSC_Y_PLANE]; - src_addr[1] = csc_handle->src_buffer.planes[CSC_U_PLANE]; - src_addr[2] = csc_handle->src_buffer.planes[CSC_V_PLANE]; - dst_addr[0] = csc_handle->dst_buffer.planes[CSC_Y_PLANE]; - dst_addr[1] = csc_handle->dst_buffer.planes[CSC_U_PLANE]; - dst_addr[2] = csc_handle->dst_buffer.planes[CSC_V_PLANE]; - switch (csc_handle->csc_hw_type) { case CSC_HW_TYPE_FIMC: break; #ifdef ENABLE_GSCALER case CSC_HW_TYPE_GSCALER: - exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, src_addr); - exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, dst_addr); + exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, csc_handle->src_buffer.planes); + exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, csc_handle->dst_buffer.planes); break; #endif default: @@ -676,45 +665,37 @@ CSC_ERRORCODE csc_set_dst_format( } CSC_ERRORCODE csc_set_src_buffer( - void *handle, - unsigned char *y, - unsigned char *u, - unsigned char *v, - int ion_fd) + void *handle, + void *addr[3]) { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; - void *addr[3] = {NULL, }; if (handle == NULL) return CSC_ErrorNotInit; csc_handle = (CSC_HANDLE *)handle; - csc_handle->src_buffer.planes[CSC_Y_PLANE] = y; - csc_handle->src_buffer.planes[CSC_U_PLANE] = u; - csc_handle->src_buffer.planes[CSC_V_PLANE] = v; + csc_handle->src_buffer.planes[CSC_Y_PLANE] = addr[0]; + csc_handle->src_buffer.planes[CSC_U_PLANE] = addr[1]; + csc_handle->src_buffer.planes[CSC_V_PLANE] = addr[2]; return ret; } CSC_ERRORCODE csc_set_dst_buffer( - void *handle, - unsigned char *y, - unsigned char *u, - unsigned char *v, - int ion_fd) + void *handle, + void *addr[3]) { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; - void *addr[3] = {NULL, }; if (handle == NULL) return CSC_ErrorNotInit; csc_handle = (CSC_HANDLE *)handle; - csc_handle->dst_buffer.planes[CSC_Y_PLANE] = y; - csc_handle->dst_buffer.planes[CSC_U_PLANE] = u; - csc_handle->dst_buffer.planes[CSC_V_PLANE] = v; + csc_handle->dst_buffer.planes[CSC_Y_PLANE] = addr[0]; + csc_handle->dst_buffer.planes[CSC_U_PLANE] = addr[1]; + csc_handle->dst_buffer.planes[CSC_V_PLANE] = addr[2]; return ret; } diff --git a/libcsc/csc.h b/libcsc/csc.h index 3cf277c..5fc50a2 100644 --- a/libcsc/csc.h +++ b/libcsc/csc.h @@ -34,6 +34,8 @@ extern "C" { #endif +#define CSC_MAX_PLANES 3 + typedef enum _CSC_ERRORCODE { CSC_ErrorNone = 0, CSC_Error, @@ -329,11 +331,8 @@ CSC_ERRORCODE csc_set_dst_format( * error code */ CSC_ERRORCODE csc_set_src_buffer( - void *handle, - unsigned char *y, - unsigned char *u, - unsigned char *v, - int ion_fd); + void *handle, + void *addr[CSC_MAX_PLANES]); /* * Setup destination buffer @@ -354,11 +353,8 @@ CSC_ERRORCODE csc_set_src_buffer( * error code */ CSC_ERRORCODE csc_set_dst_buffer( - void *handle, - unsigned char *y, - unsigned char *u, - unsigned char *v, - int ion_fd); + void *handle, + void *addr[CSC_MAX_PLANES]); /* * Convert color space with presetup color format -- 2.20.1