Commit 6dc9a256 authored by Jeremy Sowden's avatar Jeremy Sowden Committed by Mauro Carvalho Chehab

media: atomisp: convert default struct values to use compound-literals with designated initializers

The CSS API uses a lot of nested anonymous structs defined in object
macros to assign default values to its data-structures.  These have been
changed to use compound-literals and designated initializers to make
them more comprehensible and less fragile.

The compound-literals can also be used in assignment, which means we can
get rid of some temporary variables whose only purpose is to be
initialized by one of these anonymous structs and then serve as the
rvalue in an assignment expression.

A lot of the members of the default struct values used by the CSS API
were explicitly initialized to zero values.  Designated initializers
have allowed these members, and in some case whole default struct
values, to be removed.
Signed-off-by: default avatarJeremy Sowden <jeremy@azazel.net>
Signed-off-by: default avatarSakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent d82a4a14
...@@ -107,22 +107,6 @@ struct input_formatter_cfg_s { ...@@ -107,22 +107,6 @@ struct input_formatter_cfg_s {
uint32_t block_no_reqs; uint32_t block_no_reqs;
}; };
#define DEFAULT_IF_CONFIG \
{ \
0, /* start_line */\
0, /* start_column */\
0, /* left_padding */\
0, /* cropped_height */\
0, /* cropped_width */\
0, /* deinterleaving */\
0, /*.buf_vecs */\
0, /* buf_start_index */\
0, /* buf_increment */\
0, /* buf_eol_offset */\
false, /* is_yuv420_format */\
false /* block_no_reqs */\
}
extern const hrt_address HIVE_IF_SRST_ADDRESS[N_INPUT_FORMATTER_ID]; extern const hrt_address HIVE_IF_SRST_ADDRESS[N_INPUT_FORMATTER_ID];
extern const hrt_data HIVE_IF_SRST_MASK[N_INPUT_FORMATTER_ID]; extern const hrt_data HIVE_IF_SRST_MASK[N_INPUT_FORMATTER_ID];
extern const uint8_t HIVE_IF_SWITCH_CODE[N_INPUT_FORMATTER_ID]; extern const uint8_t HIVE_IF_SWITCH_CODE[N_INPUT_FORMATTER_ID];
......
...@@ -121,15 +121,9 @@ struct ia_css_frame_info { ...@@ -121,15 +121,9 @@ struct ia_css_frame_info {
}; };
#define IA_CSS_BINARY_DEFAULT_FRAME_INFO \ #define IA_CSS_BINARY_DEFAULT_FRAME_INFO \
{ \ (struct ia_css_frame_info) { \
{0, /* width */ \ .format = IA_CSS_FRAME_FORMAT_NUM, \
0}, /* height */ \ .raw_bayer_order = IA_CSS_BAYER_ORDER_NUM, \
0, /* padded_width */ \
IA_CSS_FRAME_FORMAT_NUM, /* format */ \
0, /* raw_bit_depth */ \
IA_CSS_BAYER_ORDER_NUM, /* raw_bayer_order */ \
{0, /*start col */ \
0}, /*start line */ \
} }
/** /**
...@@ -190,18 +184,11 @@ struct ia_css_frame { ...@@ -190,18 +184,11 @@ struct ia_css_frame {
}; };
#define DEFAULT_FRAME \ #define DEFAULT_FRAME \
{ \ (struct ia_css_frame) { \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* info */ \ .info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
0, /* data */ \ .dynamic_queue_id = SH_CSS_INVALID_QUEUE_ID, \
0, /* data_bytes */ \ .buf_type = IA_CSS_BUFFER_TYPE_INVALID, \
SH_CSS_INVALID_QUEUE_ID, /* dynamic_data_index */ \ .flash_state = IA_CSS_FRAME_FLASH_STATE_NONE, \
IA_CSS_BUFFER_TYPE_INVALID, /* buf_type */ \
IA_CSS_FRAME_FLASH_STATE_NONE, /* flash_state */ \
0, /* exp_id */ \
0, /* isp_config_id */ \
false, /* valid */ \
false, /* contiguous */ \
{ 0 } /* planes */ \
} }
/* @brief Fill a frame with zeros /* @brief Fill a frame with zeros
......
...@@ -40,15 +40,10 @@ struct ia_css_preview_settings { ...@@ -40,15 +40,10 @@ struct ia_css_preview_settings {
}; };
#define IA_CSS_DEFAULT_PREVIEW_SETTINGS \ #define IA_CSS_DEFAULT_PREVIEW_SETTINGS \
{ \ (struct ia_css_preview_settings) { \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */\ .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* preview_binary */\ .preview_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */\ .vf_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
{ NULL }, /* dvs_frames */ \
{ NULL }, /* tnr_frames */ \
NULL, /* copy_pipe */\
NULL, /* capture_pipe */\
NULL, /* acc_pipe */\
} }
struct ia_css_capture_settings { struct ia_css_capture_settings {
...@@ -70,20 +65,15 @@ struct ia_css_capture_settings { ...@@ -70,20 +65,15 @@ struct ia_css_capture_settings {
}; };
#define IA_CSS_DEFAULT_CAPTURE_SETTINGS \ #define IA_CSS_DEFAULT_CAPTURE_SETTINGS \
{ \ (struct ia_css_capture_settings) { \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */\ .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
{IA_CSS_BINARY_DEFAULT_SETTINGS}, /* primary_binary */\ .primary_binary = {IA_CSS_BINARY_DEFAULT_SETTINGS}, \
0, /* num_primary_stage */\ .pre_isp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* pre_isp_binary */\ .anr_gdc_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* anr_gdc_binary */\ .post_isp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* post_isp_binary */\ .capture_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* capture_pp_binary */\ .vf_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */\ .capture_ldc_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* capture_ldc_binary */\
NULL, /* yuv_scaler_binary */ \
{ NULL }, /* delay_frames[ref_frames] */ \
NULL, /* is_output_stage */ \
0, /* num_yuv_scaler */ \
} }
struct ia_css_video_settings { struct ia_css_video_settings {
...@@ -105,18 +95,10 @@ struct ia_css_video_settings { ...@@ -105,18 +95,10 @@ struct ia_css_video_settings {
}; };
#define IA_CSS_DEFAULT_VIDEO_SETTINGS \ #define IA_CSS_DEFAULT_VIDEO_SETTINGS \
{ \ (struct ia_css_video_settings) { \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */ \ .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* video_binary */ \ .video_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* vf_pp_binary */ \ .vf_pp_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
NULL, /* yuv_scaler_binary */ \
{ NULL }, /* delay_frames */ \
{ NULL }, /* tnr_frames */ \
NULL, /* vf_pp_in_frame */ \
NULL, /* copy_pipe */ \
NULL, /* capture_pipe */ \
NULL, /* is_output_stage */ \
0, /* num_yuv_scaler */ \
} }
struct ia_css_yuvpp_settings { struct ia_css_yuvpp_settings {
...@@ -130,14 +112,8 @@ struct ia_css_yuvpp_settings { ...@@ -130,14 +112,8 @@ struct ia_css_yuvpp_settings {
}; };
#define IA_CSS_DEFAULT_YUVPP_SETTINGS \ #define IA_CSS_DEFAULT_YUVPP_SETTINGS \
{ \ (struct ia_css_yuvpp_settings) { \
IA_CSS_BINARY_DEFAULT_SETTINGS, /* copy_binary */ \ .copy_binary = IA_CSS_BINARY_DEFAULT_SETTINGS, \
NULL, /* yuv_scaler_binary */ \
NULL, /* vf_pp_binary */ \
NULL, /* is_output_stage */ \
0, /* num_yuv_scaler */ \
0, /* num_vf_pp */ \
0, /* num_output */ \
} }
struct osys_object; struct osys_object;
...@@ -185,35 +161,26 @@ struct ia_css_pipe { ...@@ -185,35 +161,26 @@ struct ia_css_pipe {
}; };
#define IA_CSS_DEFAULT_PIPE \ #define IA_CSS_DEFAULT_PIPE \
{ \ (struct ia_css_pipe) { \
false, /* stop_requested */ \ .config = DEFAULT_PIPE_CONFIG, \
DEFAULT_PIPE_CONFIG, /* config */ \ .info = DEFAULT_PIPE_INFO, \
DEFAULT_PIPE_EXTRA_CONFIG, /* extra_config */ \ .mode = IA_CSS_PIPE_ID_ACC, /* (pipe_id) */ \
DEFAULT_PIPE_INFO, /* info */ \ .pipeline = DEFAULT_PIPELINE, \
IA_CSS_PIPE_ID_ACC, /* mode (pipe_id) */ \ .output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
NULL, /* shading_table */ \ .bds_output_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
DEFAULT_PIPELINE, /* pipeline */ \ .vf_output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ .out_yuv_ds_input_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* bds_output_info */ \ .vf_yuv_ds_input_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ .required_bds_factor = SH_CSS_BDS_FACTOR_1_00, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* out_yuv_ds_input_info */ \ .dvs_frame_delay = 1, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* vf_yuv_ds_input_info */ \ .enable_viewfinder = {true}, \
NULL, /* output_stage */ \ .in_frame_struct = DEFAULT_FRAME, \
NULL, /* vf_stage */ \ .out_frame_struct = DEFAULT_FRAME, \
SH_CSS_BDS_FACTOR_1_00, /* required_bds_factor */ \ .vf_frame_struct = DEFAULT_FRAME, \
1, /* dvs_frame_delay */ \ .pipe_settings = { \
0, /* num_invalid_frames */ \ .preview = IA_CSS_DEFAULT_PREVIEW_SETTINGS \
{true}, /* enable_viewfinder */ \ }, \
NULL, /* stream */ \ .pipe_num = PIPE_ENTRY_EMPTY_TOKEN, \
DEFAULT_FRAME, /* in_frame_struct */ \
DEFAULT_FRAME, /* out_frame_struct */ \
DEFAULT_FRAME, /* vf_frame_struct */ \
{ NULL }, /* continuous_frames */ \
{ NULL }, /* cont_md_buffers */ \
{ IA_CSS_DEFAULT_PREVIEW_SETTINGS }, /* pipe_settings */ \
0, /* scaler_pp_lut */ \
NULL, /* osys object */ \
PIPE_ENTRY_EMPTY_TOKEN, /* pipe_num */\
} }
void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map); void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map);
......
...@@ -152,82 +152,20 @@ struct ia_css_pipe_config { ...@@ -152,82 +152,20 @@ struct ia_css_pipe_config {
}; };
#ifdef ISP2401
/**
* Default origin of internal frame positioned on shading table.
*/
#define IA_CSS_PIPE_DEFAULT_INTERNAL_FRAME_ORIGIN_BQS_ON_SCTBL \
{ \
0, /* x [bqs] */ \
0 /* y [bqs] */ \
}
/**
* Default settings for newly created pipe configurations.
*/
#define DEFAULT_PIPE_CONFIG \
{ \
IA_CSS_PIPE_MODE_PREVIEW, /* mode */ \
1, /* isp_pipe_version */ \
{ 0, 0 }, /* pipe_effective_input_res */ \
{ 0, 0 }, /* bayer_ds_out_res */ \
{ 0, 0 }, /* vf_pp_in_res */ \
{ 0, 0 }, /* capt_pp_in_res */ \
{ 0, 0 }, /* output_system_in_res */ \
{ 0, 0 }, /* dvs_crop_out_res */ \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \
NULL, /* acc_extension */ \
NULL, /* acc_stages */ \
0, /* num_acc_stages */ \
DEFAULT_CAPTURE_CONFIG, /* default_capture_config */ \
{ 0, 0 }, /* dvs_envelope */ \
IA_CSS_FRAME_DELAY_1, /* dvs_frame_delay */ \
-1, /* acc_num_execs */ \
false, /* enable_dz */ \
false, /* enable_dpc */ \
false, /* enable_vfpp_bci */ \
false, /* enable_luma_only */ \
false, /* enable_tnr */ \
NULL, /* p_isp_config */\
{ 0, 0 }, /* gdc_in_buffer_res */ \
{ 0, 0 }, /* gdc_in_buffer_offset */ \
IA_CSS_PIPE_DEFAULT_INTERNAL_FRAME_ORIGIN_BQS_ON_SCTBL /* internal_frame_origin_bqs_on_sctbl */ \
}
#else
/** /**
* Default settings for newly created pipe configurations. * Default settings for newly created pipe configurations.
*/ */
#define DEFAULT_PIPE_CONFIG \ #define DEFAULT_PIPE_CONFIG \
{ \ (struct ia_css_pipe_config) { \
IA_CSS_PIPE_MODE_PREVIEW, /* mode */ \ .mode = IA_CSS_PIPE_MODE_PREVIEW, \
1, /* isp_pipe_version */ \ .isp_pipe_version = 1, \
{ 0, 0 }, /* pipe_effective_input_res */ \ .output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
{ 0, 0 }, /* bayer_ds_out_res */ \ .vf_output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
{ 0, 0 }, /* vf_pp_in_res */ \ .default_capture_config = DEFAULT_CAPTURE_CONFIG, \
{ 0, 0 }, /* capt_pp_in_res */ \ .dvs_frame_delay = IA_CSS_FRAME_DELAY_1, \
{ 0, 0 }, /* dvs_crop_out_res */ \ .acc_num_execs = -1, \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \
NULL, /* acc_extension */ \
NULL, /* acc_stages */ \
0, /* num_acc_stages */ \
DEFAULT_CAPTURE_CONFIG, /* default_capture_config */ \
{ 0, 0 }, /* dvs_envelope */ \
IA_CSS_FRAME_DELAY_1, /* dvs_frame_delay */ \
-1, /* acc_num_execs */ \
false, /* enable_dz */ \
false, /* enable_dpc */ \
false, /* enable_vfpp_bci */ \
NULL, /* p_isp_config */\
{ 0, 0 }, /* gdc_in_buffer_res */ \
{ 0, 0 } /* gdc_in_buffer_offset */ \
} }
#endif
/* Pipe info, this struct describes properties of a pipe after it's stream has /* Pipe info, this struct describes properties of a pipe after it's stream has
* been created. * been created.
* ~~~** DO NOT ADD NEW FIELD **~~~ This structure will be deprecated. * ~~~** DO NOT ADD NEW FIELD **~~~ This structure will be deprecated.
...@@ -272,33 +210,15 @@ struct ia_css_pipe_info { ...@@ -272,33 +210,15 @@ struct ia_css_pipe_info {
/** /**
* Defaults for ia_css_pipe_info structs. * Defaults for ia_css_pipe_info structs.
*/ */
#ifdef ISP2401
#define DEFAULT_PIPE_INFO \
{ \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* raw_output_info */ \
{ 0, 0}, /* output system in res */ \
DEFAULT_SHADING_INFO, /* shading_info */ \
DEFAULT_GRID_INFO, /* grid_info */ \
0 /* num_invalid_frames */ \
}
#else
#define DEFAULT_PIPE_INFO \ #define DEFAULT_PIPE_INFO \
{ \ (struct ia_css_pipe_info) { \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* output_info */ \ .output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, /* vf_output_info */ \ .vf_output_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, /* raw_output_info */ \ .raw_output_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
DEFAULT_SHADING_INFO, /* shading_info */ \ .shading_info = DEFAULT_SHADING_INFO, \
DEFAULT_GRID_INFO, /* grid_info */ \ .grid_info = DEFAULT_GRID_INFO, \
0 /* num_invalid_frames */ \
} }
#endif
/* @brief Load default pipe configuration /* @brief Load default pipe configuration
* @param[out] pipe_config The pipe configuration. * @param[out] pipe_config The pipe configuration.
* @return None * @return None
......
...@@ -370,52 +370,20 @@ struct ia_css_shading_info { ...@@ -370,52 +370,20 @@ struct ia_css_shading_info {
} info; } info;
}; };
#ifndef ISP2401
/* Default Shading Correction information of Shading Correction Type 1. */
#define DEFAULT_SHADING_INFO_TYPE_1 \
{ \
IA_CSS_SHADING_CORRECTION_TYPE_1, /* type */ \
{ /* info */ \
{ \
0, /* enable */ \
0, /* num_hor_grids */ \
0, /* num_ver_grids */ \
0, /* bqs_per_grid_cell */ \
1, /* bayer_scale_hor_ratio_in */ \
1, /* bayer_scale_hor_ratio_out */ \
1, /* bayer_scale_ver_ratio_in */ \
1, /* bayer_scale_ver_ratio_out */ \
0, /* sc_bayer_origin_x_bqs_on_shading_table */ \
0 /* sc_bayer_origin_y_bqs_on_shading_table */ \
} \
} \
}
#else
/* Default Shading Correction information of Shading Correction Type 1. */ /* Default Shading Correction information of Shading Correction Type 1. */
#define DEFAULT_SHADING_INFO_TYPE_1 \ #define DEFAULT_SHADING_INFO_TYPE_1 \
{ \ (struct ia_css_shading_info) { \
IA_CSS_SHADING_CORRECTION_TYPE_1, /* type */ \ .type = IA_CSS_SHADING_CORRECTION_TYPE_1, \
{ /* info */ \ .info = { \
{ \ .type_1 = { \
0, /* num_hor_grids */ \ .bayer_scale_hor_ratio_in = 1, \
0, /* num_ver_grids */ \ .bayer_scale_hor_ratio_out = 1, \
0, /* bqs_per_grid_cell */ \ .bayer_scale_ver_ratio_in = 1, \
1, /* bayer_scale_hor_ratio_in */ \ .bayer_scale_ver_ratio_out = 1, \
1, /* bayer_scale_hor_ratio_out */ \
1, /* bayer_scale_ver_ratio_in */ \
1, /* bayer_scale_ver_ratio_out */ \
{0, 0}, /* isp_input_sensor_data_res_bqs */ \
{0, 0}, /* sensor_data_res_bqs */ \
{0, 0} /* sensor_data_origin_bqs_on_sctbl */ \
} \ } \
} \ } \
} }
#endif
/* Default Shading Correction information. */ /* Default Shading Correction information. */
#define DEFAULT_SHADING_INFO DEFAULT_SHADING_INFO_TYPE_1 #define DEFAULT_SHADING_INFO DEFAULT_SHADING_INFO_TYPE_1
...@@ -438,12 +406,9 @@ struct ia_css_grid_info { ...@@ -438,12 +406,9 @@ struct ia_css_grid_info {
/* defaults for ia_css_grid_info structs */ /* defaults for ia_css_grid_info structs */
#define DEFAULT_GRID_INFO \ #define DEFAULT_GRID_INFO \
{ \ (struct ia_css_grid_info) { \
0, /* isp_in_width */ \ .dvs_grid = DEFAULT_DVS_GRID_INFO, \
0, /* isp_in_height */ \ .vamem_type = IA_CSS_VAMEM_TYPE_1 \
DEFAULT_3A_GRID_INFO, /* s3a_grid */ \
DEFAULT_DVS_GRID_INFO, /* dvs_grid */ \
IA_CSS_VAMEM_TYPE_1 /* vamem_type */ \
} }
/* Morphing table, used for geometric distortion and chromatic abberration /* Morphing table, used for geometric distortion and chromatic abberration
...@@ -534,11 +499,8 @@ struct ia_css_capture_config { ...@@ -534,11 +499,8 @@ struct ia_css_capture_config {
/* default settings for ia_css_capture_config structs */ /* default settings for ia_css_capture_config structs */
#define DEFAULT_CAPTURE_CONFIG \ #define DEFAULT_CAPTURE_CONFIG \
{ \ (struct ia_css_capture_config) { \
IA_CSS_CAPTURE_MODE_PRIMARY, /* mode (capture) */ \ .mode = IA_CSS_CAPTURE_MODE_PRIMARY, \
false, /* enable_xnr */ \
false, /* enable_raw_output */ \
false /* enable_capture_pp_bli */ \
} }
......
...@@ -98,52 +98,6 @@ struct ia_css_3a_grid_info { ...@@ -98,52 +98,6 @@ struct ia_css_3a_grid_info {
}; };
#if defined(SYSTEM_css_skycam_c0_system)
#if defined USE_NEW_AE_STRUCT || defined USE_NEW_AWB_STRUCT
#define DEFAULT_3A_GRID_INFO \
{ \
0, /* ae_enable */ \
{0,0,0,0,0,0,0}, /* AE: width,height,b_width,b_height,x_start,y_start*/ \
0, /* awb_enable */ \
{0,0,0,0,0,0}, /* AWB: width,height,b_width,b_height,x_start,y_start*/ \
0, /* af_enable */ \
{0,0,0,0,0,0,0}, /* AF: width,height,b_width,b_height,x_start,y_start,ff_en*/ \
0, /* awb_fr_enable */ \
{0,0,0,0,0,0,0}, /* AWB_FR: width,height,b_width,b_height,x_start,y_start,ff_en*/ \
0, /* elem_bit_depth */ \
}
#else
#define DEFAULT_3A_GRID_INFO \
{ \
0, /* ae_enable */ \
{0,0,0,0,0,0,0,0,0}, /* AE: width,height,b_width,b_height,x_start,y_start,x_end,y_end*/ \
0, /* awb_enable */ \
{0,0,0,0,0,0,0,0}, /* AWB: width,height,b_width,b_height,x_start,y_start,x_end,y_end*/ \
0, /* af_enable */ \
{0,0,0,0,0,0,0}, /* AF: width,height,b_width,b_height,x_start,y_start,ff_en*/ \
0, /* awb_fr_enable */ \
{0,0,0,0,0,0,0}, /* AWB_FR: width,height,b_width,b_height,x_start,y_start,ff_en*/ \
0, /* elem_bit_depth */ \
}
#endif /* USE_NEW_AE_STRUCT || defined USE_NEW_AWB_STRUCT */
#else
#define DEFAULT_3A_GRID_INFO \
{ \
0, /* enable */ \
0, /* use_dmem */ \
0, /* has_histogram */ \
0, /* width */ \
0, /* height */ \
0, /* aligned_width */ \
0, /* aligned_height */ \
0, /* bqs_per_grid_cell */ \
0, /* deci_factor_log2 */ \
0, /* elem_bit_depth */ \
}
#endif
/* This struct should be split into 3, for AE, AWB and AF. /* This struct should be split into 3, for AE, AWB and AF.
* However, that will require driver/ 3A lib modifications. * However, that will require driver/ 3A lib modifications.
*/ */
......
...@@ -41,20 +41,6 @@ struct ia_css_sdis_info { ...@@ -41,20 +41,6 @@ struct ia_css_sdis_info {
uint32_t deci_factor_log2; uint32_t deci_factor_log2;
}; };
#define IA_CSS_DEFAULT_SDIS_INFO \
{ \
{ { 0, 0 }, /* dim */ \
{ 0, 0 }, /* pad */ \
}, /* grid */ \
{ { 0, 0 }, /* dim */ \
{ 0, 0 }, /* pad */ \
}, /* coef */ \
{ { 0, 0 }, /* dim */ \
{ 0, 0 }, /* pad */ \
}, /* proj */ \
0, /* dis_deci_factor_log2 */ \
}
/* DVS statistics grid /* DVS statistics grid
* *
* ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes)) * ISP block: SDVS1 (DIS/DVS Support for DIS/DVS ver.1 (2-axes))
...@@ -209,16 +195,17 @@ struct ia_css_dvs_stat_grid_info { ...@@ -209,16 +195,17 @@ struct ia_css_dvs_stat_grid_info {
/* DVS statistics generated by accelerator default grid info /* DVS statistics generated by accelerator default grid info
*/ */
#define DEFAULT_DVS_GRID_INFO { \ #define DEFAULT_DVS_GRID_INFO \
{ \ (union ia_css_dvs_grid_u) { \
{ 0, 0, 0}, /* GBL CFG reg: kappa, match_shifrt, binning mode*/ \ .dvs_stat_grid_info = (struct ia_css_dvs_stat_grid_info) { \
{{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \ .fe_roi_cfg = { \
{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} }, \ [1] = (struct dvs_stat_public_dvs_level_fe_roi_cfg) { \
{{0, 0, 0, 0}, {0, 0, 0}, {0, 0} } }, \ .x_start = 4 \
{{0, 0, 0, 0}, {4, 0, 0, 0}, {0, 0, 0, 0} } } \ } \
} \
} \
} }
/* Union that holds all types of DVS statistics grid info in /* Union that holds all types of DVS statistics grid info in
* CSS format * CSS format
* */ * */
......
...@@ -169,8 +169,7 @@ ia_css_sdis_init_info( ...@@ -169,8 +169,7 @@ ia_css_sdis_init_info(
unsigned enabled) unsigned enabled)
{ {
if (!enabled) { if (!enabled) {
struct ia_css_sdis_info default_dis = IA_CSS_DEFAULT_SDIS_INFO; *dis = (struct ia_css_sdis_info) { };
*dis = default_dis;
return; return;
} }
......
...@@ -93,17 +93,6 @@ struct ia_css_cas_binary_descr { ...@@ -93,17 +93,6 @@ struct ia_css_cas_binary_descr {
bool *is_output_stage; bool *is_output_stage;
}; };
#define IA_CSS_DEFAULT_CAS_BINARY_DESCR \
{ \
0, \
0, \
NULL, \
NULL, \
NULL, \
NULL, \
NULL, \
}
struct ia_css_binary_descr { struct ia_css_binary_descr {
int mode; int mode;
bool online; bool online;
...@@ -171,80 +160,15 @@ struct ia_css_binary { ...@@ -171,80 +160,15 @@ struct ia_css_binary {
struct ia_css_isp_param_css_segments css_params; struct ia_css_isp_param_css_segments css_params;
}; };
#ifdef ISP2401
#define IA_CSS_BINARY_DEFAULT_SETTINGS \ #define IA_CSS_BINARY_DEFAULT_SETTINGS \
{ \ (struct ia_css_binary) { \
NULL, \ .input_format = IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \
IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \ .in_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .internal_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, \ .out_frame_info = {IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \ .vf_frame_info = IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
{ 0, 0},/* effective_in_frame_res */ \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
0, /* input_buf_vectors */ \
0, /* deci_factor_log2 */ \
0, /* vf_downscale_log2 */ \
0, /* s3atbl_width */ \
0, /* s3atbl_height */ \
0, /* s3atbl_isp_width */ \
0, /* s3atbl_isp_height */ \
0, /* morph_tbl_width */ \
0, /* morph_tbl_aligned_width */ \
0, /* morph_tbl_height */ \
0, /* sctbl_width_per_color */ \
0, /* sctbl_aligned_width_per_color */ \
0, /* sctbl_height */ \
0, /* sctbl_legacy_width_per_color */ \
0, /* sctbl_legacy_height */ \
IA_CSS_DEFAULT_SDIS_INFO, /* dis */ \
{ 0, 0},/* dvs_envelope_info */ \
false, /* online */ \
0, /* uds_xc */ \
0, /* uds_yc */ \
0, /* left_padding */ \
DEFAULT_BINARY_METRICS, /* metrics */ \
IA_CSS_DEFAULT_ISP_MEM_PARAMS, /* mem_params */ \
IA_CSS_DEFAULT_ISP_CSS_PARAMS, /* css_params */ \
} }
#else
#define IA_CSS_BINARY_DEFAULT_SETTINGS \
{ \
NULL, \
IA_CSS_STREAM_FORMAT_YUV420_8_LEGACY, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
{IA_CSS_BINARY_DEFAULT_FRAME_INFO}, \
{ 0, 0},/* effective_in_frame_res */ \
IA_CSS_BINARY_DEFAULT_FRAME_INFO, \
0, /* input_buf_vectors */ \
0, /* deci_factor_log2 */ \
0, /* vf_downscale_log2 */ \
0, /* s3atbl_width */ \
0, /* s3atbl_height */ \
0, /* s3atbl_isp_width */ \
0, /* s3atbl_isp_height */ \
0, /* morph_tbl_width */ \
0, /* morph_tbl_aligned_width */ \
0, /* morph_tbl_height */ \
0, /* sctbl_width_per_color */ \
0, /* sctbl_aligned_width_per_color */ \
0, /* sctbl_height */ \
IA_CSS_DEFAULT_SDIS_INFO, /* dis */ \
{ 0, 0},/* dvs_envelope_info */ \
false, /* online */ \
0, /* uds_xc */ \
0, /* uds_yc */ \
0, /* left_padding */ \
DEFAULT_BINARY_METRICS, /* metrics */ \
IA_CSS_DEFAULT_ISP_MEM_PARAMS, /* mem_params */ \
IA_CSS_DEFAULT_ISP_CSS_PARAMS, /* css_params */ \
}
#endif
enum ia_css_err enum ia_css_err
ia_css_binary_init_infos(void); ia_css_binary_init_infos(void);
......
...@@ -490,7 +490,6 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in ...@@ -490,7 +490,6 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in
struct sh_css_shading_table_bayer_origin_compute_results res; struct sh_css_shading_table_bayer_origin_compute_results res;
#else #else
struct sh_css_binary_sc_requirements scr; struct sh_css_binary_sc_requirements scr;
struct ia_css_shading_info default_shading_info_type_1 = DEFAULT_SHADING_INFO_TYPE_1;
#endif #endif
#ifndef ISP2401 #ifndef ISP2401
...@@ -542,7 +541,7 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in ...@@ -542,7 +541,7 @@ ia_css_binary_get_shading_info_type_1(const struct ia_css_binary *binary, /* [in
&res); &res);
if (err != IA_CSS_SUCCESS) if (err != IA_CSS_SUCCESS)
#else #else
*shading_info = default_shading_info_type_1; *shading_info = DEFAULT_SHADING_INFO_TYPE_1;
err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr); err = sh_css_binary_get_sc_requirements(binary, required_bds_factor, stream_config, &scr);
if (err != IA_CSS_SUCCESS) { if (err != IA_CSS_SUCCESS) {
......
...@@ -94,14 +94,5 @@ union ia_css_all_memory_offsets { ...@@ -94,14 +94,5 @@ union ia_css_all_memory_offsets {
} array[IA_CSS_NUM_PARAM_CLASSES]; } array[IA_CSS_NUM_PARAM_CLASSES];
}; };
#define IA_CSS_DEFAULT_ISP_MEM_PARAMS \
{ { { { NULL, 0 } } } }
#define IA_CSS_DEFAULT_ISP_CSS_PARAMS \
{ { { { 0, 0 } } } }
#define IA_CSS_DEFAULT_ISP_ISP_PARAMS \
{ { { { 0, 0 } } } }
#endif /* _IA_CSS_ISP_PARAM_TYPES_H_ */ #endif /* _IA_CSS_ISP_PARAM_TYPES_H_ */
...@@ -74,21 +74,15 @@ struct ia_css_pipeline { ...@@ -74,21 +74,15 @@ struct ia_css_pipeline {
}; };
#define DEFAULT_PIPELINE \ #define DEFAULT_PIPELINE \
{ \ (struct ia_css_pipeline) { \
IA_CSS_PIPE_ID_PREVIEW, /* pipe_id */ \ .pipe_id = IA_CSS_PIPE_ID_PREVIEW, \
0, /* pipe_num */ \ .in_frame = DEFAULT_FRAME, \
false, /* stop_requested */ \ .out_frame = {DEFAULT_FRAME}, \
NULL, /* stages */ \ .vf_frame = {DEFAULT_FRAME}, \
NULL, /* current_stage */ \ .dvs_frame_delay = IA_CSS_FRAME_DELAY_1, \
0, /* num_stages */ \ .num_execs = -1, \
DEFAULT_FRAME, /* in_frame */ \ .acquire_isp_each_stage = true, \
{DEFAULT_FRAME}, /* out_frame */ \ .pipe_qos_config = QOS_INVALID \
{DEFAULT_FRAME}, /* vf_frame */ \
IA_CSS_FRAME_DELAY_1, /* frame_delay */ \
0, /* inout_port_config */ \
-1, /* num_execs */ \
true, /* acquire_isp_each_stage */\
QOS_INVALID /* pipe_qos_config */\
} }
/* Stage descriptor used to create a new stage in the pipeline */ /* Stage descriptor used to create a new stage in the pipeline */
......
...@@ -692,17 +692,16 @@ static void pipeline_init_defaults( ...@@ -692,17 +692,16 @@ static void pipeline_init_defaults(
unsigned int pipe_num, unsigned int pipe_num,
unsigned int dvs_frame_delay) unsigned int dvs_frame_delay)
{ {
struct ia_css_frame init_frame = DEFAULT_FRAME;
unsigned int i; unsigned int i;
pipeline->pipe_id = pipe_id; pipeline->pipe_id = pipe_id;
pipeline->stages = NULL; pipeline->stages = NULL;
pipeline->stop_requested = false; pipeline->stop_requested = false;
pipeline->current_stage = NULL; pipeline->current_stage = NULL;
pipeline->in_frame = init_frame; pipeline->in_frame = DEFAULT_FRAME;
for (i = 0; i < IA_CSS_PIPE_MAX_OUTPUT_STAGE; i++) { for (i = 0; i < IA_CSS_PIPE_MAX_OUTPUT_STAGE; i++) {
pipeline->out_frame[i] = init_frame; pipeline->out_frame[i] = DEFAULT_FRAME;
pipeline->vf_frame[i] = init_frame; pipeline->vf_frame[i] = DEFAULT_FRAME;
} }
pipeline->num_execs = -1; pipeline->num_execs = -1;
pipeline->acquire_isp_each_stage = true; pipeline->acquire_isp_each_stage = true;
......
...@@ -112,8 +112,6 @@ static int thread_alive; ...@@ -112,8 +112,6 @@ static int thread_alive;
#define STATS_ENABLED(stage) (stage && stage->binary && stage->binary->info && \ #define STATS_ENABLED(stage) (stage && stage->binary && stage->binary->info && \
(stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis)) (stage->binary->info->sp.enable.s3a || stage->binary->info->sp.enable.dis))
#define DEFAULT_PLANES { {0, 0, 0, 0} }
struct sh_css my_css; struct sh_css my_css;
int (*sh_css_printf) (const char *fmt, va_list args) = NULL; int (*sh_css_printf) (const char *fmt, va_list args) = NULL;
...@@ -2291,25 +2289,19 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, ...@@ -2291,25 +2289,19 @@ init_pipe_defaults(enum ia_css_pipe_mode mode,
struct ia_css_pipe *pipe, struct ia_css_pipe *pipe,
bool copy_pipe) bool copy_pipe)
{ {
static struct ia_css_pipe default_pipe = IA_CSS_DEFAULT_PIPE;
static struct ia_css_preview_settings prev = IA_CSS_DEFAULT_PREVIEW_SETTINGS;
static struct ia_css_capture_settings capt = IA_CSS_DEFAULT_CAPTURE_SETTINGS;
static struct ia_css_video_settings video = IA_CSS_DEFAULT_VIDEO_SETTINGS;
static struct ia_css_yuvpp_settings yuvpp = IA_CSS_DEFAULT_YUVPP_SETTINGS;
if (pipe == NULL) { if (pipe == NULL) {
IA_CSS_ERROR("NULL pipe parameter"); IA_CSS_ERROR("NULL pipe parameter");
return IA_CSS_ERR_INVALID_ARGUMENTS; return IA_CSS_ERR_INVALID_ARGUMENTS;
} }
/* Initialize pipe to pre-defined defaults */ /* Initialize pipe to pre-defined defaults */
*pipe = default_pipe; *pipe = IA_CSS_DEFAULT_PIPE;
/* TODO: JB should not be needed, but temporary backward reference */ /* TODO: JB should not be needed, but temporary backward reference */
switch (mode) { switch (mode) {
case IA_CSS_PIPE_MODE_PREVIEW: case IA_CSS_PIPE_MODE_PREVIEW:
pipe->mode = IA_CSS_PIPE_ID_PREVIEW; pipe->mode = IA_CSS_PIPE_ID_PREVIEW;
pipe->pipe_settings.preview = prev; pipe->pipe_settings.preview = IA_CSS_DEFAULT_PREVIEW_SETTINGS;
break; break;
case IA_CSS_PIPE_MODE_CAPTURE: case IA_CSS_PIPE_MODE_CAPTURE:
if (copy_pipe) { if (copy_pipe) {
...@@ -2317,11 +2309,11 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, ...@@ -2317,11 +2309,11 @@ init_pipe_defaults(enum ia_css_pipe_mode mode,
} else { } else {
pipe->mode = IA_CSS_PIPE_ID_CAPTURE; pipe->mode = IA_CSS_PIPE_ID_CAPTURE;
} }
pipe->pipe_settings.capture = capt; pipe->pipe_settings.capture = IA_CSS_DEFAULT_CAPTURE_SETTINGS;
break; break;
case IA_CSS_PIPE_MODE_VIDEO: case IA_CSS_PIPE_MODE_VIDEO:
pipe->mode = IA_CSS_PIPE_ID_VIDEO; pipe->mode = IA_CSS_PIPE_ID_VIDEO;
pipe->pipe_settings.video = video; pipe->pipe_settings.video = IA_CSS_DEFAULT_VIDEO_SETTINGS;
break; break;
case IA_CSS_PIPE_MODE_ACC: case IA_CSS_PIPE_MODE_ACC:
pipe->mode = IA_CSS_PIPE_ID_ACC; pipe->mode = IA_CSS_PIPE_ID_ACC;
...@@ -2331,7 +2323,7 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, ...@@ -2331,7 +2323,7 @@ init_pipe_defaults(enum ia_css_pipe_mode mode,
break; break;
case IA_CSS_PIPE_MODE_YUVPP: case IA_CSS_PIPE_MODE_YUVPP:
pipe->mode = IA_CSS_PIPE_ID_YUVPP; pipe->mode = IA_CSS_PIPE_ID_YUVPP;
pipe->pipe_settings.yuvpp = yuvpp; pipe->pipe_settings.yuvpp = IA_CSS_DEFAULT_YUVPP_SETTINGS;
break; break;
default: default:
return IA_CSS_ERR_INVALID_ARGUMENTS; return IA_CSS_ERR_INVALID_ARGUMENTS;
...@@ -5588,8 +5580,7 @@ static enum ia_css_err load_video_binaries(struct ia_css_pipe *pipe) ...@@ -5588,8 +5580,7 @@ static enum ia_css_err load_video_binaries(struct ia_css_pipe *pipe)
/* we build up the pipeline starting at the end */ /* we build up the pipeline starting at the end */
/* YUV post-processing if needed */ /* YUV post-processing if needed */
if (need_scaler) { if (need_scaler) {
struct ia_css_cas_binary_descr cas_scaler_descr struct ia_css_cas_binary_descr cas_scaler_descr = { };
= IA_CSS_DEFAULT_CAS_BINARY_DESCR;
/* NV12 is the common format that is supported by both */ /* NV12 is the common format that is supported by both */
/* yuv_scaler and the video_xx_isp2_min binaries. */ /* yuv_scaler and the video_xx_isp2_min binaries. */
...@@ -6244,8 +6235,8 @@ static enum ia_css_err load_primary_binaries( ...@@ -6244,8 +6235,8 @@ static enum ia_css_err load_primary_binaries(
pipe_out_info->res); pipe_out_info->res);
if (need_extra_yuv_scaler) { if (need_extra_yuv_scaler) {
struct ia_css_cas_binary_descr cas_scaler_descr struct ia_css_cas_binary_descr cas_scaler_descr = { };
= IA_CSS_DEFAULT_CAS_BINARY_DESCR;
err = ia_css_pipe_create_cas_scaler_desc_single_output( err = ia_css_pipe_create_cas_scaler_desc_single_output(
&capt_pp_out_info, &capt_pp_out_info,
pipe_out_info, pipe_out_info,
...@@ -7232,7 +7223,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) ...@@ -7232,7 +7223,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe)
struct ia_css_frame_info *vf_pp_in_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE]; struct ia_css_frame_info *vf_pp_in_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE];
struct ia_css_yuvpp_settings *mycs; struct ia_css_yuvpp_settings *mycs;
struct ia_css_binary *next_binary; struct ia_css_binary *next_binary;
struct ia_css_cas_binary_descr cas_scaler_descr = IA_CSS_DEFAULT_CAS_BINARY_DESCR; struct ia_css_cas_binary_descr cas_scaler_descr = { };
unsigned int i, j; unsigned int i, j;
bool need_isp_copy_binary = false; bool need_isp_copy_binary = false;
...@@ -8827,10 +8818,8 @@ sh_css_init_host_sp_control_vars(void) ...@@ -8827,10 +8818,8 @@ sh_css_init_host_sp_control_vars(void)
*/ */
void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config) void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config)
{ {
struct ia_css_pipe_config def_config = DEFAULT_PIPE_CONFIG;
ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_pipe_config_defaults()\n"); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE, "ia_css_pipe_config_defaults()\n");
*pipe_config = def_config; *pipe_config = DEFAULT_PIPE_CONFIG;
} }
void void
......
...@@ -52,17 +52,6 @@ struct ia_css_pipe_extra_config { ...@@ -52,17 +52,6 @@ struct ia_css_pipe_extra_config {
bool disable_vf_pp; bool disable_vf_pp;
}; };
#define DEFAULT_PIPE_EXTRA_CONFIG \
{ \
false, /* enable_raw_binning */ \
false, /* enable_yuv_ds */ \
false, /* enable_high_speed */ \
false, /* enable_dvs_6axis */ \
false, /* enable_reduced_pipe */ \
false, /* enable_fractional_ds */ \
false, /* disable_vf_pp */ \
}
enum ia_css_err enum ia_css_err
ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,
const struct ia_css_pipe_extra_config *extra_config, const struct ia_css_pipe_extra_config *extra_config,
......
...@@ -24,16 +24,6 @@ struct sh_css_pc_histogram { ...@@ -24,16 +24,6 @@ struct sh_css_pc_histogram {
unsigned *msink; unsigned *msink;
}; };
#if !defined(__USE_DESIGNATED_INITIALISERS__)
#define DEFAULT_PC_HISTOGRAM \
{ \
0, \
NULL, \
NULL, \
NULL \
}
#endif
struct sh_css_binary_metrics { struct sh_css_binary_metrics {
unsigned mode; unsigned mode;
unsigned id; unsigned id;
...@@ -42,17 +32,6 @@ struct sh_css_binary_metrics { ...@@ -42,17 +32,6 @@ struct sh_css_binary_metrics {
struct sh_css_binary_metrics *next; struct sh_css_binary_metrics *next;
}; };
#if !defined(__USE_DESIGNATED_INITIALISERS__)
#define DEFAULT_BINARY_METRICS \
{ \
0, \
0, \
DEFAULT_PC_HISTOGRAM, \
DEFAULT_PC_HISTOGRAM, \
NULL \
}
#endif
struct ia_css_frame_metrics { struct ia_css_frame_metrics {
unsigned num_frames; unsigned num_frames;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment