3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
20 This program is free software; you can redistribute it and/or modify it
21 under the terms and conditions of the GNU General Public License,
22 version 2, as published by the Free Software Foundation.
24 This program is distributed in the hope it will be useful, but WITHOUT
25 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
26 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
31 #ifndef _IA_CSS_BINARY_H_
32 #define _IA_CSS_BINARY_H_
34 #include <type_support.h>
35 #include "ia_css_types.h"
36 #include "ia_css_err.h"
37 #include "ia_css_stream_format.h"
38 #include "ia_css_stream_public.h"
39 #include "ia_css_frame_public.h"
40 #include "sh_css_metrics.h"
41 #include "isp/kernels/fixedbds/fixedbds_1.0/ia_css_fixedbds_types.h"
43 /* The binary mode is used in pre-processor expressions so we cannot
44 * use an enum here. */
45 #define IA_CSS_BINARY_MODE_COPY 0
46 #define IA_CSS_BINARY_MODE_PREVIEW 1
47 #define IA_CSS_BINARY_MODE_PRIMARY 2
48 #define IA_CSS_BINARY_MODE_VIDEO 3
49 #define IA_CSS_BINARY_MODE_PRE_ISP 4
50 #define IA_CSS_BINARY_MODE_GDC 5
51 #define IA_CSS_BINARY_MODE_POST_ISP 6
52 #define IA_CSS_BINARY_MODE_ANR 7
53 #define IA_CSS_BINARY_MODE_CAPTURE_PP 8
54 #define IA_CSS_BINARY_MODE_VF_PP 9
55 #define IA_CSS_BINARY_MODE_PRE_DE 10
56 #define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE0 11
57 #define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE1 12
58 #define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE2 13
59 #define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE3 14
60 #define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE4 15
61 #define IA_CSS_BINARY_MODE_PRIMARY_HQ_STAGE5 16
62 #define IA_CSS_BINARY_NUM_MODES 17
64 #define MAX_NUM_PRIMARY_STAGES 6
65 #define NUM_PRIMARY_HQ_STAGES 6 /* number of primary stages for ISP2.6.1 high quality pipe */
66 #define NUM_PRIMARY_STAGES 1 /* number of primary satges for ISP1/ISP2.2 pipe */
68 /* Indicate where binaries can read input from */
69 #define IA_CSS_BINARY_INPUT_SENSOR 0
70 #define IA_CSS_BINARY_INPUT_MEMORY 1
71 #define IA_CSS_BINARY_INPUT_VARIABLE 2
73 /* Should be included without the path.
74 However, that requires adding the path to numerous makefiles
75 that have nothing to do with isp parameters.
77 #include "runtime/isp_param/interface/ia_css_isp_param_types.h"
79 /* now these ports only include output ports but not vf output ports */
81 IA_CSS_BINARY_OUTPUT_PORT_0 = 0,
82 IA_CSS_BINARY_OUTPUT_PORT_1 = 1,
83 IA_CSS_BINARY_MAX_OUTPUT_PORTS = 2
86 struct ia_css_cas_binary_descr {
87 unsigned int num_stage;
88 unsigned int num_output_stage;
89 struct ia_css_frame_info *in_info;
90 struct ia_css_frame_info *internal_out_info;
91 struct ia_css_frame_info *out_info;
92 struct ia_css_frame_info *vf_info;
93 bool *is_output_stage;
96 #define IA_CSS_DEFAULT_CAS_BINARY_DESCR \
107 struct ia_css_binary_descr {
114 bool enable_high_speed;
115 bool enable_dvs_6axis;
116 bool enable_reduced_pipe;
119 bool enable_fractional_ds;
122 bool enable_luma_only;
125 bool enable_capture_pp_bli;
126 struct ia_css_resolution dvs_env;
127 enum ia_css_stream_format stream_format;
128 struct ia_css_frame_info *in_info; /* the info of the input-frame with the
129 ISP required resolution. */
130 struct ia_css_frame_info *bds_out_info;
131 struct ia_css_frame_info *out_info[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
132 struct ia_css_frame_info *vf_info;
133 unsigned int isp_pipe_version;
134 unsigned int required_bds_factor;
135 int stream_config_left_padding;
138 struct ia_css_binary {
139 const struct ia_css_binary_xinfo *info;
140 enum ia_css_stream_format input_format;
141 struct ia_css_frame_info in_frame_info;
142 struct ia_css_frame_info internal_frame_info;
143 struct ia_css_frame_info out_frame_info[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
144 struct ia_css_resolution effective_in_frame_res;
145 struct ia_css_frame_info vf_frame_info;
146 int input_buf_vectors;
147 int deci_factor_log2;
148 int vf_downscale_log2;
151 int s3atbl_isp_width;
152 int s3atbl_isp_height;
153 unsigned int morph_tbl_width;
154 unsigned int morph_tbl_aligned_width;
155 unsigned int morph_tbl_height;
156 int sctbl_width_per_color;
157 int sctbl_aligned_width_per_color;
160 int sctbl_legacy_width_per_color;
161 int sctbl_legacy_height;
163 struct ia_css_sdis_info dis;
164 struct ia_css_resolution dvs_envelope;
168 unsigned int left_padding;
169 struct sh_css_binary_metrics metrics;
170 struct ia_css_isp_param_host_segments mem_params;
171 struct ia_css_isp_param_css_segments css_params;
176 #define IA_CSS_BINARY_DEFAULT_SETTINGS \
179 IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \
180 IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
181 IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
182 {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
183 { 0, 0},/* effective_in_frame_res */ \
184 IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
185 0, /* input_buf_vectors */ \
186 0, /* deci_factor_log2 */ \
187 0, /* vf_downscale_log2 */ \
188 0, /* s3atbl_width */ \
189 0, /* s3atbl_height */ \
190 0, /* s3atbl_isp_width */ \
191 0, /* s3atbl_isp_height */ \
192 0, /* morph_tbl_width */ \
193 0, /* morph_tbl_aligned_width */ \
194 0, /* morph_tbl_height */ \
195 0, /* sctbl_width_per_color */ \
196 0, /* sctbl_aligned_width_per_color */ \
197 0, /* sctbl_height */ \
198 0, /* sctbl_legacy_width_per_color */ \
199 0, /* sctbl_legacy_height */ \
200 IA_CSS_DEFAULT_SDIS_INFO, /* dis */ \
201 { 0, 0},/* dvs_envelope_info */ \
202 false, /* online */ \
205 0, /* left_padding */ \
206 DEFAULT_BINARY_METRICS, /* metrics */ \
207 IA_CSS_DEFAULT_ISP_MEM_PARAMS, /* mem_params */ \
208 IA_CSS_DEFAULT_ISP_CSS_PARAMS, /* css_params */ \
213 #define IA_CSS_BINARY_DEFAULT_SETTINGS \
216 IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \
217 IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
218 IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
219 {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
220 { 0, 0},/* effective_in_frame_res */ \
221 IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
222 0, /* input_buf_vectors */ \
223 0, /* deci_factor_log2 */ \
224 0, /* vf_downscale_log2 */ \
225 0, /* s3atbl_width */ \
226 0, /* s3atbl_height */ \
227 0, /* s3atbl_isp_width */ \
228 0, /* s3atbl_isp_height */ \
229 0, /* morph_tbl_width */ \
230 0, /* morph_tbl_aligned_width */ \
231 0, /* morph_tbl_height */ \
232 0, /* sctbl_width_per_color */ \
233 0, /* sctbl_aligned_width_per_color */ \
234 0, /* sctbl_height */ \
235 IA_CSS_DEFAULT_SDIS_INFO, /* dis */ \
236 { 0, 0},/* dvs_envelope_info */ \
237 false, /* online */ \
240 0, /* left_padding */ \
241 DEFAULT_BINARY_METRICS, /* metrics */ \
242 IA_CSS_DEFAULT_ISP_MEM_PARAMS, /* mem_params */ \
243 IA_CSS_DEFAULT_ISP_CSS_PARAMS, /* css_params */ \
249 ia_css_binary_init_infos(void);
252 ia_css_binary_uninit(void);
255 ia_css_binary_fill_info(const struct ia_css_binary_xinfo *xinfo,
258 enum ia_css_stream_format stream_format,
259 const struct ia_css_frame_info *in_info,
260 const struct ia_css_frame_info *bds_out_info,
261 const struct ia_css_frame_info *out_info[],
262 const struct ia_css_frame_info *vf_info,
263 struct ia_css_binary *binary,
264 struct ia_css_resolution *dvs_env,
265 int stream_config_left_padding,
269 ia_css_binary_find(struct ia_css_binary_descr *descr,
270 struct ia_css_binary *binary);
272 /** @brief Get the shading information of the specified shading correction type.
274 * @param[in] binary: The isp binary which has the shading correction.
275 * @param[in] type: The shading correction type.
276 * @param[in] required_bds_factor: The bayer downscaling factor required in the pipe.
277 * @param[in] stream_config: The stream configuration.
279 * @param[out] info: The shading information.
281 * @param[out] shading_info: The shading information.
282 * The shading information necessary as API is stored in the shading_info.
284 * The driver needs to get this information to generate
286 * the shading table directly required in the isp.
288 * the shading table directly required from ISP.
289 * @param[out] pipe_config: The pipe configuration.
290 * The shading information related to ISP (but, not necessary as API) is stored in the pipe_config.
292 * @return IA_CSS_SUCCESS or error code upon error.
296 ia_css_binary_get_shading_info(const struct ia_css_binary *binary,
297 enum ia_css_shading_correction_type type,
298 unsigned int required_bds_factor,
299 const struct ia_css_stream_config *stream_config,
301 struct ia_css_shading_info *info);
303 struct ia_css_shading_info *shading_info,
304 struct ia_css_pipe_config *pipe_config);
308 ia_css_binary_3a_grid_info(const struct ia_css_binary *binary,
309 struct ia_css_grid_info *info,
310 struct ia_css_pipe *pipe);
313 ia_css_binary_dvs_grid_info(const struct ia_css_binary *binary,
314 struct ia_css_grid_info *info,
315 struct ia_css_pipe *pipe);
318 ia_css_binary_dvs_stat_grid_info(
319 const struct ia_css_binary *binary,
320 struct ia_css_grid_info *info,
321 struct ia_css_pipe *pipe);
324 ia_css_binary_max_vf_width(void);
327 ia_css_binary_destroy_isp_parameters(struct ia_css_binary *binary);
330 ia_css_binary_get_isp_binaries(struct ia_css_binary_xinfo **binaries,
331 uint32_t *num_isp_binaries);
333 #endif /* _IA_CSS_BINARY_H_ */