2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 #ifndef __IA_CSS_PIPE_H__
16 #define __IA_CSS_PIPE_H__
18 #include <type_support.h>
19 #include "ia_css_stream.h"
20 #include "ia_css_frame.h"
21 #include "ia_css_pipeline.h"
22 #include "ia_css_binary.h"
23 #include "sh_css_legacy.h"
25 #define PIPE_ENTRY_EMPTY_TOKEN (~0U)
26 #define PIPE_ENTRY_RESERVED_TOKEN (0x1)
28 struct ia_css_preview_settings
{
29 struct ia_css_binary copy_binary
;
30 struct ia_css_binary preview_binary
;
31 struct ia_css_binary vf_pp_binary
;
33 /* 2401 only for these two - do we in fact use them for anything real */
34 struct ia_css_frame
*delay_frames
[MAX_NUM_DELAY_FRAMES
];
35 struct ia_css_frame
*tnr_frames
[NUM_TNR_FRAMES
];
37 struct ia_css_pipe
*copy_pipe
;
38 struct ia_css_pipe
*capture_pipe
;
39 struct ia_css_pipe
*acc_pipe
;
42 #define IA_CSS_DEFAULT_PREVIEW_SETTINGS \
44 IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */\
45 IA_CSS_BINARY_DEFAULT_SETTINGS, /* preview_binary */\
46 IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */\
47 { NULL }, /* dvs_frames */ \
48 { NULL }, /* tnr_frames */ \
49 NULL, /* copy_pipe */\
50 NULL, /* capture_pipe */\
54 struct ia_css_capture_settings
{
55 struct ia_css_binary copy_binary
;
56 /* we extend primary binary to multiple stages because in ISP2.6.1
57 * the computation load is too high to fit in one single binary. */
58 struct ia_css_binary primary_binary
[MAX_NUM_PRIMARY_STAGES
];
59 unsigned int num_primary_stage
;
60 struct ia_css_binary pre_isp_binary
;
61 struct ia_css_binary anr_gdc_binary
;
62 struct ia_css_binary post_isp_binary
;
63 struct ia_css_binary capture_pp_binary
;
64 struct ia_css_binary vf_pp_binary
;
65 struct ia_css_binary capture_ldc_binary
;
66 struct ia_css_binary
*yuv_scaler_binary
;
67 struct ia_css_frame
*delay_frames
[MAX_NUM_VIDEO_DELAY_FRAMES
];
68 bool *is_output_stage
;
69 unsigned int num_yuv_scaler
;
72 #define IA_CSS_DEFAULT_CAPTURE_SETTINGS \
74 IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */\
75 {IA_CSS_BINARY_DEFAULT_SETTINGS}, /* primary_binary */\
76 0, /* num_primary_stage */\
77 IA_CSS_BINARY_DEFAULT_SETTINGS, /* pre_isp_binary */\
78 IA_CSS_BINARY_DEFAULT_SETTINGS, /* anr_gdc_binary */\
79 IA_CSS_BINARY_DEFAULT_SETTINGS, /* post_isp_binary */\
80 IA_CSS_BINARY_DEFAULT_SETTINGS, /* capture_pp_binary */\
81 IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */\
82 IA_CSS_BINARY_DEFAULT_SETTINGS, /* capture_ldc_binary */\
83 NULL, /* yuv_scaler_binary */ \
84 { NULL }, /* delay_frames[ref_frames] */ \
85 NULL, /* is_output_stage */ \
86 0, /* num_yuv_scaler */ \
89 struct ia_css_video_settings
{
90 struct ia_css_binary copy_binary
;
91 struct ia_css_binary video_binary
;
92 struct ia_css_binary vf_pp_binary
;
93 struct ia_css_binary
*yuv_scaler_binary
;
94 struct ia_css_frame
*delay_frames
[MAX_NUM_VIDEO_DELAY_FRAMES
];
96 struct ia_css_frame
*tnr_frames
[NUM_VIDEO_TNR_FRAMES
];
98 struct ia_css_frame
*tnr_frames
[NUM_TNR_FRAMES
];
100 struct ia_css_frame
*vf_pp_in_frame
;
101 struct ia_css_pipe
*copy_pipe
;
102 struct ia_css_pipe
*capture_pipe
;
103 bool *is_output_stage
;
104 unsigned int num_yuv_scaler
;
107 #define IA_CSS_DEFAULT_VIDEO_SETTINGS \
109 IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */ \
110 IA_CSS_BINARY_DEFAULT_SETTINGS, /* video_binary */ \
111 IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */ \
112 NULL, /* yuv_scaler_binary */ \
113 { NULL }, /* delay_frames */ \
114 { NULL }, /* tnr_frames */ \
115 NULL, /* vf_pp_in_frame */ \
116 NULL, /* copy_pipe */ \
117 NULL, /* capture_pipe */ \
118 NULL, /* is_output_stage */ \
119 0, /* num_yuv_scaler */ \
122 struct ia_css_yuvpp_settings
{
123 struct ia_css_binary copy_binary
;
124 struct ia_css_binary
*yuv_scaler_binary
;
125 struct ia_css_binary
*vf_pp_binary
;
126 bool *is_output_stage
;
127 unsigned int num_yuv_scaler
;
128 unsigned int num_vf_pp
;
129 unsigned int num_output
;
132 #define IA_CSS_DEFAULT_YUVPP_SETTINGS \
134 IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */ \
135 NULL, /* yuv_scaler_binary */ \
136 NULL, /* vf_pp_binary */ \
137 NULL, /* is_output_stage */ \
138 0, /* num_yuv_scaler */ \
140 0, /* num_output */ \
146 /* TODO: Remove stop_requested and use stop_requested in the pipeline */
148 struct ia_css_pipe_config config
;
149 struct ia_css_pipe_extra_config extra_config
;
150 struct ia_css_pipe_info info
;
151 enum ia_css_pipe_id mode
;
152 struct ia_css_shading_table
*shading_table
;
153 struct ia_css_pipeline pipeline
;
154 struct ia_css_frame_info output_info
[IA_CSS_PIPE_MAX_OUTPUT_STAGE
];
155 struct ia_css_frame_info bds_output_info
;
156 struct ia_css_frame_info vf_output_info
[IA_CSS_PIPE_MAX_OUTPUT_STAGE
];
157 struct ia_css_frame_info out_yuv_ds_input_info
;
158 struct ia_css_frame_info vf_yuv_ds_input_info
;
159 struct ia_css_fw_info
*output_stage
; /* extra output stage */
160 struct ia_css_fw_info
*vf_stage
; /* extra vf_stage */
161 unsigned int required_bds_factor
;
162 unsigned int dvs_frame_delay
;
163 int num_invalid_frames
;
164 bool enable_viewfinder
[IA_CSS_PIPE_MAX_OUTPUT_STAGE
];
165 struct ia_css_stream
*stream
;
166 struct ia_css_frame in_frame_struct
;
167 struct ia_css_frame out_frame_struct
;
168 struct ia_css_frame vf_frame_struct
;
169 struct ia_css_frame
*continuous_frames
[NUM_CONTINUOUS_FRAMES
];
170 struct ia_css_metadata
*cont_md_buffers
[NUM_CONTINUOUS_FRAMES
];
172 struct ia_css_preview_settings preview
;
173 struct ia_css_video_settings video
;
174 struct ia_css_capture_settings capture
;
175 struct ia_css_yuvpp_settings yuvpp
;
177 hrt_vaddress scaler_pp_lut
;
178 struct osys_object
*osys_obj
;
180 /* This number is unique per pipe each instance of css. This number is
181 * reused as pipeline number also. There is a 1-1 mapping between pipe_num
182 * and sp thread id. Current logic limits pipe_num to
183 * SH_CSS_MAX_SP_THREADS */
184 unsigned int pipe_num
;
187 #define IA_CSS_DEFAULT_PIPE \
189 false, /* stop_requested */ \
190 DEFAULT_PIPE_CONFIG, /* config */ \
191 DEFAULT_PIPE_EXTRA_CONFIG, /* extra_config */ \
192 DEFAULT_PIPE_INFO, /* info */ \
193 IA_CSS_PIPE_ID_ACC, /* mode (pipe_id) */ \
194 NULL, /* shading_table */ \
195 DEFAULT_PIPELINE, /* pipeline */ \
196 {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \
197 IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* bds_output_info */ \
198 {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \
199 IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* out_yuv_ds_input_info */ \
200 IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* vf_yuv_ds_input_info */ \
201 NULL, /* output_stage */ \
202 NULL, /* vf_stage */ \
203 SH_CSS_BDS_FACTOR_1_00, /* required_bds_factor */ \
204 1, /* dvs_frame_delay */ \
205 0, /* num_invalid_frames */ \
206 {true}, /* enable_viewfinder */ \
208 DEFAULT_FRAME, /* in_frame_struct */ \
209 DEFAULT_FRAME, /* out_frame_struct */ \
210 DEFAULT_FRAME, /* vf_frame_struct */ \
211 { NULL }, /* continuous_frames */ \
212 { NULL }, /* cont_md_buffers */ \
213 { IA_CSS_DEFAULT_PREVIEW_SETTINGS }, /* pipe_settings */ \
214 0, /* scaler_pp_lut */ \
215 NULL, /* osys object */ \
216 PIPE_ENTRY_EMPTY_TOKEN, /* pipe_num */\
219 void ia_css_pipe_map_queue(struct ia_css_pipe
*pipe
, bool map
);
222 sh_css_param_update_isp_params(struct ia_css_pipe
*curr_pipe
,
223 struct ia_css_isp_parameters
*params
,
224 bool commit
, struct ia_css_pipe
*pipe
);
228 #endif /* __IA_CSS_PIPE_H__ */