From f6cd1b2052c90ece97a3a599a37f108f4bdf7448 Mon Sep 17 00:00:00 2001 From: meka rama Date: Thu, 29 Nov 2012 14:53:47 +0900 Subject: [PATCH] libcsc: supported various buf mem_types. user can set the mem_type by passing proper param to csc_set_src_buffer & csc_set_dst_buffer. supported types are CSC_MEMORY_MMAP, CSC_MEMORY_USERPTR, CSC_MEMORY_OVERLAY, CSC_MEMORY_DMABUF. API: CSC_ERRORCODE csc_set_src_buffer( void *handle, void *addr[CSC_MAX_PLANES], int mem_type); Change-Id: I1027cf4058a1574061cabc0521fb77cb3c6da215 Signed-off-by: meka rama --- include/csc.h | 13 +++++++++++-- libcsc/csc.c | 13 +++++++++---- 2 files changed, 20 insertions(+), 6 deletions(-) diff --git a/include/csc.h b/include/csc.h index 5fc50a2..fa09855 100644 --- a/include/csc.h +++ b/include/csc.h @@ -55,6 +55,13 @@ typedef enum _CSC_HW_PROPERTY_TYPE { CSC_HW_PROPERTY_MODE_DRM, } CSC_HW_PROPERTY_TYPE; +typedef enum _CSC_MEMTYPE { + CSC_MEMORY_MMAP = 1, + CSC_MEMORY_USERPTR, + CSC_MEMORY_OVERLAY, + CSC_MEMORY_DMABUF, +} CSC_MEMTYPE; + /* * change hal pixel format to omx pixel format * @@ -332,7 +339,8 @@ CSC_ERRORCODE csc_set_dst_format( */ CSC_ERRORCODE csc_set_src_buffer( void *handle, - void *addr[CSC_MAX_PLANES]); + void *addr[CSC_MAX_PLANES], + int mem_type); /* * Setup destination buffer @@ -354,7 +362,8 @@ CSC_ERRORCODE csc_set_src_buffer( */ CSC_ERRORCODE csc_set_dst_buffer( void *handle, - void *addr[CSC_MAX_PLANES]); + void *addr[CSC_MAX_PLANES], + int mem_type); /* * Convert color space with presetup color format diff --git a/libcsc/csc.c b/libcsc/csc.c index 4f2aac6..90f1972 100644 --- a/libcsc/csc.c +++ b/libcsc/csc.c @@ -83,6 +83,7 @@ typedef struct _CSC_FORMAT { typedef struct _CSC_BUFFER { void *planes[CSC_MAX_PLANES]; + int mem_type; } CSC_BUFFER; typedef struct _CSC_HW_PROPERTY { @@ -440,8 +441,8 @@ static CSC_ERRORCODE csc_set_buffer( break; #ifdef ENABLE_GSCALER case CSC_HW_TYPE_GSCALER: - exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, csc_handle->src_buffer.planes, -1); - exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, csc_handle->dst_buffer.planes, -1); + exynos_gsc_set_src_addr(csc_handle->csc_hw_handle, csc_handle->src_buffer.planes, csc_handle->src_buffer.mem_type, -1); + exynos_gsc_set_dst_addr(csc_handle->csc_hw_handle, csc_handle->dst_buffer.planes, csc_handle->dst_buffer.mem_type, -1); break; #endif default: @@ -667,7 +668,8 @@ CSC_ERRORCODE csc_set_dst_format( CSC_ERRORCODE csc_set_src_buffer( void *handle, - void *addr[3]) + void *addr[3], + int mem_type) { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; @@ -679,13 +681,15 @@ CSC_ERRORCODE csc_set_src_buffer( 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]; + csc_handle->src_buffer.mem_type = mem_type; return ret; } CSC_ERRORCODE csc_set_dst_buffer( void *handle, - void *addr[3]) + void *addr[3], + int mem_type) { CSC_HANDLE *csc_handle; CSC_ERRORCODE ret = CSC_ErrorNone; @@ -697,6 +701,7 @@ CSC_ERRORCODE csc_set_dst_buffer( 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]; + csc_handle->dst_buffer.mem_type = mem_type; return ret; } -- 2.20.1