Commit | Line | Data |
---|---|---|
5763fb39 T |
1 | /* Copyright(c) 2011 Samsung Electronics Co, Ltd. |
2 | * | |
3 | * This program is free software; you can redistribute it and/or modify | |
4 | * it under the terms of the GNU General Public License version 2 as | |
5 | * published by the Free Software Foundation. | |
6 | * | |
7 | * Alternatively, Licensed under the Apache License, Version 2.0 (the "License"); | |
8 | * you may not use this file except in compliance with the License. | |
9 | * You may obtain a copy of the License at | |
10 | * | |
11 | * http://www.apache.org/licenses/LICENSE-2.0 | |
12 | * | |
13 | * Unless required by applicable law or agreed to in writing, software | |
14 | * distributed under the License is distributed on an "AS IS" BASIS, | |
15 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
16 | * See the License for the specific language governing permissions and | |
17 | * limitations under the License. | |
18 | */ | |
19 | ||
20 | #ifndef _S5P_FIMC_H_ | |
21 | #define _S5P_FIMC_H_ | |
22 | ||
a4e95a20 EC |
23 | #include <linux/videodev2.h> |
24 | #include <linux/videodev2_exynos_media.h> | |
5763fb39 T |
25 | |
26 | /* | |
27 | * G E N E R A L S | |
28 | * | |
29 | */ | |
30 | ||
31 | /* | |
32 | * P I X E L F O R M A T G U I D E | |
33 | * | |
34 | * The 'x' means 'DO NOT CARE' | |
35 | * The '*' means 'FIMC SPECIFIC' | |
36 | * For some fimc formats, we couldn't find equivalent format in the V4L2 FOURCC. | |
37 | * | |
38 | * FIMC TYPE PLANES ORDER V4L2_PIX_FMT | |
39 | * --------------------------------------------------------- | |
40 | * RGB565 x x V4L2_PIX_FMT_RGB565 | |
41 | * RGB888 x x V4L2_PIX_FMT_RGB24 | |
42 | * YUV420 2 LSB_CBCR V4L2_PIX_FMT_NV12 | |
43 | * YUV420 2 LSB_CRCB V4L2_PIX_FMT_NV21 | |
44 | * YUV420 2 MSB_CBCR V4L2_PIX_FMT_NV21X* | |
45 | * YUV420 2 MSB_CRCB V4L2_PIX_FMT_NV12X* | |
46 | * YUV420 3 x V4L2_PIX_FMT_YUV420 | |
47 | * YUV422 1 YCBYCR V4L2_PIX_FMT_YUYV | |
48 | * YUV422 1 YCRYCB V4L2_PIX_FMT_YVYU | |
49 | * YUV422 1 CBYCRY V4L2_PIX_FMT_UYVY | |
50 | * YUV422 1 CRYCBY V4L2_PIX_FMT_VYUY* | |
51 | * YUV422 2 LSB_CBCR V4L2_PIX_FMT_NV16* | |
52 | * YUV422 2 LSB_CRCB V4L2_PIX_FMT_NV61* | |
53 | * YUV422 2 MSB_CBCR V4L2_PIX_FMT_NV16X* | |
54 | * YUV422 2 MSB_CRCB V4L2_PIX_FMT_NV61X* | |
55 | * YUV422 3 x V4L2_PIX_FMT_YUV422P | |
56 | * | |
57 | */ | |
58 | ||
59 | /* | |
60 | * V 4 L 2 F I M C E X T E N S I O N S | |
61 | * | |
62 | */ | |
5763fb39 T |
63 | /* FOURCC for FIMC specific */ |
64 | #define V4L2_PIX_FMT_NV12X v4l2_fourcc('N', '1', '2', 'X') | |
65 | #define V4L2_PIX_FMT_NV21X v4l2_fourcc('N', '2', '1', 'X') | |
5763fb39 T |
66 | #define V4L2_PIX_FMT_NV16X v4l2_fourcc('N', '1', '6', 'X') |
67 | #define V4L2_PIX_FMT_NV61X v4l2_fourcc('N', '6', '1', 'X') | |
68 | ||
69 | /* CID extensions */ | |
70 | #define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0) | |
71 | #define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9) | |
72 | #define V4L2_CID_GET_PHY_SRC_YADDR (V4L2_CID_PRIVATE_BASE + 12) | |
73 | #define V4L2_CID_GET_PHY_SRC_CADDR (V4L2_CID_PRIVATE_BASE + 13) | |
74 | #define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20) | |
75 | #define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21) | |
76 | ||
77 | /* | |
78 | * U S E R D E F I N E D T Y P E S | |
79 | * | |
80 | */ | |
81 | #define FIMC1_RESERVED_SIZE 32768 | |
82 | ||
83 | enum fimc_overlay_mode { | |
84 | FIMC_OVLY_NOT_FIXED = 0x0, /* Overlay mode isn't fixed. */ | |
85 | FIMC_OVLY_FIFO = 0x1, /* Non-destructive Overlay with FIFO */ | |
86 | FIMC_OVLY_DMA_AUTO = 0x2, /* Non-destructive Overlay with DMA */ | |
87 | FIMC_OVLY_DMA_MANUAL = 0x3, /* Non-destructive Overlay with DMA */ | |
88 | FIMC_OVLY_NONE_SINGLE_BUF = 0x4, /* Destructive Overlay with DMA single destination buffer */ | |
89 | FIMC_OVLY_NONE_MULTI_BUF = 0x5, /* Destructive Overlay with DMA multiple dstination buffer */ | |
90 | }; | |
91 | ||
92 | typedef unsigned int dma_addr_t; | |
93 | ||
94 | struct fimc_buf { | |
95 | dma_addr_t base[3]; | |
96 | size_t size[3]; | |
97 | int planes; | |
98 | }; | |
99 | ||
100 | struct fimc_buffer { | |
101 | void *virt_addr; | |
102 | void *phys_addr; | |
103 | size_t length; | |
104 | }; | |
105 | ||
106 | struct yuv_fmt_list { | |
107 | const char *name; | |
108 | const char *desc; | |
109 | unsigned int fmt; | |
110 | int bpp; | |
111 | int planes; | |
112 | }; | |
113 | ||
114 | struct img_offset { | |
115 | int y_h; | |
116 | int y_v; | |
117 | int cb_h; | |
118 | int cb_v; | |
119 | int cr_h; | |
120 | int cr_v; | |
121 | }; | |
122 | ||
123 | //------------ STRUCT ---------------------------------------------------------// | |
124 | ||
125 | typedef struct | |
126 | { | |
127 | unsigned int full_width; // Source Image Full Width (Virtual screen size) | |
128 | unsigned int full_height; // Source Image Full Height (Virtual screen size) | |
129 | unsigned int start_x; // Source Image Start width offset | |
130 | unsigned int start_y; // Source Image Start height offset | |
131 | unsigned int width; // Source Image Width | |
132 | unsigned int height; // Source Image Height | |
133 | unsigned int buf_addr_phy_rgb_y; // Base Address of the Source Image (RGB or Y): Physical Address | |
134 | unsigned int buf_addr_phy_cb; // Base Address of the Source Image (CB Component) : Physical Address | |
135 | unsigned int buf_addr_phy_cr; // Base Address of the Source Image (CR Component) : Physical Address | |
136 | unsigned int color_space; // Color Space of the Source Image | |
137 | unsigned int planes; // number of planes for the Image | |
138 | } s5p_fimc_img_info; | |
139 | ||
140 | typedef struct | |
141 | { | |
142 | s5p_fimc_img_info src; | |
143 | s5p_fimc_img_info dst; | |
144 | } s5p_fimc_params_t; | |
145 | ||
146 | typedef struct _s5p_fimc_t { | |
147 | int dev_fd; | |
148 | struct fimc_buffer out_buf; | |
149 | ||
150 | s5p_fimc_params_t params; | |
151 | ||
152 | int use_ext_out_mem; | |
153 | } s5p_fimc_t; | |
154 | ||
155 | #endif |