]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/blob - drivers/staging/media/atomisp/pci/atomisp2/css2400/hive_isp_css_include/host/isp_op_count.h
staging/atomisp: Add support for the Intel IPU v2
[mirror_ubuntu-hirsute-kernel.git] / drivers / staging / media / atomisp / pci / atomisp2 / css2400 / hive_isp_css_include / host / isp_op_count.h
1 /*
2 * Support for Intel Camera Imaging ISP subsystem.
3 * Copyright (c) 2015, Intel Corporation.
4 *
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.
8 *
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
12 * more details.
13 */
14
15 #ifndef __ISP_OP_COUNT_H_INCLUDED__
16 #define __ISP_OP_COUNT_H_INCLUDED__
17
18 #include <stdio.h>
19
20 typedef struct {
21 long long bbb_cnt; /* number of bbb */
22 int bbb_op; /* operations per bbb */
23 long long total_cnt; /* bbb_cnt * bbb_op */
24 } bbb_stat_t;
25
26 typedef enum {
27 bbb_func_OP_1w_and,
28 bbb_func_OP_1w_or,
29 bbb_func_OP_1w_xor,
30 bbb_func_OP_1w_inv,
31 bbb_func_OP_1w_add,
32 bbb_func_OP_1w_sub,
33 bbb_func_OP_1w_addsat,
34 bbb_func_OP_1w_subsat,
35 bbb_func_OP_1w_subasr1,
36 bbb_func_OP_1w_subhalf,
37 bbb_func_OP_1w_subhalfrnd,
38 bbb_func_OP_1w_abs,
39 bbb_func_OP_1w_subabssat,
40 #ifdef ISP2401
41 bbb_func_OP_1w_subsat_u,
42 #endif
43 bbb_func_OP_1w_muld,
44 bbb_func_OP_1w_mul,
45 bbb_func_OP_1w_qmul,
46 bbb_func_OP_1w_qrmul,
47 bbb_func_OP_1w_eq,
48 bbb_func_OP_1w_ne,
49 bbb_func_OP_1w_le,
50 bbb_func_OP_1w_lt,
51 bbb_func_OP_1w_ge,
52 bbb_func_OP_1w_gt,
53 bbb_func_OP_1w_asr,
54 bbb_func_OP_1w_asrrnd,
55 bbb_func_OP_1w_asl,
56 bbb_func_OP_1w_aslsat,
57 bbb_func_OP_1w_lsl,
58 bbb_func_OP_1w_lsr,
59 #ifdef ISP2401
60 bbb_func_OP_1w_ashift,
61 bbb_func_OP_1w_lshift,
62 #endif
63 bbb_func_OP_int_cast_to_1w ,
64 bbb_func_OP_1w_cast_to_int ,
65 bbb_func_OP_1w_cast_to_2w ,
66 bbb_func_OP_2w_cast_to_1w ,
67 bbb_func_OP_2w_sat_cast_to_1w ,
68 bbb_func_OP_1w_clip_asym,
69 bbb_func_OP_1w_clipz,
70 bbb_func_OP_1w_div,
71 bbb_func_OP_1w_qdiv,
72 bbb_func_OP_1w_mod,
73 bbb_func_OP_1w_sqrt_u,
74 bbb_func_OP_1w_mux,
75 bbb_func_OP_1w_avg,
76 bbb_func_OP_1w_avgrnd,
77 bbb_func_OP_1w_min,
78 bbb_func_OP_1w_max,
79 bbb_func_OP_2w_and,
80 bbb_func_OP_2w_or,
81 bbb_func_OP_2w_xor,
82 bbb_func_OP_2w_inv,
83 bbb_func_OP_2w_add,
84 bbb_func_OP_2w_sub,
85 bbb_func_OP_2w_addsat,
86 bbb_func_OP_2w_subsat,
87 bbb_func_OP_2w_subasr1,
88 bbb_func_OP_2w_subhalf,
89 bbb_func_OP_2w_subhalfrnd,
90 bbb_func_OP_2w_abs,
91 bbb_func_OP_2w_subabssat,
92 bbb_func_OP_2w_mul,
93 bbb_func_OP_2w_qmul,
94 bbb_func_OP_2w_qrmul,
95 bbb_func_OP_2w_eq,
96 bbb_func_OP_2w_ne,
97 bbb_func_OP_2w_le,
98 bbb_func_OP_2w_lt,
99 bbb_func_OP_2w_ge,
100 bbb_func_OP_2w_gt,
101 bbb_func_OP_2w_asr,
102 bbb_func_OP_2w_asrrnd,
103 bbb_func_OP_2w_asl,
104 bbb_func_OP_2w_aslsat,
105 bbb_func_OP_2w_lsl,
106 bbb_func_OP_2w_lsr,
107 bbb_func_OP_2w_clip_asym,
108 bbb_func_OP_2w_clipz,
109 bbb_func_OP_2w_div,
110 bbb_func_OP_2w_divh,
111 bbb_func_OP_2w_mod,
112 bbb_func_OP_2w_sqrt_u,
113 bbb_func_OP_2w_mux,
114 bbb_func_OP_2w_avg,
115 bbb_func_OP_2w_avgrnd,
116 bbb_func_OP_2w_min,
117 bbb_func_OP_2w_max,
118 bbb_func_OP_1w_mul_realigning,
119 #ifdef ISP2401
120 bbb_func_OP_1w_imax32,
121 bbb_func_OP_1w_imaxidx32,
122 bbb_func_OP_1w_cond_add,
123 #endif
124
125 bbb_func_num_functions
126 } bbb_functions_t;
127
128 typedef enum {
129 core_func_OP_and,
130 core_func_OP_or,
131 core_func_OP_xor,
132 core_func_OP_inv,
133 core_func_OP_add,
134 core_func_OP_sub,
135 core_func_OP_addsat,
136 core_func_OP_subsat,
137 core_func_OP_subasr1,
138 core_func_OP_abs,
139 core_func_OP_subabssat,
140 #ifdef ISP2401
141 core_func_OP_subsat_u,
142 #endif
143 core_func_OP_muld,
144 core_func_OP_mul,
145 core_func_OP_qrmul,
146 core_func_OP_eq,
147 core_func_OP_ne,
148 core_func_OP_le,
149 core_func_OP_lt,
150 core_func_OP_ge,
151 core_func_OP_gt,
152 core_func_OP_asr,
153 core_func_OP_asl,
154 core_func_OP_asrrnd,
155 core_func_OP_lsl,
156 core_func_OP_lslsat,
157 core_func_OP_lsr,
158 core_func_OP_lsrrnd,
159 core_func_OP_clip_asym,
160 core_func_OP_clipz,
161 core_func_OP_div,
162 core_func_OP_mod,
163 core_func_OP_sqrt,
164 core_func_OP_mux,
165 core_func_OP_avgrnd,
166 core_func_OP_min,
167 core_func_OP_max,
168
169 core_func_num_functions
170
171 } core_functions_t;
172
173 /* inc_bbb_count() can be used for building blocks that are implemented with one operation
174 inc_bbb_count_ext() will be used in case the operation count is not known or greater than one.
175
176 For some operations there is a difference in operation count for the cloned version and the
177 not cloned version. this difference is not vissible on the reference code side.
178 We could add a min and max operation count for those operations, and keep track of those counts
179 separately. That way in the report the impact can be seen. */
180
181 #ifdef DISABLE_OPCNT
182 #define inc_bbb_count(func)
183 #define inc_bbb_count_ext(func, cnt)
184 #define enable_bbb_count()
185 #define disable_bbb_count()
186 #else
187 #define inc_bbb_count(func) _inc_bbb_count(func)
188 #define inc_bbb_count_ext(func, cnt) _inc_bbb_count_ext(func, cnt)
189 #define enable_bbb_count() _enable_bbb_count()
190 #define disable_bbb_count() _disable_bbb_count()
191 #endif
192
193 void
194 inc_core_count_n(
195 core_functions_t func,
196 unsigned n);
197
198 void
199 _enable_bbb_count(void);
200
201 void
202 _disable_bbb_count(void);
203
204 void
205 _inc_bbb_count(
206 bbb_functions_t func);
207
208 void
209 _inc_bbb_count_ext(
210 bbb_functions_t func,
211 int op_count);
212
213 void
214 bbb_func_reset_count(void);
215
216 void
217 bbb_func_print_totals(
218 FILE * fp,
219 unsigned non_zero_only);
220
221 void
222 core_func_print_totals(
223 FILE* fp,
224 unsigned non_zero_only);
225
226 #endif