]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/runtime/pipeline/interface/ia_css_pipeline.h
media: atomisp: stop producing hundreds of kernel-doc warnings
[mirror_ubuntu-bionic-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / runtime / pipeline / interface / ia_css_pipeline.h
1 #ifndef ISP2401
2 /*
3 * Support for Intel Camera Imaging ISP subsystem.
4 * Copyright (c) 2015, Intel Corporation.
5 *
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.
9 *
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
13 * more details.
14 */
15 #else
16 /**
17 Support for Intel Camera Imaging ISP subsystem.
18 Copyright (c) 2010 - 2015, Intel Corporation.
19
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.
23
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
27 more details.
28 */
29 #endif
30
31 #ifndef __IA_CSS_PIPELINE_H__
32 #define __IA_CSS_PIPELINE_H__
33
34 #include "sh_css_internal.h"
35 #include "ia_css_pipe_public.h"
36 #include "ia_css_pipeline_common.h"
37
38 #define IA_CSS_PIPELINE_NUM_MAX (20)
39
40
41 /* Pipeline stage to be executed on SP/ISP */
42 struct ia_css_pipeline_stage {
43 unsigned int stage_num;
44 struct ia_css_binary *binary; /* built-in binary */
45 struct ia_css_binary_info *binary_info;
46 const struct ia_css_fw_info *firmware; /* acceleration binary */
47 /* SP function for SP stage */
48 enum ia_css_pipeline_stage_sp_func sp_func;
49 unsigned max_input_width; /* For SP raw copy */
50 struct sh_css_binary_args args;
51 int mode;
52 bool out_frame_allocated[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
53 bool vf_frame_allocated;
54 struct ia_css_pipeline_stage *next;
55 bool enable_zoom;
56 };
57
58 /* Pipeline of n stages to be executed on SP/ISP per stage */
59 struct ia_css_pipeline {
60 enum ia_css_pipe_id pipe_id;
61 uint8_t pipe_num;
62 bool stop_requested;
63 struct ia_css_pipeline_stage *stages;
64 struct ia_css_pipeline_stage *current_stage;
65 unsigned num_stages;
66 struct ia_css_frame in_frame;
67 struct ia_css_frame out_frame[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
68 struct ia_css_frame vf_frame[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
69 unsigned int dvs_frame_delay;
70 unsigned inout_port_config;
71 int num_execs;
72 bool acquire_isp_each_stage;
73 uint32_t pipe_qos_config;
74 };
75
76 #define DEFAULT_PIPELINE \
77 { \
78 IA_CSS_PIPE_ID_PREVIEW, /* pipe_id */ \
79 0, /* pipe_num */ \
80 false, /* stop_requested */ \
81 NULL, /* stages */ \
82 NULL, /* current_stage */ \
83 0, /* num_stages */ \
84 DEFAULT_FRAME, /* in_frame */ \
85 {DEFAULT_FRAME}, /* out_frame */ \
86 {DEFAULT_FRAME}, /* vf_frame */ \
87 IA_CSS_FRAME_DELAY_1, /* frame_delay */ \
88 0, /* inout_port_config */ \
89 -1, /* num_execs */ \
90 true, /* acquire_isp_each_stage */\
91 QOS_INVALID /* pipe_qos_config */\
92 }
93
94 /* Stage descriptor used to create a new stage in the pipeline */
95 struct ia_css_pipeline_stage_desc {
96 struct ia_css_binary *binary;
97 const struct ia_css_fw_info *firmware;
98 enum ia_css_pipeline_stage_sp_func sp_func;
99 unsigned max_input_width;
100 unsigned int mode;
101 struct ia_css_frame *in_frame;
102 struct ia_css_frame *out_frame[IA_CSS_BINARY_MAX_OUTPUT_PORTS];
103 struct ia_css_frame *vf_frame;
104 };
105
106 /* @brief initialize the pipeline module
107 *
108 * @return None
109 *
110 * Initializes the pipeline module. This API has to be called
111 * before any operation on the pipeline module is done
112 */
113 void ia_css_pipeline_init(void);
114
115 /* @brief initialize the pipeline structure with default values
116 *
117 * @param[out] pipeline structure to be initialized with defaults
118 * @param[in] pipe_id
119 * @param[in] pipe_num Number that uniquely identifies a pipeline.
120 * @return IA_CSS_SUCCESS or error code upon error.
121 *
122 * Initializes the pipeline structure with a set of default values.
123 * This API is expected to be used when a pipeline structure is allocated
124 * externally and needs sane defaults
125 */
126 enum ia_css_err ia_css_pipeline_create(
127 struct ia_css_pipeline *pipeline,
128 enum ia_css_pipe_id pipe_id,
129 unsigned int pipe_num,
130 unsigned int dvs_frame_delay);
131
132 /* @brief destroy a pipeline
133 *
134 * @param[in] pipeline
135 * @return None
136 *
137 */
138 void ia_css_pipeline_destroy(struct ia_css_pipeline *pipeline);
139
140
141 /* @brief Starts a pipeline
142 *
143 * @param[in] pipe_id
144 * @param[in] pipeline
145 * @return None
146 *
147 */
148 void ia_css_pipeline_start(enum ia_css_pipe_id pipe_id,
149 struct ia_css_pipeline *pipeline);
150
151 /* @brief Request to stop a pipeline
152 *
153 * @param[in] pipeline
154 * @return IA_CSS_SUCCESS or error code upon error.
155 *
156 */
157 enum ia_css_err ia_css_pipeline_request_stop(struct ia_css_pipeline *pipeline);
158
159 /* @brief Check whether pipeline has stopped
160 *
161 * @param[in] pipeline
162 * @return true if the pipeline has stopped
163 *
164 */
165 bool ia_css_pipeline_has_stopped(struct ia_css_pipeline *pipe);
166
167 /* @brief clean all the stages pipeline and make it as new
168 *
169 * @param[in] pipeline
170 * @return None
171 *
172 */
173 void ia_css_pipeline_clean(struct ia_css_pipeline *pipeline);
174
175 /* @brief Add a stage to pipeline.
176 *
177 * @param pipeline Pointer to the pipeline to be added to.
178 * @param[in] stage_desc The description of the stage
179 * @param[out] stage The successor of the stage.
180 * @return IA_CSS_SUCCESS or error code upon error.
181 *
182 * Add a new stage to a non-NULL pipeline.
183 * The stage consists of an ISP binary or firmware and input and output
184 * arguments.
185 */
186 enum ia_css_err ia_css_pipeline_create_and_add_stage(
187 struct ia_css_pipeline *pipeline,
188 struct ia_css_pipeline_stage_desc *stage_desc,
189 struct ia_css_pipeline_stage **stage);
190
191 /* @brief Finalize the stages in a pipeline
192 *
193 * @param pipeline Pointer to the pipeline to be added to.
194 * @return None
195 *
196 * This API is expected to be called after adding all stages
197 */
198 void ia_css_pipeline_finalize_stages(struct ia_css_pipeline *pipeline,
199 bool continuous);
200
201 /* @brief gets a stage from the pipeline
202 *
203 * @param[in] pipeline
204 * @return IA_CSS_SUCCESS or error code upon error.
205 *
206 */
207 enum ia_css_err ia_css_pipeline_get_stage(struct ia_css_pipeline *pipeline,
208 int mode,
209 struct ia_css_pipeline_stage **stage);
210
211 /* @brief Gets a pipeline stage corresponding Firmware handle from the pipeline
212 *
213 * @param[in] pipeline
214 * @param[in] fw_handle
215 * @param[out] stage Pointer to Stage
216 *
217 * @return IA_CSS_SUCCESS or error code upon error.
218 *
219 */
220 enum ia_css_err ia_css_pipeline_get_stage_from_fw(struct ia_css_pipeline *pipeline,
221 uint32_t fw_handle,
222 struct ia_css_pipeline_stage **stage);
223
224 /* @brief Gets the Firmware handle correponding the stage num from the pipeline
225 *
226 * @param[in] pipeline
227 * @param[in] stage_num
228 * @param[out] fw_handle
229 *
230 * @return IA_CSS_SUCCESS or error code upon error.
231 *
232 */
233 enum ia_css_err ia_css_pipeline_get_fw_from_stage(struct ia_css_pipeline *pipeline,
234 uint32_t stage_num,
235 uint32_t *fw_handle);
236
237 /* @brief gets the output stage from the pipeline
238 *
239 * @param[in] pipeline
240 * @return IA_CSS_SUCCESS or error code upon error.
241 *
242 */
243 enum ia_css_err ia_css_pipeline_get_output_stage(
244 struct ia_css_pipeline *pipeline,
245 int mode,
246 struct ia_css_pipeline_stage **stage);
247
248 /* @brief Checks whether the pipeline uses params
249 *
250 * @param[in] pipeline
251 * @return true if the pipeline uses params
252 *
253 */
254 bool ia_css_pipeline_uses_params(struct ia_css_pipeline *pipeline);
255
256 /**
257 * @brief get the SP thread ID.
258 *
259 * @param[in] key The query key, typical use is pipe_num.
260 * @param[out] val The query value.
261 *
262 * @return
263 * true, if the query succeeds;
264 * false, if the query fails.
265 */
266 bool ia_css_pipeline_get_sp_thread_id(unsigned int key, unsigned int *val);
267
268 #if defined(USE_INPUT_SYSTEM_VERSION_2401)
269 /**
270 * @brief Get the pipeline io status
271 *
272 * @param[in] None
273 * @return
274 * Pointer to pipe_io_status
275 */
276 struct sh_css_sp_pipeline_io_status *ia_css_pipeline_get_pipe_io_status(void);
277 #endif
278
279 /**
280 * @brief Map an SP thread to this pipeline
281 *
282 * @param[in] pipe_num
283 * @param[in] map true for mapping and false for unmapping sp threads.
284 *
285 */
286 void ia_css_pipeline_map(unsigned int pipe_num, bool map);
287
288 /**
289 * @brief Checks whether the pipeline is mapped to SP threads
290 *
291 * @param[in] Query key, typical use is pipe_num
292 *
293 * return
294 * true, pipeline is mapped to SP threads
295 * false, pipeline is not mapped to SP threads
296 */
297 bool ia_css_pipeline_is_mapped(unsigned int key);
298
299 /**
300 * @brief Print pipeline thread mapping
301 *
302 * @param[in] none
303 *
304 * return none
305 */
306 void ia_css_pipeline_dump_thread_map_info(void);
307
308 #endif /*__IA_CSS_PIPELINE_H__*/