From 3126606fbba216dd0aabf68cbacc13642014095d Mon Sep 17 00:00:00 2001 From: Ed Heyl Date: Thu, 26 Aug 2010 14:44:27 -0700 Subject: S5PC110: 3D: Add header files to support rendering using texture stream Change-Id: I36dff2eb210739e815af49f60176cc5256f8821f --- include/s3c_bc.h | 63 ++++++++++++++++++++++ include/s3c_mem.h | 56 ++++++++++++++++++++ include/s5p_fimc.h | 151 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 270 insertions(+) create mode 100755 include/s3c_bc.h create mode 100755 include/s3c_mem.h create mode 100755 include/s5p_fimc.h diff --git a/include/s3c_bc.h b/include/s3c_bc.h new file mode 100755 index 0000000..e8ea490 --- /dev/null +++ b/include/s3c_bc.h @@ -0,0 +1,63 @@ +/*!**************************************************************************** +@File s3c_bc.h + +@Title s3c_bc kernel driver parameters + +@Author Imagination Technologies + Samsung Electronics Co. LTD + +@Date 03/03/2010 + +@Copyright Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +@Platform Generic + +@Description s3c_bc kernel driver parameters + +@DoxygenVer + +******************************************************************************/ + +/****************************************************************************** +Modifications :- +$Log: s3c_bc.h $ +******************************************************************************/ +#ifndef __S3C_BC_H__ +#define __S3C_BC_H__ + +#include + +#define S3C_BC_DEVICE_NAME "s3c_bc" + +#define S3C_BC_DEVICE_ID 0 +#define S3C_BC_DEVICE_BUFFER_COUNT 4 /* TODO: Modify this accordingly. */ + +#define S3C_BC_DEVICE_PHYS_PAGE_SIZE 0x1000 /* 4KB */ + +typedef struct S3C_BC_ioctl_package_TAG +{ + int inputparam; + int outputparam; +} S3C_BC_ioctl_package, *PS3C_BC_ioctl_package; + +/*!< Nov 2006: according to ioctl-number.txt 'g' wasn't in use. */ +#define S3C_BC_IOC_GID 'g' + +#define S3C_BC_IOWR(INDEX) _IOWR(S3C_BC_IOC_GID, INDEX, S3C_BC_ioctl_package) + +#define S3C_BC_ioctl_get_physical_base_address S3C_BC_IOWR(0) + +#endif /* __S3C_BC__H__ */ +/****************************************************************************** + End of file (s3c_bc.h) +******************************************************************************/ diff --git a/include/s3c_mem.h b/include/s3c_mem.h new file mode 100755 index 0000000..d51398a --- /dev/null +++ b/include/s3c_mem.h @@ -0,0 +1,56 @@ +/* + * Copyright@ Samsung Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _S3C_MEM_COMMON_H_ +#define _S3C_MEM_COMMON_H_ + +#define MEM_IOCTL_MAGIC 'M' + +#define S3C_MEM_ALLOC _IOWR(MEM_IOCTL_MAGIC, 310, struct s3c_mem_alloc) +#define S3C_MEM_FREE _IOWR(MEM_IOCTL_MAGIC, 311, struct s3c_mem_alloc) + +#define S3C_MEM_SHARE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 314, struct s3c_mem_alloc) +#define S3C_MEM_SHARE_FREE _IOWR(MEM_IOCTL_MAGIC, 315, struct s3c_mem_alloc) + +#define S3C_MEM_CACHEABLE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 316, struct s3c_mem_alloc) +#define S3C_MEM_CACHEABLE_SHARE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 317, struct s3c_mem_alloc) + +#define S3C_MEM_DMA_COPY _IOWR(MEM_IOCTL_MAGIC, 318, struct s3c_mem_dma_param) +#define S3C_MEM_DMA_SET _IOWR(MEM_IOCTL_MAGIC, 319, struct s3c_mem_dma_param) + +#define S3C_MEM_CACHE_INV _IOWR(MEM_IOCTL_MAGIC, 330, struct s3c_mem_dma_param) + + +struct s3c_mem_alloc { + int size; + unsigned int vir_addr; + unsigned int phy_addr; +}; + +struct s3c_mem_dma_param { + int size; + unsigned int src_addr; + unsigned int dst_addr; + int cfg; +}; + +#if 0 +typedef struct _s3c_mem_t{ + int dev_fd; + struct s3c_mem_alloc mem_alloc_info; +}s3c_mem_t; +#endif +#endif // _S3C_MEM_COMMON_H_ diff --git a/include/s5p_fimc.h b/include/s5p_fimc.h new file mode 100755 index 0000000..af42cf1 --- /dev/null +++ b/include/s5p_fimc.h @@ -0,0 +1,151 @@ +/* + * Copyright@ Samsung Electronics Co. LTD + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ + +#ifndef _S5P_FIMC_H_ +#define _S5P_FIMC_H_ + +/* + * G E N E R A L S + * +*/ +#define MIN(x, y) ((x < y) ? x : y) + +/* + * P I X E L F O R M A T G U I D E + * + * The 'x' means 'DO NOT CARE' + * The '*' means 'FIMC SPECIFIC' + * For some fimc formats, we couldn't find equivalent format in the V4L2 FOURCC. + * + * FIMC TYPE PLANES ORDER V4L2_PIX_FMT + * --------------------------------------------------------- + * RGB565 x x V4L2_PIX_FMT_RGB565 + * RGB888 x x V4L2_PIX_FMT_RGB24 + * YUV420 2 LSB_CBCR V4L2_PIX_FMT_NV12 + * YUV420 2 LSB_CRCB V4L2_PIX_FMT_NV21 + * YUV420 2 MSB_CBCR V4L2_PIX_FMT_NV21X* + * YUV420 2 MSB_CRCB V4L2_PIX_FMT_NV12X* + * YUV420 3 x V4L2_PIX_FMT_YUV420 + * YUV422 1 YCBYCR V4L2_PIX_FMT_YUYV + * YUV422 1 YCRYCB V4L2_PIX_FMT_YVYU + * YUV422 1 CBYCRY V4L2_PIX_FMT_UYVY + * YUV422 1 CRYCBY V4L2_PIX_FMT_VYUY* + * YUV422 2 LSB_CBCR V4L2_PIX_FMT_NV16* + * YUV422 2 LSB_CRCB V4L2_PIX_FMT_NV61* + * YUV422 2 MSB_CBCR V4L2_PIX_FMT_NV16X* + * YUV422 2 MSB_CRCB V4L2_PIX_FMT_NV61X* + * YUV422 3 x V4L2_PIX_FMT_YUV422P + * +*/ + +/* + * V 4 L 2 F I M C E X T E N S I O N S + * +*/ +#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U') + +/* FOURCC for FIMC specific */ +#define V4L2_PIX_FMT_NV12X v4l2_fourcc('N', '1', '2', 'X') +#define V4L2_PIX_FMT_NV21X v4l2_fourcc('N', '2', '1', 'X') +#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y') +#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6') +#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1') +#define V4L2_PIX_FMT_NV16X v4l2_fourcc('N', '1', '6', 'X') +#define V4L2_PIX_FMT_NV61X v4l2_fourcc('N', '6', '1', 'X') + +#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */ + +/* CID extensions */ +#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) +#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20) +#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21) +/* + * U S E R D E F I N E D T Y P E S + * +*/ + +typedef unsigned int dma_addr_t; + +struct fimc_buf { + dma_addr_t base[3]; + size_t length[3]; +}; + +struct fimc_buffer { + void *virt_addr; + void *phys_addr; + size_t length; +}; + +struct yuv_fmt_list { + const char *name; + const char *desc; + unsigned int fmt; + int bpp; + int planes; +}; + +struct img_offset { + int y_h; + int y_v; + int cb_h; + int cb_v; + int cr_h; + int cr_v; +}; + +//------------ STRUCT ---------------------------------------------------------// + +typedef struct +{ + unsigned int full_width; // Source Image Full Width (Virtual screen size) + unsigned int full_height; // Source Image Full Height (Virtual screen size) + unsigned int start_x; // Source Image Start width offset + unsigned int start_y; // Source Image Start height offset + unsigned int width; // Source Image Width + unsigned int height; // Source Image Height + unsigned int buf_addr_phy_rgb_y; // Base Address of the Source Image (RGB or Y): Physical Address + unsigned int buf_addr_phy_cb; // Base Address of the Source Image (CB Component) : Physical Address + unsigned int buf_addr_phy_cr; // Base Address of the Source Image (CR Component) : Physical Address + unsigned int color_space; // Color Space of the Source Image +} s5p_fimc_img_info; + +typedef struct +{ + s5p_fimc_img_info src; + s5p_fimc_img_info dst; +} s5p_fimc_params_t; + +typedef struct _s5p_fimc_t { + int dev_fd; + struct fimc_buffer out_buf; + + s5p_fimc_params_t params; + + int use_ext_out_mem; + unsigned int hw_ver; +}s5p_fimc_t; + +//------------------------ functions for v4l2 ------------------------------// +int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src); +int fimc_v4l2_set_dst(int fd, s5p_fimc_img_info *dst, int rotation, unsigned int addr); +int fimc_v4l2_stream_on(int fd, enum v4l2_buf_type type); +int fimc_v4l2_queue(int fd, struct fimc_buf *fimc_buf); +int fimc_v4l2_dequeue(int fd); +int fimc_v4l2_stream_off(int fd); +int fimc_v4l2_clr_buf(int fd); +int fimc_handle_oneshot(int fd, struct fimc_buf *fimc_buf); +#endif -- cgit v1.1