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