1 /* SPDX-License-Identifier: GPL-2.0 */ 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 16 #ifndef _SH_CSS_PARAMS_H_ 17 #define _SH_CSS_PARAMS_H_ 18 19 /*! \file */ 20 21 /* Forward declaration to break mutual dependency */ 22 struct ia_css_isp_parameters; 23 24 #include <type_support.h> 25 #include "ia_css_types.h" 26 #include "ia_css_binary.h" 27 #include "sh_css_legacy.h" 28 29 #include "sh_css_defs.h" /* SH_CSS_MAX_STAGES */ 30 #include "ia_css_pipeline.h" 31 #include "ia_css_isp_params.h" 32 #include "uds/uds_1.0/ia_css_uds_param.h" 33 #include "crop/crop_1.0/ia_css_crop_types.h" 34 35 #define PIX_SHIFT_FILTER_RUN_IN_X 12 36 #define PIX_SHIFT_FILTER_RUN_IN_Y 12 37 38 #include "ob/ob_1.0/ia_css_ob_param.h" 39 /* Isp configurations per stream */ 40 struct sh_css_isp_param_configs { 41 /* OB (Optical Black) */ 42 struct sh_css_isp_ob_stream_config ob; 43 }; 44 45 /* Isp parameters per stream */ 46 struct ia_css_isp_parameters { 47 /* UDS */ 48 struct sh_css_sp_uds_params uds[SH_CSS_MAX_STAGES]; 49 struct sh_css_isp_param_configs stream_configs; 50 struct ia_css_fpn_table fpn_config; 51 struct ia_css_vector motion_config; 52 const struct ia_css_morph_table *morph_table; 53 const struct ia_css_shading_table *sc_table; 54 struct ia_css_shading_table *sc_config; 55 struct ia_css_macc_table macc_table; 56 struct ia_css_gamma_table gc_table; 57 struct ia_css_ctc_table ctc_table; 58 struct ia_css_xnr_table xnr_table; 59 60 struct ia_css_dz_config dz_config; 61 struct ia_css_3a_config s3a_config; 62 struct ia_css_wb_config wb_config; 63 struct ia_css_cc_config cc_config; 64 struct ia_css_cc_config yuv2rgb_cc_config; 65 struct ia_css_cc_config rgb2yuv_cc_config; 66 struct ia_css_tnr_config tnr_config; 67 struct ia_css_ob_config ob_config; 68 /*----- DPC configuration -----*/ 69 /* The default DPC configuration is retained and currently set 70 * using the stream configuration. The code generated from genparams 71 * uses this configuration to set the DPC parameters per stage but this 72 * will be overwritten by the per pipe configuration */ 73 struct ia_css_dp_config dp_config; 74 /* ------ pipe specific DPC configuration ------ */ 75 /* Please note that this implementation is a temporary solution and 76 * should be replaced by CSS per pipe configuration when the support 77 * is ready (HSD 1303967698)*/ 78 struct ia_css_dp_config pipe_dp_config[IA_CSS_PIPE_ID_NUM]; 79 struct ia_css_nr_config nr_config; 80 struct ia_css_ee_config ee_config; 81 struct ia_css_de_config de_config; 82 struct ia_css_gc_config gc_config; 83 struct ia_css_anr_config anr_config; 84 struct ia_css_ce_config ce_config; 85 struct ia_css_formats_config formats_config; 86 /* ---- deprecated: replaced with pipe_dvs_6axis_config---- */ 87 struct ia_css_dvs_6axis_config *dvs_6axis_config; 88 struct ia_css_ecd_config ecd_config; 89 struct ia_css_ynr_config ynr_config; 90 struct ia_css_yee_config yee_config; 91 struct ia_css_fc_config fc_config; 92 struct ia_css_cnr_config cnr_config; 93 struct ia_css_macc_config macc_config; 94 struct ia_css_ctc_config ctc_config; 95 struct ia_css_aa_config aa_config; 96 struct ia_css_aa_config bds_config; 97 struct ia_css_aa_config raa_config; 98 struct ia_css_rgb_gamma_table r_gamma_table; 99 struct ia_css_rgb_gamma_table g_gamma_table; 100 struct ia_css_rgb_gamma_table b_gamma_table; 101 struct ia_css_anr_thres anr_thres; 102 struct ia_css_xnr_config xnr_config; 103 struct ia_css_xnr3_config xnr3_config; 104 struct ia_css_uds_config uds_config; 105 struct ia_css_crop_config crop_config; 106 struct ia_css_output_config output_config; 107 struct ia_css_dvs_6axis_config *pipe_dvs_6axis_config[IA_CSS_PIPE_ID_NUM]; 108 /* ------ deprecated(bz675) : from ------ */ 109 struct ia_css_shading_settings shading_settings; 110 /* ------ deprecated(bz675) : to ------ */ 111 struct ia_css_dvs_coefficients dvs_coefs; 112 struct ia_css_dvs2_coefficients dvs2_coefs; 113 114 bool isp_params_changed; 115 116 bool isp_mem_params_changed 117 [IA_CSS_PIPE_ID_NUM][SH_CSS_MAX_STAGES][IA_CSS_NUM_MEMORIES]; 118 bool dz_config_changed; 119 bool motion_config_changed; 120 bool dis_coef_table_changed; 121 bool dvs2_coef_table_changed; 122 bool morph_table_changed; 123 bool sc_table_changed; 124 bool anr_thres_changed; 125 /* ---- deprecated: replaced with pipe_dvs_6axis_config_changed ---- */ 126 bool dvs_6axis_config_changed; 127 /* ------ pipe specific DPC configuration ------ */ 128 /* Please note that this implementation is a temporary solution and 129 * should be replaced by CSS per pipe configuration when the support 130 * is ready (HSD 1303967698) */ 131 bool pipe_dpc_config_changed[IA_CSS_PIPE_ID_NUM]; 132 /* ------ deprecated(bz675) : from ------ */ 133 bool shading_settings_changed; 134 /* ------ deprecated(bz675) : to ------ */ 135 bool pipe_dvs_6axis_config_changed[IA_CSS_PIPE_ID_NUM]; 136 137 bool config_changed[IA_CSS_NUM_PARAMETER_IDS]; 138 139 unsigned int sensor_binning; 140 /* local buffers, used to re-order the 3a statistics in vmem-format */ 141 struct sh_css_ddr_address_map pipe_ddr_ptrs[IA_CSS_PIPE_ID_NUM]; 142 struct sh_css_ddr_address_map_size pipe_ddr_ptrs_size[IA_CSS_PIPE_ID_NUM]; 143 struct sh_css_ddr_address_map ddr_ptrs; 144 struct sh_css_ddr_address_map_size ddr_ptrs_size; 145 struct ia_css_frame 146 *output_frame; /** Output frame the config is to be applied to (optional) */ 147 u32 isp_parameters_id; /** Unique ID to track which config was actually applied to a particular frame */ 148 }; 149 150 void 151 ia_css_params_store_ia_css_host_data( 152 ia_css_ptr ddr_addr, 153 struct ia_css_host_data *data); 154 155 int 156 ia_css_params_store_sctbl( 157 const struct ia_css_pipeline_stage *stage, 158 ia_css_ptr ddr_addr, 159 const struct ia_css_shading_table *shading_table); 160 161 struct ia_css_host_data * 162 ia_css_params_alloc_convert_sctbl( 163 const struct ia_css_pipeline_stage *stage, 164 const struct ia_css_shading_table *shading_table); 165 166 struct ia_css_isp_config * 167 sh_css_pipe_isp_config_get(struct ia_css_pipe *pipe); 168 169 int 170 sh_css_params_map_and_store_default_gdc_lut(void); 171 172 void 173 sh_css_params_free_default_gdc_lut(void); 174 175 ia_css_ptr 176 sh_css_params_get_default_gdc_lut(void); 177 178 ia_css_ptr 179 sh_css_pipe_get_pp_gdc_lut(const struct ia_css_pipe *pipe); 180 181 #endif /* _SH_CSS_PARAMS_H_ */ 182