FAILED: patch "[PATCH] staging: media: atomisp: reduce load_primary_binaries() stack" failed to apply to 5.10-stable tree
Subsystems (5)
[email protected]
maintainerThe patch below does not apply to the 5.10-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.10.y
git checkout FETCH_HEAD
git cherry-pick -x f4d51e55dd47ef467fbe37d8575e20eee41b092d
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026071304-opulently-outburst-4960@gregkh' --subject-prefix 'PATCH 5.10.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From f4d51e55dd47ef467fbe37d8575e20eee41b092d Mon Sep 17 00:00:00 2001
From: Arnd Bergmann <[email protected]>
Date: Wed, 25 Mar 2026 13:59:43 +0100
Subject: [PATCH] staging: media: atomisp: reduce load_primary_binaries() stack
usage
The load_primary_binaries() function is overly complex and has som large variables on the stack, which can cause warnings depending on CONFIG_FRAME_WARN setting:
drivers/staging/media/atomisp/pci/sh_css.c: In function 'load_primary_binaries':drivers/staging/media/atomisp/pci/sh_css.c:5260:1: error: the frame size of 1560 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
Half of the stack usage is for the prim_descr[] array, but only one member of the array is used at any given time.
Reduce the stack usage by turning the array into a single structure.
drivers/staging/media/atomisp/pci/sh_css.c +3 -3
@@ -5019,7 +5019,6 @@ static int load_primary_binaries(struct ia_css_capture_settings *mycs;unsigned int i;bool need_extra_yuv_scaler = false; -struct ia_css_binary_descr prim_descr[MAX_NUM_PRIMARY_STAGES ];IA_CSS_ENTER_PRIVATE ("" );assert (pipe);
@@ -5188,15 +5187,16 @@ static int load_primary_binaries(/* Primary */ for (i =0 ; i < mycs->num_primary_stage; i++) { +struct ia_css_binary_descr prim_descr;struct ia_css_frame_info *local_vf_info =NULL ;if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0 ] && (i == mycs->num_primary_stage -1 )) local_vf_info = &vf_info; -ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr[i], +ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr, &prim_in_info, &prim_out_info, local_vf_info, i); - err =ia_css_binary_find (&prim_descr[i], &mycs->primary_binary[i]); + err =ia_css_binary_find (&prim_descr, &mycs->primary_binary[i]);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
Sasha Levin
maintainerPATCH 1/6 media: atomisp: replace boolean comparison of values with bool variables
From: Aditya Srivastava <[email protected]>
[ Upstream commit c606970d4250dfb95869a563975c08bab148137a ]
There are certain expressions in a condition in atomisp, where a boolean variable is compared with true/false in forms such as (foo == true) or (false != bar), which does not comply with the coding style rule by checkpatch.pl (CHK: BOOL_COMPARISON), according to which the boolean variables should be themselves used in the condition, rather than comparing with true or false.
E.g. In drivers/staging/media/atomisp/pci/atomisp_compat_css20.c:
if (asd->stream_prepared == false) {
Can be replaced with:
if (!asd->stream_prepared) {
Replace such expressions with boolean variables appropriately.
Stable-dep-of: f4d51e55dd47 ("staging: media: atomisp: reduce load_primary_binaries() stack usage")
--- .../staging/media/atomisp/pci/atomisp_compat_css20.c | 2 +- .../atomisp/pci/runtime/isys/src/virtual_isys.c | 12 ++++++------ drivers/staging/media/atomisp/pci/sh_css.c | 12 ++++++------ 3 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/media/atomisp/pci/atomisp_compat_css20.c +1 -1
@@ -1142,7 +1142,7 @@ int atomisp_css_start(struct atomisp_sub_device *asd,* Thus the stream created in set_fmt get destroyed and need to be * recreated in the next stream on. */ -if (asd->stream_prepared == false) { +if (!asd->stream_prepared) {if (__create_pipes (asd)) {dev_err (isp->dev,"create pipe error.\n" );return -EINVAL ;
drivers/staging/media/atomisp/pci/runtime/isys/src/virtual_isys.c +6 -6
@@ -179,12 +179,12 @@ ia_css_isys_error_t ia_css_isys_stream_create( isys_stream->linked_isys_stream_id = isys_stream_descr->linked_isys_stream_id; rc =create_input_system_input_port (isys_stream_descr, &isys_stream->input_port); -if (rc == false) +if (!rc)return false; rc =create_input_system_channel (isys_stream_descr, false, &isys_stream->channel); -if (rc == false) { +if (!rc) {destroy_input_system_input_port (&isys_stream->input_port);return false; }
@@ -204,7 +204,7 @@ ia_css_isys_error_t ia_css_isys_stream_create(if (isys_stream_descr->metadata.enable) { rc =create_input_system_channel (isys_stream_descr, true, &isys_stream->md_channel); -if (rc == false) { +if (!rc) {destroy_input_system_input_port (&isys_stream->input_port);destroy_input_system_channel (&isys_stream->channel);return false;
@@ -248,7 +248,7 @@ ia_css_isys_error_t ia_css_isys_stream_calculate_cfg( isys_stream_descr, &isys_stream_cfg->channel_cfg, false); -if (rc == false) +if (!rc)return false;/* configure metadata channel */
@@ -260,7 +260,7 @@ ia_css_isys_error_t ia_css_isys_stream_calculate_cfg( isys_stream_descr, &isys_stream_cfg->md_channel_cfg, true); -if (rc == false) +if (!rc)return false; }
@@ -269,7 +269,7 @@ ia_css_isys_error_t ia_css_isys_stream_calculate_cfg( &isys_stream->input_port, isys_stream_descr, &isys_stream_cfg->input_port_cfg); -if (rc == false) +if (!rc)return false; isys_stream->valid =1 ;
drivers/staging/media/atomisp/pci/sh_css.c +6 -6
@@ -1058,7 +1058,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"sh_css_config_input_network() enter 0x%p:\n" , stream); -if (stream->config.continuous == true) +if (stream->config.continuous) {if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_CAPTURE ) { pipe = stream->last_pipe;
@@ -5622,7 +5622,7 @@ static int load_video_binaries(struct ia_css_pipe *pipe) }else {/* output from main binary is not yuv line. currently this is * possible only when bci is enabled on vfpp output */ -assert (pipe->config.enable_vfpp_bci == true); +assert (pipe->config.enable_vfpp_bci);ia_css_pipe_get_yuvscaler_binarydesc (pipe, &vf_pp_descr, &mycs->video_binary.vf_frame_info, pipe_vf_out_info,NULL ,NULL );
@@ -8068,7 +8068,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {struct ia_css_frame *tmp_out_frame =NULL ;for (i =0 ; i < num_yuv_scaler; i++) { -if (is_output_stage[i] == true) +if (is_output_stage[i]) tmp_out_frame = out_frame;else tmp_out_frame =NULL ;
@@ -8460,7 +8460,7 @@ sh_css_pipeline_add_acc_stage(struct ia_css_pipeline *pipeline,/* In QoS case, load_extension already called, so skipping */ int err =0 ; -if (fw->loaded == false) +if (!fw->loaded) err =acc_load_extension (fw); ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@@ -9697,8 +9697,8 @@ ia_css_stream_destroy(struct ia_css_stream *stream) {assert (entry);if (entry) {/* get the SP thread id */ -if (ia_css_pipeline_get_sp_thread_id ( -ia_css_pipe_get_pipe_num (entry), &sp_thread_id) != true) +if (!ia_css_pipeline_get_sp_thread_id ( +ia_css_pipe_get_pipe_num (entry), &sp_thread_id))return -EINVAL ;/* get the target input terminal */ sp_pipeline_input_terminal =
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/6 media: staging: media: atomisp: Fix sh_css.c brace coding style issues
From: Martiros Shakhzadyan <[email protected]>
[ Upstream commit 6ceb557604e85c55bce0585216623c21c7a00453 ]
Fix brace coding style issues.
Stable-dep-of: f4d51e55dd47 ("staging: media: atomisp: reduce load_primary_binaries() stack usage")
--- drivers/staging/media/atomisp/pci/sh_css.c | 224 +++++++++------------ 1 file changed, 90 insertions(+), 134 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +90 -134
@@ -456,15 +456,15 @@ static enum ia_css_frame_format yuv422_copy_formats[] = {* by the copy binary given the stream format. * */ static int -verify_copy_out_frame_format (struct ia_css_pipe *pipe) { +verify_copy_out_frame_format (struct ia_css_pipe *pipe) +{enum ia_css_frame_format out_fmt = pipe->output_info[0 ].format;unsigned int i, found =0 ;assert (pipe);assert (pipe->stream); -switch (pipe->stream->config.input_config.format) - { +switch (pipe->stream->config.input_config.format) {case ATOMISP_INPUT_FORMAT_YUV420_8_LEGACY :case ATOMISP_INPUT_FORMAT_YUV420_8 :for (i =0 ; i <ARRAY_SIZE (yuv420_copy_formats) && !found; i++)
@@ -532,7 +532,8 @@ ia_css_stream_input_format_bits_per_pixel(struct ia_css_stream *stream)#if !defined(ISP2401 )static int -sh_css_config_input_network (struct ia_css_stream *stream) { +sh_css_config_input_network (struct ia_css_stream *stream) +{unsigned int fmt_type;struct ia_css_pipe *pipe = stream->last_pipe;struct ia_css_binary *binary =NULL ;
@@ -558,8 +559,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) { stream->config.mode);if ((binary && (binary->online || stream->config.continuous)) || - pipe->config.mode ==IA_CSS_PIPE_MODE_COPY ) - { + pipe->config.mode ==IA_CSS_PIPE_MODE_COPY ) { err =ia_css_ifmtr_configure (&stream->config, binary);if (err)
@@ -567,8 +567,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) { }if (stream->config.mode ==IA_CSS_INPUT_MODE_TPG || - stream->config.mode ==IA_CSS_INPUT_MODE_PRBS ) - { + stream->config.mode ==IA_CSS_INPUT_MODE_PRBS ) {unsigned int hblank_cycles =100 , vblank_lines =6 , width,
@@ -723,35 +722,32 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_id(switch (stream_cfg->mode) {case IA_CSS_INPUT_MODE_TPG : -if (stream_cfg->source.tpg.id ==IA_CSS_TPG_ID0 ) { +if (stream_cfg->source.tpg.id ==IA_CSS_TPG_ID0 ) isys_stream_descr->input_port_id =INPUT_SYSTEM_PIXELGEN_PORT0_ID ; - }else if (stream_cfg->source.tpg.id ==IA_CSS_TPG_ID1 ) { +else if (stream_cfg->source.tpg.id ==IA_CSS_TPG_ID1 ) isys_stream_descr->input_port_id =INPUT_SYSTEM_PIXELGEN_PORT1_ID ; - }else if (stream_cfg->source.tpg.id ==IA_CSS_TPG_ID2 ) { +else if (stream_cfg->source.tpg.id ==IA_CSS_TPG_ID2 ) isys_stream_descr->input_port_id =INPUT_SYSTEM_PIXELGEN_PORT2_ID ; - }break ;case IA_CSS_INPUT_MODE_PRBS : -if (stream_cfg->source.prbs.id ==IA_CSS_PRBS_ID0 ) { +if (stream_cfg->source.prbs.id ==IA_CSS_PRBS_ID0 ) isys_stream_descr->input_port_id =INPUT_SYSTEM_PIXELGEN_PORT0_ID ; - }else if (stream_cfg->source.prbs.id ==IA_CSS_PRBS_ID1 ) { +else if (stream_cfg->source.prbs.id ==IA_CSS_PRBS_ID1 ) isys_stream_descr->input_port_id =INPUT_SYSTEM_PIXELGEN_PORT1_ID ; - }else if (stream_cfg->source.prbs.id ==IA_CSS_PRBS_ID2 ) { +else if (stream_cfg->source.prbs.id ==IA_CSS_PRBS_ID2 ) isys_stream_descr->input_port_id =INPUT_SYSTEM_PIXELGEN_PORT2_ID ; - }break ;case IA_CSS_INPUT_MODE_BUFFERED_SENSOR : -if (stream_cfg->source.port.port ==MIPI_PORT0_ID ) { +if (stream_cfg->source.port.port ==MIPI_PORT0_ID ) isys_stream_descr->input_port_id =INPUT_SYSTEM_CSI_PORT0_ID ; - }else if (stream_cfg->source.port.port ==MIPI_PORT1_ID ) { +else if (stream_cfg->source.port.port ==MIPI_PORT1_ID ) isys_stream_descr->input_port_id =INPUT_SYSTEM_CSI_PORT1_ID ; - }else if (stream_cfg->source.port.port ==MIPI_PORT2_ID ) { +else if (stream_cfg->source.port.port ==MIPI_PORT2_ID ) isys_stream_descr->input_port_id =INPUT_SYSTEM_CSI_PORT2_ID ; - }break ;default :
@@ -804,15 +800,14 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_attr( rc = true;switch (stream_cfg->mode) {case IA_CSS_INPUT_MODE_TPG : -if (stream_cfg->source.tpg.mode ==IA_CSS_TPG_MODE_RAMP ) { +if (stream_cfg->source.tpg.mode ==IA_CSS_TPG_MODE_RAMP ) isys_stream_descr->tpg_port_attr.mode =PIXELGEN_TPG_MODE_RAMP ; - }else if (stream_cfg->source.tpg.mode ==IA_CSS_TPG_MODE_CHECKERBOARD ) { +else if (stream_cfg->source.tpg.mode ==IA_CSS_TPG_MODE_CHECKERBOARD ) isys_stream_descr->tpg_port_attr.mode =PIXELGEN_TPG_MODE_CHBO ; - }else if (stream_cfg->source.tpg.mode ==IA_CSS_TPG_MODE_MONO ) { +else if (stream_cfg->source.tpg.mode ==IA_CSS_TPG_MODE_MONO ) isys_stream_descr->tpg_port_attr.mode =PIXELGEN_TPG_MODE_MONO ; - }else { +else rc = false; - }/* * TODO
@@ -951,12 +946,12 @@ static bool sh_css_translate_stream_cfg_to_input_system_input_port_resolution( stream_cfg->mode == IA_CSS_INPUT_MODE_BUFFERED_SENSOR) && stream_cfg->source.port.compression.type != IA_CSS_CSI2_COMPRESSION_TYPE_NONE) {if (stream_cfg->source.port.compression.uncompressed_bits_per_pixel == -UNCOMPRESSED_BITS_PER_PIXEL_10 ) { +UNCOMPRESSED_BITS_PER_PIXEL_10 ) fmt_type =ATOMISP_INPUT_FORMAT_RAW_10 ; - }else if (stream_cfg->source.port.compression.uncompressed_bits_per_pixel == -UNCOMPRESSED_BITS_PER_PIXEL_12 ) { +else if (stream_cfg->source.port.compression.uncompressed_bits_per_pixel == +UNCOMPRESSED_BITS_PER_PIXEL_12 ) fmt_type =ATOMISP_INPUT_FORMAT_RAW_12 ; - }else +else return false; }
@@ -1043,7 +1038,8 @@ static bool sh_css_translate_binary_info_to_input_system_output_port_attr( }static int -sh_css_config_input_network (struct ia_css_stream *stream) { +sh_css_config_input_network (struct ia_css_stream *stream) +{bool rc;ia_css_isys_descr_t isys_stream_descr;unsigned int sp_thread_id;
@@ -1058,19 +1054,16 @@ sh_css_config_input_network(struct ia_css_stream *stream) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"sh_css_config_input_network() enter 0x%p:\n" , stream); -if (stream->config.continuous) - { -if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_CAPTURE ) { +if (stream->config.continuous) { +if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_CAPTURE ) pipe = stream->last_pipe; - }else if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_YUVPP ) { +else if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_YUVPP ) pipe = stream->last_pipe; - }else if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_PREVIEW ) { +else if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_PREVIEW ) pipe = stream->last_pipe->pipe_settings.preview.copy_pipe; - }else if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_VIDEO ) { +else if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_VIDEO ) pipe = stream->last_pipe->pipe_settings.video.copy_pipe; - } - }else - { + }else { pipe = stream->last_pipe;if (stream->last_pipe->config.mode ==IA_CSS_PIPE_MODE_CAPTURE ) {/*
@@ -1093,8 +1086,7 @@ sh_css_config_input_network(struct ia_css_stream *stream) {if (pipe->pipeline.stages->binary) binary = pipe->pipeline.stages->binary; -if (binary) - { +if (binary) {/* this was being done in ifmtr in 2400. * online and cont bypass the init_in_frameinfo_memory_defaults * so need to do it here
@@ -1208,11 +1200,10 @@ static inline struct ia_css_pipe *stream_get_target_pipe(struct ia_css_pipe *target_pipe;/* get the pipe that consumes the stream */ -if (stream->config.continuous) { +if (stream->config.continuous) target_pipe =stream_get_copy_pipe (stream); - }else { +else target_pipe =stream_get_last_pipe (stream); - }return target_pipe; }
@@ -1386,7 +1377,8 @@ start_binary(struct ia_css_pipe *pipe,/* start the copy function on the SP */ static int start_copy_on_sp (struct ia_css_pipe *pipe, -struct ia_css_frame *out_frame) { +struct ia_css_frame *out_frame) +{ (void )out_frame;assert (pipe);assert (pipe->stream);
@@ -1404,8 +1396,7 @@ start_copy_on_sp(struct ia_css_pipe *pipe,sh_css_sp_start_binary_copy (ia_css_pipe_get_pipe_num (pipe), out_frame, pipe->stream->config.pixels_per_clock ==2 );#if !defined(ISP2401 ) -if (pipe->stream->reconfigure_css_rx) - { +if (pipe->stream->reconfigure_css_rx) {ia_css_isys_rx_configure (&pipe->stream->csi_rx_config, pipe->stream->config.mode); pipe->stream->reconfigure_css_rx = false;
@@ -1594,7 +1585,8 @@ ia_css_reset_defaults(struct sh_css *css)int ia_css_load_firmware (struct device *dev,const struct ia_css_env *env, -const struct ia_css_fw *fw) { +const struct ia_css_fw *fw) +{int err;if (!env)
@@ -1605,16 +1597,14 @@ ia_css_load_firmware(struct device *dev, const struct ia_css_env *env,ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_load_firmware() enter\n" );/* make sure we initialize my_css */ -if (my_css.flush != env->cpu_mem_env.flush) - { +if (my_css.flush != env->cpu_mem_env.flush) {ia_css_reset_defaults (&my_css); my_css.flush = env->cpu_mem_env.flush; }ia_css_unload_firmware ();/* in case we are called twice */ err =sh_css_load_firmware (dev, fw->data, fw->bytes); -if (!err) - { +if (!err) { err =ia_css_binary_init_infos ();if (!err) fw_explicitly_loaded = true;
@@ -1628,7 +1618,8 @@ int ia_css_init(struct device *dev, const struct ia_css_env *env, const struct ia_css_fw *fw, u32 mmu_l1_base, - enum ia_css_irq_type irq_type) { + enum ia_css_irq_type irq_type) +{ int err;ia_css_spctrl_cfg spctrl_cfg;
@@ -1702,16 +1693,14 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, my_css.flush = flush_func; err =ia_css_rmgr_init (); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err);return err; }IA_CSS_LOG ("init: %d" , my_css_save_initialized); -if (!my_css_save_initialized) - { +if (!my_css_save_initialized) { my_css_save_initialized = true; my_css_save.mode = sh_css_mode_working; memset(my_css_save.stream_seeds, 0,
@@ -1739,19 +1728,16 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,gpio_reg_store (GPIO0_ID , _gpio_block_reg_do_0,0 ); err =ia_css_refcount_init (REFCOUNT_SIZE ); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err);return err; } err =sh_css_params_init (); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err);return err; } -if (fw) - { +if (fw) {ia_css_unload_firmware ();/* in case we already had firmware loaded */ err =sh_css_load_firmware (dev, fw->data, fw->bytes);if (err) {
@@ -1772,23 +1758,20 @@ ia_css_init(struct device *dev, const struct ia_css_env *env,return -EINVAL ; err =ia_css_spctrl_load_fw (SP0_ID , &spctrl_cfg); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err);return err; }#if WITH_PC_MONITORING -if (!thread_alive) - { +if (!thread_alive) { thread_alive++;sh_css_print ("PC_MONITORING: %s() -- create thread DISABLED\n" , __func__);spying_thread_create (); }#endif -if (!sh_css_hrt_system_is_idle ()) - { +if (!sh_css_hrt_system_is_idle ()) {IA_CSS_LEAVE_ERR (-EBUSY );return -EBUSY ; }
@@ -1821,7 +1804,8 @@ ia_css_init(struct device *dev, const struct ia_css_env *env, }int -ia_css_enable_isys_event_queue (bool enable) { +ia_css_enable_isys_event_queue (bool enable) +{if (sh_css_sp_is_running ())return -EBUSY ;sh_css_sp_enable_isys_event_queue (enable);
@@ -1842,7 +1826,8 @@ sh_css_flush(struct ia_css_acc_fw *fw)* doing it from stream_create since we could run out of sp threads due to * allocation on inactive pipelines. */ static int -map_sp_threads (struct ia_css_stream *stream,bool map) { +map_sp_threads (struct ia_css_stream *stream,bool map) +{struct ia_css_pipe *main_pipe =NULL ;struct ia_css_pipe *copy_pipe =NULL ;struct ia_css_pipe *capture_pipe =NULL ;
@@ -1854,8 +1839,7 @@ map_sp_threads(struct ia_css_stream *stream, bool map) {IA_CSS_ENTER_PRIVATE ("stream = %p, map = %s" , stream, map ?"true" :"false" ); -if (!stream) - { +if (!stream) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -1865,8 +1849,7 @@ map_sp_threads(struct ia_css_stream *stream, bool map) {ia_css_pipeline_map (main_pipe->pipe_num, map); -switch (pipe_id) - { +switch (pipe_id) {case IA_CSS_PIPE_ID_PREVIEW : copy_pipe = main_pipe->pipe_settings.preview.copy_pipe; capture_pipe = main_pipe->pipe_settings.preview.capture_pipe;
@@ -1885,23 +1868,17 @@ map_sp_threads(struct ia_css_stream *stream, bool map) { }if (acc_pipe) - {ia_css_pipeline_map (acc_pipe->pipe_num, map); - }if (capture_pipe) - {ia_css_pipeline_map (capture_pipe->pipe_num, map); - }/* Firmware expects copy pipe to be the last pipe mapped. (if needed) */ if (copy_pipe) - {ia_css_pipeline_map (copy_pipe->pipe_num, map); - } +/* DH regular multi pipe - not continuous mode: map the next pipes too */ -if (!stream->config.continuous) - { +if (!stream->config.continuous) {int i;for (i =1 ; i < stream->num_pipes; i++)
@@ -1915,7 +1892,8 @@ map_sp_threads(struct ia_css_stream *stream, bool map) {/* creates a host pipeline skeleton for all pipes in a stream. Called during * stream_create. */ static int -create_host_pipeline_structure (struct ia_css_stream *stream) { +create_host_pipeline_structure (struct ia_css_stream *stream) +{struct ia_css_pipe *copy_pipe =NULL , *capture_pipe =NULL ;struct ia_css_pipe *acc_pipe =NULL ;enum ia_css_pipe_id pipe_id;
@@ -1927,24 +1905,21 @@ create_host_pipeline_structure(struct ia_css_stream *stream) {assert (stream);IA_CSS_ENTER_PRIVATE ("stream = %p" , stream); -if (!stream) - { +if (!stream) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; } main_pipe = stream->last_pipe;assert (main_pipe); -if (!main_pipe) - { +if (!main_pipe) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; } pipe_id = main_pipe->mode; -switch (pipe_id) - { +switch (pipe_id) {case IA_CSS_PIPE_ID_PREVIEW : copy_pipe = main_pipe->pipe_settings.preview.copy_pipe; copy_pipe_delay = main_pipe->dvs_frame_delay;
@@ -1984,30 +1959,23 @@ create_host_pipeline_structure(struct ia_css_stream *stream) { }if (!(err) && copy_pipe) - { err =ia_css_pipeline_create (©_pipe->pipeline, copy_pipe->mode, copy_pipe->pipe_num, copy_pipe_delay); - }if (!(err) && capture_pipe) - { err =ia_css_pipeline_create (&capture_pipe->pipeline, capture_pipe->mode, capture_pipe->pipe_num, capture_pipe_delay); - }if (!(err) && acc_pipe) - { err =ia_css_pipeline_create (&acc_pipe->pipeline, acc_pipe->mode, acc_pipe->pipe_num, main_pipe->dvs_frame_delay); - }/* DH regular multi pipe - not continuous mode: create the next pipelines too */ -if (!stream->config.continuous) - { +if (!stream->config.continuous) {int i;for (i =1 ; i < stream->num_pipes &&0 == err; i++) {
@@ -2026,7 +1994,8 @@ create_host_pipeline_structure(struct ia_css_stream *stream) {/* creates a host pipeline for all pipes in a stream. Called during * stream_start. */ static int -create_host_pipeline (struct ia_css_stream *stream) { +create_host_pipeline (struct ia_css_stream *stream) +{struct ia_css_pipe *copy_pipe =NULL , *capture_pipe =NULL ;struct ia_css_pipe *acc_pipe =NULL ;enum ia_css_pipe_id pipe_id;
@@ -2035,8 +2004,7 @@ create_host_pipeline(struct ia_css_stream *stream) {unsigned int max_input_width =0 ;IA_CSS_ENTER_PRIVATE ("stream = %p" , stream); -if (!stream) - { +if (!stream) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -2047,8 +2015,7 @@ create_host_pipeline(struct ia_css_stream *stream) {/* No continuous frame allocation for capture pipe. It uses the * "main" pipe's frames. */ if ((pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) || - (pipe_id ==IA_CSS_PIPE_ID_VIDEO )) - { + (pipe_id ==IA_CSS_PIPE_ID_VIDEO )) {/* About pipe_id == IA_CSS_PIPE_ID_PREVIEW && stream->config.mode != IA_CSS_INPUT_MODE_MEMORY: * The original condition pipe_id == IA_CSS_PIPE_ID_PREVIEW is too strong. E.g. in SkyCam (with memory * based input frames) there is no continuous mode and thus no need for allocated continuous frames
@@ -2066,24 +2033,21 @@ create_host_pipeline(struct ia_css_stream *stream) {#if !defined(ISP2401 )/* old isys: need to allocate_mipi_frames() even in IA_CSS_PIPE_MODE_COPY */ -if (pipe_id !=IA_CSS_PIPE_ID_ACC ) - { +if (pipe_id !=IA_CSS_PIPE_ID_ACC ) { err =allocate_mipi_frames (main_pipe, &stream->info);if (err) goto ERR; }#elif defined(ISP2401 )if ((pipe_id !=IA_CSS_PIPE_ID_ACC ) && - (main_pipe->config.mode !=IA_CSS_PIPE_MODE_COPY )) - { + (main_pipe->config.mode !=IA_CSS_PIPE_MODE_COPY )) { err =allocate_mipi_frames (main_pipe, &stream->info);if (err) goto ERR; }#endif -switch (pipe_id) - { +switch (pipe_id) {case IA_CSS_PIPE_ID_PREVIEW : copy_pipe = main_pipe->pipe_settings.preview.copy_pipe; capture_pipe = main_pipe->pipe_settings.preview.capture_pipe;
@@ -2133,31 +2097,27 @@ create_host_pipeline(struct ia_css_stream *stream) {if (err) goto ERR; -if (copy_pipe) - { +if (copy_pipe) { err =create_host_copy_pipeline (copy_pipe, max_input_width, main_pipe->continuous_frames[0 ]);if (err) goto ERR; } -if (capture_pipe) - { +if (capture_pipe) { err =create_host_capture_pipeline (capture_pipe);if (err) goto ERR; } -if (acc_pipe) - { +if (acc_pipe) { err =create_host_acc_pipeline (acc_pipe);if (err) goto ERR; }/* DH regular multi pipe - not continuous mode: create the next pipelines too */ -if (!stream->config.continuous) - { +if (!stream->config.continuous) {int i;for (i =1 ; i < stream->num_pipes &&0 == err; i++) {
@@ -2199,10 +2159,10 @@ static const struct ia_css_yuvpp_settings yuvpp = IA_CSS_DEFAULT_YUVPP_SETTINGS;static int init_pipe_defaults (enum ia_css_pipe_mode mode,struct ia_css_pipe *pipe, -bool copy_pipe) { +bool copy_pipe) +{ -if (!pipe) - { +if (!pipe) {IA_CSS_ERROR ("NULL pipe parameter" );return -EINVAL ; }
@@ -2211,18 +2171,17 @@ init_pipe_defaults(enum ia_css_pipe_mode mode,memcpy (pipe, &default_pipe,sizeof (default_pipe));/* TODO: JB should not be needed, but temporary backward reference */ -switch (mode) - { +switch (mode) {case IA_CSS_PIPE_MODE_PREVIEW : pipe->mode =IA_CSS_PIPE_ID_PREVIEW ;memcpy (&pipe->pipe_settings.preview, &preview,sizeof (preview));break ;case IA_CSS_PIPE_MODE_CAPTURE : -if (copy_pipe) { +if (copy_pipe) pipe->mode =IA_CSS_PIPE_ID_COPY ; - }else { +else pipe->mode =IA_CSS_PIPE_ID_CAPTURE ; - } +memcpy (&pipe->pipe_settings.capture, &capture,sizeof (capture));break ;case IA_CSS_PIPE_MODE_VIDEO :
@@ -2252,27 +2211,25 @@ pipe_global_init(void)u8 i; my_css.pipe_counter =0 ; -for (i =0 ; i <IA_CSS_PIPELINE_NUM_MAX ; i++) { +for (i =0 ; i <IA_CSS_PIPELINE_NUM_MAX ; i++) my_css.all_pipes[i] =NULL ; - } }static int pipe_generate_pipe_num (const struct ia_css_pipe *pipe, -unsigned int *pipe_number) { +unsigned int *pipe_number) +{const u8 INVALID_PIPE_NUM = (uint8_t )~(0 );u8 pipe_num =INVALID_PIPE_NUM ;u8 i; -if (!pipe) - { +if (!pipe) {IA_CSS_ERROR ("NULL pipe parameter" );return -EINVAL ; }/* Assign a new pipe_num .... search for empty place */ -for (i =0 ; i <IA_CSS_PIPELINE_NUM_MAX ; i++) - { +for (i =0 ; i <IA_CSS_PIPELINE_NUM_MAX ; i++) {if (!my_css.all_pipes[i]) {/*position is reserved */ my_css.all_pipes[i] = (struct ia_css_pipe *)pipe;
@@ -2280,8 +2237,7 @@ pipe_generate_pipe_num(const struct ia_css_pipe *pipe,break ; } } -if (pipe_num ==INVALID_PIPE_NUM ) - { +if (pipe_num ==INVALID_PIPE_NUM ) {/* Max number of pipes already allocated */ IA_CSS_ERROR ("Max number of pipes already created" );return -ENOSPC ;
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/6 media: staging: media: atomisp: Fix the rest of sh_css.c brace issues
In reply to Sasha LevinFrom: Martiros Shakhzadyan <[email protected]>
[ Upstream commit 7394bf6d3c1e8316484fcf3a9d71daaab489f211 ]
Fix the remainder of brace coding style issues.
Stable-dep-of: f4d51e55dd47 ("staging: media: atomisp: reduce load_primary_binaries() stack usage")
--- drivers/staging/media/atomisp/pci/sh_css.c | 1134 +++++++++----------- 1 file changed, 498 insertions(+), 636 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +498 -636
@@ -1101,8 +1101,7 @@ sh_css_config_input_network(struct ia_css_stream *stream)/* get the target input terminal */ sp_pipeline_input_terminal = &sh_css_sp_group.pipe_io[sp_thread_id].input; -for (i =0 ; i <IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH ; i++) - { +for (i =0 ; i <IA_CSS_STREAM_MAX_ISYS_STREAM_PER_CH ; i++) {/* initialization */ memset ((void *)(&isys_stream_descr),0 ,sizeof (ia_css_isys_descr_t)); sp_pipeline_input_terminal->context.virtual_input_system_stream[i].valid =0 ;
@@ -2161,7 +2160,6 @@ init_pipe_defaults(enum ia_css_pipe_mode mode, struct ia_css_pipe *pipe, bool copy_pipe) { -if (!pipe) {IA_CSS_ERROR ("NULL pipe parameter" );return -EINVAL ;
@@ -2263,12 +2261,12 @@ pipe_release_pipe_num(unsigned int pipe_num)static int create_pipe (enum ia_css_pipe_mode mode,struct ia_css_pipe **pipe, -bool copy_pipe) { +bool copy_pipe) +{int err =0 ;struct ia_css_pipe *me; -if (!pipe) - { +if (!pipe) {IA_CSS_ERROR ("NULL pipe parameter" );return -EINVAL ; }
@@ -2278,15 +2276,13 @@ create_pipe(enum ia_css_pipe_mode mode,return -ENOMEM ; err =init_pipe_defaults (mode, me, copy_pipe); -if (err) - { +if (err) {kfree (me);return err; } err =pipe_generate_pipe_num (me, &me->pipe_num); -if (err) - { +if (err) {kfree (me);return err; }
@@ -2332,26 +2328,24 @@ static void sh_css_pipe_free_acc_binaries( }int -ia_css_pipe_destroy (struct ia_css_pipe *pipe) { +ia_css_pipe_destroy (struct ia_css_pipe *pipe) +{int err =0 ;IA_CSS_ENTER ("pipe = %p" , pipe); -if (!pipe) - { +if (!pipe) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } -if (pipe->stream) - { +if (pipe->stream) {IA_CSS_LOG ("ia_css_stream_destroy not called!" );IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } -switch (pipe->config.mode) - { +switch (pipe->config.mode) {case IA_CSS_PIPE_MODE_PREVIEW :/* need to take into account that this function is also called on the internal copy pipe */
@@ -2415,9 +2409,8 @@ ia_css_pipe_destroy(struct ia_css_pipe *pipe) {/* Temporarily, not every sh_css_pipe has an acc_extension. */ if (pipe->config.acc_extension) - {ia_css_pipe_unload_extension (pipe, pipe->config.acc_extension); - } +kfree (pipe);IA_CSS_LEAVE ("err = %d" , err);return err;
@@ -2447,9 +2440,9 @@ ia_css_uninit(void) ifmtr_set_if_blocking_mode_reset = true;#endif -if (!fw_explicitly_loaded) { +if (!fw_explicitly_loaded)ia_css_unload_firmware (); - } +ia_css_spctrl_unload_fw (SP0_ID );sh_css_sp_set_sp_running (false);/* check and free any remaining mipi frames */
@@ -2636,7 +2629,8 @@ static int load_copy_binary(static int alloc_continuous_frames ( -struct ia_css_pipe *pipe,bool init_time) { +struct ia_css_pipe *pipe,bool init_time) +{int err =0 ;struct ia_css_frame_info ref_info;enum ia_css_pipe_id pipe_id;
@@ -2646,8 +2640,7 @@ alloc_continuous_frames(IA_CSS_ENTER_PRIVATE ("pipe = %p, init_time = %d" , pipe, init_time); -if ((!pipe) || (!pipe->stream)) - { +if ((!pipe) || (!pipe->stream)) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -2655,26 +2648,22 @@ alloc_continuous_frames( pipe_id = pipe->mode; continuous = pipe->stream->config.continuous; -if (continuous) - { +if (continuous) {if (init_time) { num_frames = pipe->stream->config.init_num_cont_raw_buf; pipe->stream->continuous_pipe = pipe; - }else + }else { num_frames = pipe->stream->config.target_num_cont_raw_buf; - }else - { + } + }else { num_frames =NUM_ONLINE_INIT_CONTINUOUS_FRAMES ; } -if (pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) - { +if (pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) { ref_info = pipe->pipe_settings.preview.preview_binary.in_frame_info; - }else if (pipe_id ==IA_CSS_PIPE_ID_VIDEO ) - { + }else if (pipe_id ==IA_CSS_PIPE_ID_VIDEO ) { ref_info = pipe->pipe_settings.video.video_binary.in_frame_info; - }else - { + }else {/* should not happen */ IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ;
@@ -2690,8 +2679,7 @@ alloc_continuous_frames(#endif #if !defined(HAS_NO_PACKED_RAW_PIXELS ) -if (pipe->stream->config.pack_raw_pixels) - { +if (pipe->stream->config.pack_raw_pixels) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"alloc_continuous_frames() IA_CSS_FRAME_FORMAT_RAW_PACKED\n" ); ref_info.format =IA_CSS_FRAME_FORMAT_RAW_PACKED ;
@@ -2720,8 +2708,7 @@ alloc_continuous_frames(else idx = pipe->stream->config.init_num_cont_raw_buf; -for (i = idx; i <NUM_CONTINUOUS_FRAMES ; i++) - { +for (i = idx; i <NUM_CONTINUOUS_FRAMES ; i++) {/* free previous frame */ if (pipe->continuous_frames[i]) {ia_css_frame_free (pipe->continuous_frames[i]);
@@ -2751,14 +2738,16 @@ alloc_continuous_frames( }int -ia_css_alloc_continuous_frame_remain (struct ia_css_stream *stream) { +ia_css_alloc_continuous_frame_remain (struct ia_css_stream *stream) +{if (!stream)return -EINVAL ;return alloc_continuous_frames (stream->continuous_pipe, false); }static int -load_preview_binaries (struct ia_css_pipe *pipe) { +load_preview_binaries (struct ia_css_pipe *pipe) +{struct ia_css_frame_info prev_in_info, prev_bds_out_info, prev_out_info,
@@ -2866,8 +2855,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) {* then the preview binary selection is done again. */ if (need_vf_pp && - (mycs->preview_binary.out_frame_info[0 ].format !=IA_CSS_FRAME_FORMAT_YUV_LINE )) - { + (mycs->preview_binary.out_frame_info[0 ].format !=IA_CSS_FRAME_FORMAT_YUV_LINE )) {/* Preview step 2 */ if (pipe->vf_yuv_ds_input_info.res.width) prev_vf_info = pipe->vf_yuv_ds_input_info;
@@ -2892,8 +2880,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) {return err; } -if (need_vf_pp) - { +if (need_vf_pp) {struct ia_css_binary_descr vf_pp_descr;/* Viewfinder post-processing */
@@ -2924,8 +2911,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) {#endif /* Copy */ -if (need_isp_copy_binary) - { +if (need_isp_copy_binary) { err =load_copy_binary (pipe, &mycs->copy_binary, &mycs->preview_binary);
@@ -2933,8 +2919,7 @@ load_preview_binaries(struct ia_css_pipe *pipe) {return err; } -if (pipe->shading_table) - { +if (pipe->shading_table) {ia_css_shading_table_free (pipe->shading_table); pipe->shading_table =NULL ; }
@@ -2949,11 +2934,11 @@ ia_css_binary_unload(struct ia_css_binary *binary) }static int -unload_preview_binaries (struct ia_css_pipe *pipe) { +unload_preview_binaries (struct ia_css_pipe *pipe) +{IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (pipe->mode !=IA_CSS_PIPE_ID_PREVIEW )) - { +if ((!pipe) || (pipe->mode !=IA_CSS_PIPE_ID_PREVIEW )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -3006,15 +2991,15 @@ static int add_firmwares(struct ia_css_frame *in =NULL ;struct ia_css_frame *vf =NULL ; -if ((fw == last_fw) && (fw->info.isp.sp.enable.out_frame !=0 )) { +if ((fw == last_fw) && (fw->info.isp.sp.enable.out_frame !=0 )) out[0 ] = out_frame; - } -if (fw->info.isp.sp.enable.in_frame !=0 ) { + +if (fw->info.isp.sp.enable.in_frame !=0 ) in = in_frame; - } -if (fw->info.isp.sp.enable.out_frame !=0 ) { + +if (fw->info.isp.sp.enable.out_frame !=0 ) vf = vf_frame; - } +ia_css_pipe_get_firmwares_stage_desc (&stage_desc, binary, out, in, vf, fw, binary_mode); err = ia_css_pipeline_create_and_add_stage(me,
@@ -3228,7 +3213,8 @@ static void sh_css_setup_queues(void)static int init_vf_frameinfo_defaults (struct ia_css_pipe *pipe, -struct ia_css_frame *vf_frame,unsigned int idx) { +struct ia_css_frame *vf_frame,unsigned int idx) +{int err =0 ;unsigned int thread_id;enum sh_css_queue_id queue_id;
@@ -3393,7 +3379,8 @@ ia_css_get_crop_offsets(static int init_in_frameinfo_memory_defaults (struct ia_css_pipe *pipe, -struct ia_css_frame *frame,enum ia_css_frame_format format) { +struct ia_css_frame *frame,enum ia_css_frame_format format) +{struct ia_css_frame *in_frame;int err =0 ;unsigned int thread_id;
@@ -3434,7 +3421,8 @@ init_in_frameinfo_memory_defaults(struct ia_css_pipe *pipe,static int init_out_frameinfo_defaults (struct ia_css_pipe *pipe, -struct ia_css_frame *out_frame,unsigned int idx) { +struct ia_css_frame *out_frame,unsigned int idx) +{int err =0 ;unsigned int thread_id;enum sh_css_queue_id queue_id;
@@ -3665,14 +3653,14 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe) }static int -create_host_acc_pipeline (struct ia_css_pipe *pipe) { +create_host_acc_pipeline (struct ia_css_pipe *pipe) +{int err =0 ;const struct ia_css_fw_info *fw;unsigned int i;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (!pipe->stream)) - { +if ((!pipe) || (!pipe->stream)) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -3683,15 +3671,13 @@ create_host_acc_pipeline(struct ia_css_pipe *pipe) { pipe->pipeline.pipe_qos_config =0 ; fw = pipe->vf_stage; -for (i =0 ; fw; fw = fw->next) - { +for (i =0 ; fw; fw = fw->next) { err =sh_css_pipeline_add_acc_stage (&pipe->pipeline, fw);if (err) goto ERR; } -for (i =0 ; i < pipe->config.num_acc_stages; i++) - { +for (i =0 ; i < pipe->config.num_acc_stages; i++) {struct ia_css_fw_info *fw = pipe->config.acc_stages[i]; err =sh_css_pipeline_add_acc_stage (&pipe->pipeline, fw);
@@ -3708,7 +3694,8 @@ create_host_acc_pipeline(struct ia_css_pipe *pipe) {/* Create stages for preview */ static int -create_host_preview_pipeline (struct ia_css_pipe *pipe) { +create_host_preview_pipeline (struct ia_css_pipe *pipe) +{struct ia_css_pipeline_stage *copy_stage =NULL ;struct ia_css_pipeline_stage *preview_stage =NULL ;struct ia_css_pipeline_stage *vf_pp_stage =NULL ;
@@ -3728,8 +3715,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) {#endif IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (!pipe->stream) || (pipe->mode !=IA_CSS_PIPE_ID_PREVIEW )) - { +if ((!pipe) || (!pipe->stream) || (pipe->mode !=IA_CSS_PIPE_ID_PREVIEW )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -3757,16 +3743,14 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) {/* Construct in_frame info (only in case we have dynamic input */ need_in_frameinfo_memory = pipe->stream->config.mode ==IA_CSS_INPUT_MODE_MEMORY ;#endif -if (need_in_frameinfo_memory) - { +if (need_in_frameinfo_memory) { err =init_in_frameinfo_memory_defaults (pipe, &me->in_frame,IA_CSS_FRAME_FORMAT_RAW );if (err) goto ERR; in_frame = &me->in_frame; - }else - { + }else { in_frame =NULL ; }
@@ -3780,8 +3764,7 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) {if (pipe->pipe_settings.preview.vf_pp_binary.info) vf_pp_binary = &pipe->pipe_settings.preview.vf_pp_binary; -if (pipe->pipe_settings.preview.copy_binary.info) - { +if (pipe->pipe_settings.preview.copy_binary.info) {ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, out_frames,NULL ,NULL );
@@ -3796,21 +3779,19 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) {/* When continuous is enabled, configure in_frame with the * last pipe, which is the copy pipe. */ -if (continuous || !online) { +if (continuous || !online) in_frame = pipe->stream->last_pipe->continuous_frames[0 ]; - } +#else in_frame = pipe->continuous_frames[0 ];#endif } -if (vf_pp_binary) - { +if (vf_pp_binary) {ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, preview_binary, out_frames, in_frame,NULL ); - }else - { + }else {ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame);ia_css_pipe_get_generic_stage_desc (&stage_desc, preview_binary, out_frames, in_frame,NULL );
@@ -3824,14 +3805,12 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe) { preview_stage->args.copy_vf = preview_binary->info->sp.pipeline.mode ==IA_CSS_BINARY_MODE_COPY ; preview_stage->args.copy_output = !preview_stage->args.copy_vf; -if (preview_stage->args.copy_vf && !preview_stage->args.out_vf_frame) - { +if (preview_stage->args.copy_vf && !preview_stage->args.out_vf_frame) {/* in case of copy, use the vf frame as output frame */ preview_stage->args.out_vf_frame = preview_stage->args.out_frame[0 ]; } -if (vf_pp_binary) - { +if (vf_pp_binary) {if (preview_binary->info->sp.pipeline.mode ==IA_CSS_BINARY_MODE_COPY ) in_frame = preview_stage->args.out_vf_frame;else
@@ -3871,7 +3850,8 @@ static void send_raw_frames(struct ia_css_pipe *pipe) }static int -preview_start (struct ia_css_pipe *pipe) { +preview_start (struct ia_css_pipe *pipe) +{int err =0 ;struct ia_css_pipe *copy_pipe, *capture_pipe;struct ia_css_pipe *acc_pipe;
@@ -3881,8 +3861,7 @@ preview_start(struct ia_css_pipe *pipe) {const struct ia_css_isp_parameters *params =NULL ;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (!pipe->stream) || (pipe->mode !=IA_CSS_PIPE_ID_PREVIEW )) - { +if ((!pipe) || (!pipe->stream) || (pipe->mode !=IA_CSS_PIPE_ID_PREVIEW )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -3909,8 +3888,7 @@ preview_start(struct ia_css_pipe *pipe) {ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (pipe), &thread_id); copy_ovrd =1 << thread_id; -if (pipe->stream->cont_capt) - { +if (pipe->stream->cont_capt) {ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (capture_pipe), &thread_id); copy_ovrd |=1 << thread_id;
@@ -3923,8 +3901,7 @@ preview_start(struct ia_css_pipe *pipe) { }/* Construct and load the copy pipe */ -if (pipe->stream->config.continuous) - { +if (pipe->stream->config.continuous) { sh_css_sp_init_pipeline(©_pipe->pipeline, IA_CSS_PIPE_ID_COPY, (uint8_t)ia_css_pipe_get_pipe_num(copy_pipe),
@@ -3945,8 +3922,7 @@ preview_start(struct ia_css_pipe *pipe) { }/* Construct and load the capture pipe */ -if (pipe->stream->cont_capt) - { +if (pipe->stream->cont_capt) { sh_css_sp_init_pipeline(&capture_pipe->pipeline, IA_CSS_PIPE_ID_CAPTURE, (uint8_t)ia_css_pipe_get_pipe_num(capture_pipe),
@@ -3964,8 +3940,7 @@ preview_start(struct ia_css_pipe *pipe) { params); } -if (acc_pipe) - { +if (acc_pipe) { sh_css_sp_init_pipeline(&acc_pipe->pipeline, IA_CSS_PIPE_ID_ACC, (uint8_t)ia_css_pipe_get_pipe_num(acc_pipe),
@@ -3991,7 +3966,8 @@ preview_start(struct ia_css_pipe *pipe) {int ia_css_pipe_enqueue_buffer (struct ia_css_pipe *pipe, -const struct ia_css_buffer *buffer) { +const struct ia_css_buffer *buffer) +{int return_err =0 ;unsigned int thread_id;enum sh_css_queue_id queue_id;
@@ -4006,8 +3982,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,IA_CSS_ENTER ("pipe=%p, buffer=%p" , pipe, buffer); -if ((!pipe) || (!buffer)) - { +if ((!pipe) || (!buffer)) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; }
@@ -4016,8 +3991,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,/* following code will be enabled when IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME is removed */ #if 0 -if (buf_type ==IA_CSS_BUFFER_TYPE_OUTPUT_FRAME ) - { +if (buf_type ==IA_CSS_BUFFER_TYPE_OUTPUT_FRAME ) {bool found_pipe = false;for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) {
@@ -4031,8 +4005,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,if (!found_pipe)return -EINVAL ; } -if (buf_type ==IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME ) - { +if (buf_type ==IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME ) {bool found_pipe = false;for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) {
@@ -4055,34 +4028,29 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,assert (buf_type <IA_CSS_NUM_DYNAMIC_BUFFER_TYPE );if ((buf_type ==IA_CSS_BUFFER_TYPE_INVALID ) || (buf_type >=IA_CSS_NUM_DYNAMIC_BUFFER_TYPE ) || - (pipe_id >=IA_CSS_PIPE_ID_NUM )) - { + (pipe_id >=IA_CSS_PIPE_ID_NUM )) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } ret_err =ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (pipe), &thread_id); -if (!ret_err) - { +if (!ret_err) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } ret_err =ia_css_query_internal_queue_id (buf_type, thread_id, &queue_id); -if (!ret_err) - { +if (!ret_err) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } -if ((queue_id <=SH_CSS_INVALID_QUEUE_ID ) || (queue_id >=SH_CSS_MAX_NUM_QUEUES )) - { +if ((queue_id <=SH_CSS_INVALID_QUEUE_ID ) || (queue_id >=SH_CSS_MAX_NUM_QUEUES )) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } -if (!sh_css_sp_is_running ()) - { +if (!sh_css_sp_is_running ()) {IA_CSS_LOG ("SP is not running!" );IA_CSS_LEAVE_ERR (-EBUSY );/* SP is not running. The queues are not valid */
@@ -4100,24 +4068,21 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, ddr_buffer.cookie_ptr = buffer->driver_cookie; ddr_buffer.timing_data = buffer->timing_data; -if (buf_type ==IA_CSS_BUFFER_TYPE_3A_STATISTICS ) - { +if (buf_type ==IA_CSS_BUFFER_TYPE_3A_STATISTICS ) {if (!buffer->data.stats_3a) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } ddr_buffer.kernel_ptr =HOST_ADDRESS (buffer->data.stats_3a); ddr_buffer.payload.s3a = *buffer->data.stats_3a; - }else if (buf_type ==IA_CSS_BUFFER_TYPE_DIS_STATISTICS ) - { + }else if (buf_type ==IA_CSS_BUFFER_TYPE_DIS_STATISTICS ) {if (!buffer->data.stats_dvs) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } ddr_buffer.kernel_ptr =HOST_ADDRESS (buffer->data.stats_dvs); ddr_buffer.payload.dis = *buffer->data.stats_dvs; - }else if (buf_type ==IA_CSS_BUFFER_TYPE_METADATA ) - { + }else if (buf_type ==IA_CSS_BUFFER_TYPE_METADATA ) {if (!buffer->data.metadata) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ;
@@ -4128,8 +4093,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, || (buf_type == IA_CSS_BUFFER_TYPE_OUTPUT_FRAME) || (buf_type == IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME) || (buf_type == IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME)) - { + || (buf_type == IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME)) {if (!buffer->data.frame) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ;
@@ -4164,8 +4128,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,assert (h_vbuf);assert (h_vbuf->vptr !=0x0 ); -if ((!h_vbuf) || (h_vbuf->vptr ==0x0 )) - { +if ((!h_vbuf) || (h_vbuf->vptr ==0x0 )) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; }
@@ -4175,8 +4138,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, sizeof(struct sh_css_hmm_buffer));if ((buf_type ==IA_CSS_BUFFER_TYPE_3A_STATISTICS ) || (buf_type ==IA_CSS_BUFFER_TYPE_DIS_STATISTICS ) - || (buf_type ==IA_CSS_BUFFER_TYPE_LACE_STATISTICS )) - { + || (buf_type ==IA_CSS_BUFFER_TYPE_LACE_STATISTICS )) {if (!pipeline) {ia_css_rmgr_rel_vbuf (hmm_buffer_pool, &h_vbuf);IA_CSS_LOG ("pipeline is empty!" );
@@ -4199,8 +4161,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, || (buf_type == IA_CSS_BUFFER_TYPE_VF_OUTPUT_FRAME) || (buf_type == IA_CSS_BUFFER_TYPE_SEC_OUTPUT_FRAME) || (buf_type == IA_CSS_BUFFER_TYPE_SEC_VF_OUTPUT_FRAME) - || (buf_type == IA_CSS_BUFFER_TYPE_METADATA)) - { + || (buf_type == IA_CSS_BUFFER_TYPE_METADATA)) { return_err =ia_css_bufq_enqueue_buffer (thread_id, queue_id, (uint32_t )h_vbuf->vptr);
@@ -4214,8 +4175,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,#endif } -if (!return_err) - { +if (!return_err) {if (sh_css_hmm_buffer_record_acquire ( h_vbuf, buf_type,HOST_ADDRESS (ddr_buffer.kernel_ptr))) {
@@ -4230,8 +4190,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,* Tell the SP which queues are not empty, * by sending the software event. */ -if (!return_err) - { +if (!return_err) {if (!sh_css_sp_is_running ()) {/* SP is not running. The queues are not valid */ IA_CSS_LOG ("SP is not running!" );
@@ -4243,8 +4202,7 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, (uint8_t )thread_id, queue_id, 0); - }else - { + }else {ia_css_rmgr_rel_vbuf (hmm_buffer_pool, &h_vbuf);IA_CSS_ERROR ("buffer not enqueued" ); }
@@ -4259,7 +4217,8 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe,*/ int ia_css_pipe_dequeue_buffer (struct ia_css_pipe *pipe, -struct ia_css_buffer *buffer) { +struct ia_css_buffer *buffer) +{int return_err;enum sh_css_queue_id queue_id;ia_css_ptr ddr_buffer_addr = (ia_css_ptr )0 ;
@@ -4272,8 +4231,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,IA_CSS_ENTER ("pipe=%p, buffer=%p" , pipe, buffer); -if ((!pipe) || (!buffer)) - { +if ((!pipe) || (!buffer)) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; }
@@ -4287,27 +4245,23 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, ddr_buffer.kernel_ptr =0 ; ret_err =ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (pipe), &thread_id); -if (!ret_err) - { +if (!ret_err) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } ret_err =ia_css_query_internal_queue_id (buf_type, thread_id, &queue_id); -if (!ret_err) - { +if (!ret_err) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } -if ((queue_id <=SH_CSS_INVALID_QUEUE_ID ) || (queue_id >=SH_CSS_MAX_NUM_QUEUES )) - { +if ((queue_id <=SH_CSS_INVALID_QUEUE_ID ) || (queue_id >=SH_CSS_MAX_NUM_QUEUES )) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } -if (!sh_css_sp_is_running ()) - { +if (!sh_css_sp_is_running ()) {IA_CSS_LOG ("SP is not running!" );IA_CSS_LEAVE_ERR (-EBUSY );/* SP is not running. The queues are not valid */
@@ -4317,8 +4271,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, return_err =ia_css_bufq_dequeue_buffer (queue_id, (uint32_t *)&ddr_buffer_addr); -if (!return_err) - { +if (!return_err) {struct ia_css_frame *frame;struct sh_css_hmm_buffer_record *hmm_buffer_record =NULL ;
@@ -4460,8 +4413,7 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe,* Tell the SP which queues are not full, * by sending the software event. */ -if (!return_err) - { +if (!return_err) {if (!sh_css_sp_is_running ()) {IA_CSS_LOG ("SP is not running!" );IA_CSS_LEAVE_ERR (-EBUSY );
@@ -4510,12 +4462,14 @@ static enum ia_css_event_type convert_event_sp_to_host_domain[] = { };int -ia_css_dequeue_event (struct ia_css_event *event) { +ia_css_dequeue_event (struct ia_css_event *event) +{return ia_css_dequeue_psys_event (event); }int -ia_css_dequeue_psys_event (struct ia_css_event *event) { +ia_css_dequeue_psys_event (struct ia_css_event *event) +{enum ia_css_pipe_id pipe_id =0 ;u8 payload[4 ] = {0 ,0 ,0 ,0 };int ret_err;
@@ -4530,11 +4484,9 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) {if (!event)return -EINVAL ; +/* SP is not running. The queues are not valid */ if (!sh_css_sp_is_running ()) - { -/* SP is not running. The queues are not valid */ return -EBUSY ; - }/* dequeue the event (if any) from the psys event queue */ ret_err =ia_css_bufq_dequeue_psys_event (payload);
@@ -4561,8 +4513,7 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) { event->timer_code =0 ; event->timer_subcode =0 ; -if (event->type ==IA_CSS_EVENT_TYPE_TIMER ) - { +if (event->type ==IA_CSS_EVENT_TYPE_TIMER ) {/* timer event ??? get the 2nd event and decode the data into the event struct */ u32 tmp_data;/* 1st event: LSB 16-bit timer data and code */
@@ -4586,37 +4537,32 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) { tmp_data = ((payload[1 ] &0xFF ) | ((payload[3 ] &0xFF ) <<8 )); event->timer_data |= (tmp_data <<16 ); event->timer_subcode = payload[2 ]; - } + }else {/* It's a non timer event. So clear first half of the timer event data. * If the second part of the TIMER event is not received, we discard * the first half of the timer data and process the non timer event without * affecting the flow. So the non timer event falls through * the code. */ -else { event->timer_data =0 ; event->timer_code =0 ; event->timer_subcode =0 ;IA_CSS_ERROR ("Missing 2nd timer event. Timer event discarded" ); } } -if (event->type ==IA_CSS_EVENT_TYPE_PORT_EOF ) - { +if (event->type ==IA_CSS_EVENT_TYPE_PORT_EOF ) { event->port = (enum mipi_port_id )payload[1 ]; event->exp_id = payload[3 ]; - }else if (event->type ==IA_CSS_EVENT_TYPE_FW_WARNING ) - { + }else if (event->type ==IA_CSS_EVENT_TYPE_FW_WARNING ) { event->fw_warning = (enum ia_css_fw_warning )payload[1 ];/* exp_id is only available in these warning types */ if (event->fw_warning ==IA_CSS_FW_WARNING_EXP_ID_LOCKED || event->fw_warning ==IA_CSS_FW_WARNING_TAG_EXP_ID_FAILED ) event->exp_id = payload[3 ]; - }else if (event->type ==IA_CSS_EVENT_TYPE_FW_ASSERT ) - { + }else if (event->type ==IA_CSS_EVENT_TYPE_FW_ASSERT ) { event->fw_assert_module_id = payload[1 ];/* module */ event->fw_assert_line_no = (payload[2 ] <<8 ) + payload[3 ];/* payload[2] is line_no>>8, payload[3] is line_no&0xff */ - }else if (event->type !=IA_CSS_EVENT_TYPE_TIMER ) - { + }else if (event->type !=IA_CSS_EVENT_TYPE_TIMER ) {/* pipe related events. * payload[1] contains the pipe_num, * payload[2] contains the pipe_id. These are different. */
@@ -4666,7 +4612,8 @@ ia_css_dequeue_psys_event(struct ia_css_event *event) { }int -ia_css_dequeue_isys_event (struct ia_css_event *event) { +ia_css_dequeue_isys_event (struct ia_css_event *event) +{u8 payload[4 ] = {0 ,0 ,0 ,0 };int err =0 ;
@@ -4676,11 +4623,9 @@ ia_css_dequeue_isys_event(struct ia_css_event *event) {if (!event)return -EINVAL ; +/* SP is not running. The queues are not valid */ if (!sh_css_sp_is_running ()) - { -/* SP is not running. The queues are not valid */ return -EBUSY ; - } err =ia_css_bufq_dequeue_isys_event (payload);if (err)
@@ -4713,7 +4658,8 @@ acc_start(struct ia_css_pipe *pipe) }static int -sh_css_pipe_start (struct ia_css_stream *stream) { +sh_css_pipe_start (struct ia_css_stream *stream) +{int err =0 ;struct ia_css_pipe *pipe;
@@ -4722,22 +4668,19 @@ sh_css_pipe_start(struct ia_css_stream *stream) {IA_CSS_ENTER_PRIVATE ("stream = %p" , stream); -if (!stream) - { +if (!stream) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } pipe = stream->last_pipe; -if (!pipe) - { +if (!pipe) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; } pipe_id = pipe->mode; -if (stream->started) - { +if (stream->started) {IA_CSS_WARNING ("Cannot start stream that is already started" );IA_CSS_LEAVE_ERR (err);return err;
@@ -4745,8 +4688,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { pipe->stop_requested = false; -switch (pipe_id) - { +switch (pipe_id) {case IA_CSS_PIPE_ID_PREVIEW : err =preview_start (pipe);break ;
@@ -4766,8 +4708,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { err = -EINVAL ; }/* DH regular multi pipe - not continuous mode: start the next pipes too */ -if (!stream->config.continuous) - { +if (!stream->config.continuous) {int i;for (i =1 ; i < stream->num_pipes &&0 == err ; i++) {
@@ -4797,8 +4738,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { } } } -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; }
@@ -4808,8 +4748,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) {* don't use ISP parameters anyway. So this should be okay. * The SP binary (jpeg) copy does not use any parameters. */ -if (!copy_on_sp (pipe)) - { +if (!copy_on_sp (pipe)) {sh_css_invalidate_params (stream); err =sh_css_param_update_isp_params (pipe, stream->isp_params_configs, true,NULL );
@@ -4823,8 +4762,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) {ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (pipe), &thread_id); -if (!sh_css_sp_is_running ()) - { +if (!sh_css_sp_is_running ()) {IA_CSS_LEAVE_ERR_PRIVATE (-EBUSY );/* SP is not running. The queues are not valid */ return -EBUSY ;
@@ -4833,8 +4771,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { (uint8_t)thread_id, 0, 0);/* DH regular multi pipe - not continuous mode: enqueue event to the next pipes too */ -if (!stream->config.continuous) - { +if (!stream->config.continuous) {int i;for (i =1 ; i < stream->num_pipes; i++) {
@@ -4848,8 +4785,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { }/* in case of continuous capture mode, we also start capture thread and copy thread*/ -if (pipe->stream->config.continuous) - { +if (pipe->stream->config.continuous) {struct ia_css_pipe *copy_pipe =NULL ;if (pipe_id ==IA_CSS_PIPE_ID_PREVIEW )
@@ -4868,8 +4804,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) {IA_CSS_PSYS_SW_EVENT_START_STREAM , (uint8_t)thread_id, 0, 0); } -if (pipe->stream->cont_capt) - { +if (pipe->stream->cont_capt) {struct ia_css_pipe *capture_pipe =NULL ;if (pipe_id ==IA_CSS_PIPE_ID_PREVIEW )
@@ -4890,8 +4825,7 @@ sh_css_pipe_start(struct ia_css_stream *stream) { }/* in case of PREVIEW mode, check whether QOS acc_pipe is available, then start the qos pipe */ -if (pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) - { +if (pipe_id ==IA_CSS_PIPE_ID_PREVIEW ) {struct ia_css_pipe *acc_pipe =NULL ; acc_pipe = pipe->pipe_settings.preview.acc_pipe;
@@ -4942,7 +4876,8 @@ sh_css_continuous_is_enabled(uint8_t pipe_num)/* ISP2400 */ int ia_css_stream_get_max_buffer_depth (struct ia_css_stream *stream, -int *buffer_depth) { +int *buffer_depth) +{if (!buffer_depth)return -EINVAL ;ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_get_max_buffer_depth() enter: void\n" );
@@ -4952,7 +4887,8 @@ ia_css_stream_get_max_buffer_depth(struct ia_css_stream *stream, }int -ia_css_stream_set_buffer_depth (struct ia_css_stream *stream,int buffer_depth) { +ia_css_stream_set_buffer_depth (struct ia_css_stream *stream,int buffer_depth) +{ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_set_buffer_depth() enter: num_frames=%d\n" , buffer_depth); (void )stream;if (buffer_depth >NUM_CONTINUOUS_FRAMES || buffer_depth <1 )
@@ -4966,7 +4902,8 @@ ia_css_stream_set_buffer_depth(struct ia_css_stream *stream, int buffer_depth) {/* ISP2401 */ int ia_css_stream_get_buffer_depth (struct ia_css_stream *stream, -int *buffer_depth) { +int *buffer_depth) +{if (!buffer_depth)return -EINVAL ;ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_get_buffer_depth() enter: void\n" );
@@ -4991,8 +4928,7 @@ sh_css_pipes_stop(struct ia_css_stream *stream)int i;assert (stream); -if (!stream) - { +if (!stream) {IA_CSS_LOG ("stream does NOT exist!" ); err = -EINVAL ; goto ERR;
@@ -5000,8 +4936,7 @@ sh_css_pipes_stop(struct ia_css_stream *stream) main_pipe = stream->last_pipe;assert (main_pipe); -if (!main_pipe) - { +if (!main_pipe) {IA_CSS_LOG ("main_pipe does NOT exist!" ); err = -EINVAL ; goto ERR;
@@ -5014,8 +4949,7 @@ sh_css_pipes_stop(struct ia_css_stream *stream)* Stop all "ia_css_pipe" instances in this target * "ia_css_stream" instance. */ -for (i =0 ; i < stream->num_pipes; i++) - { +for (i =0 ; i < stream->num_pipes; i++) {/* send the "stop" request to the "ia_css_pipe" instance */ IA_CSS_LOG ("Send the stop-request to the pipe: pipe_id=%d" , stream->pipes[i]->pipeline.pipe_id);
@@ -5049,8 +4983,7 @@ sh_css_pipes_stop(struct ia_css_stream *stream)* * We need to stop this "Copy Pipe", as well. */ -if (main_pipe->stream->config.continuous) - { +if (main_pipe->stream->config.continuous) {struct ia_css_pipe *copy_pipe =NULL ;/* get the reference to "Copy Pipe" */
@@ -5226,8 +5159,7 @@ sh_css_pipe_get_shading_info(struct ia_css_pipe *pipe, binary =ia_css_pipe_get_shading_correction_binary (pipe); -if (binary) - { +if (binary) { err = ia_css_binary_get_shading_info(binary, IA_CSS_SHADING_CORRECTION_TYPE_1, pipe->required_bds_factor,
@@ -5237,8 +5169,7 @@ sh_css_pipe_get_shading_info(struct ia_css_pipe *pipe,/* Other function calls can be added here when other shading correction types will be added * in the future. */ - }else - { + }else {/* When the pipe does not have a binary which has the shading * correction, this function does not need to fill the shading * information. It is not a error case, and then
@@ -5251,7 +5182,8 @@ sh_css_pipe_get_shading_info(struct ia_css_pipe *pipe,static int sh_css_pipe_get_grid_info (struct ia_css_pipe *pipe, -struct ia_css_grid_info *info) { +struct ia_css_grid_info *info) +{int err =0 ;struct ia_css_binary *binary =NULL ;
@@ -5262,30 +5194,27 @@ sh_css_pipe_get_grid_info(struct ia_css_pipe *pipe, binary =ia_css_pipe_get_s3a_binary (pipe); -if (binary) - { +if (binary) { err =ia_css_binary_3a_grid_info (binary, info, pipe);if (err) goto ERR; - }else + }else {memset (&info->s3a_grid,0 ,sizeof (info->s3a_grid)); + } binary =ia_css_pipe_get_sdis_binary (pipe); -if (binary) - { +if (binary) {ia_css_binary_dvs_grid_info (binary, info, pipe);ia_css_binary_dvs_stat_grid_info (binary, info, pipe); - }else - { + }else {memset (&info->dvs_grid.dvs_grid_info,0 ,sizeof (info->dvs_grid.dvs_grid_info));memset (&info->dvs_grid.dvs_stat_grid_info,0 ,sizeof (info->dvs_grid.dvs_stat_grid_info)); } -if (binary) - { +if (binary) {/* copy pipe does not have ISP binary*/ info->isp_in_width = binary->internal_frame_info.res.width; info->isp_in_height = binary->internal_frame_info.res.height;
@@ -5305,7 +5234,8 @@ ERR :*/ static int ia_css_pipe_check_format (struct ia_css_pipe *pipe, -enum ia_css_frame_format format) { +enum ia_css_frame_format format) +{const enum ia_css_frame_format *supported_formats;int number_of_formats;int found =0 ;
@@ -5313,8 +5243,7 @@ ia_css_pipe_check_format(struct ia_css_pipe *pipe,IA_CSS_ENTER_PRIVATE ("" ); -if (NULL == pipe ||NULL == pipe->pipe_settings.video.video_binary.info) - { +if (NULL == pipe ||NULL == pipe->pipe_settings.video.video_binary.info) {IA_CSS_ERROR ("Pipe or binary info is not set" );IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ;
@@ -5323,15 +5252,13 @@ ia_css_pipe_check_format(struct ia_css_pipe *pipe, supported_formats = pipe->pipe_settings.video.video_binary.info->output_formats; number_of_formats =sizeof (pipe->pipe_settings.video.video_binary.info->output_formats) /sizeof (enum ia_css_frame_format ); -for (i =0 ; i < number_of_formats && !found; i++) - { +for (i =0 ; i < number_of_formats && !found; i++) {if (supported_formats[i] == format) { found =1 ;break ; } } -if (!found) - { +if (!found) {IA_CSS_ERROR ("Requested format is not supported by binary" );IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ;
@@ -5483,10 +5410,10 @@ static int load_video_binaries(struct ia_css_pipe *pipe) &mycs->video_binary);if (err) { -if (video_vf_info) { -/* This will do another video binary lookup later for YUV_LINE format*/ +/* This will do another video binary lookup later for YUV_LINE format*/ +if (video_vf_info) need_vf_pp = true; - }else +else return err; }else if (video_vf_info) {/* The first video binary lookup is successful, but we may
@@ -5649,13 +5576,13 @@ static int load_video_binaries(struct ia_css_pipe *pipe) }static int -unload_video_binaries (struct ia_css_pipe *pipe) { +unload_video_binaries (struct ia_css_pipe *pipe) +{unsigned int i;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (pipe->mode !=IA_CSS_PIPE_ID_VIDEO )) - { +if ((!pipe) || (pipe->mode !=IA_CSS_PIPE_ID_VIDEO )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -5805,31 +5732,29 @@ static int sh_css_pipe_configure_viewfinder(struct ia_css_pipe *pipe, unsigned int width, unsigned int height, unsigned int min_width, enum ia_css_frame_format format, - unsigned int idx) { + unsigned int idx) +{ int err = 0;IA_CSS_ENTER_PRIVATE ("pipe = %p, width = %d, height = %d, min_width = %d, format = %d, idx = %d\n" , pipe, width, height, min_width, format, idx); -if (!pipe) - { +if (!pipe) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; } err =ia_css_util_check_res (width, height); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; }if (pipe->vf_output_info[idx].res.width != width || pipe->vf_output_info[idx].res.height != height || pipe->vf_output_info[idx].format != format) - {ia_css_frame_info_init (&pipe->vf_output_info[idx], width, height, format, min_width); - } +IA_CSS_LEAVE_ERR_PRIVATE (0 );return 0 ; }
@@ -6209,7 +6134,8 @@ static int load_primary_binaries( }static int -allocate_delay_frames (struct ia_css_pipe *pipe) { +allocate_delay_frames (struct ia_css_pipe *pipe) +{unsigned int num_delay_frames =0 , i =0 ;unsigned int dvs_frame_delay =0 ;struct ia_css_frame_info ref_info;
@@ -6219,8 +6145,7 @@ allocate_delay_frames(struct ia_css_pipe *pipe) {IA_CSS_ENTER_PRIVATE ("" ); -if (!pipe) - { +if (!pipe) {IA_CSS_ERROR ("Invalid args - pipe %p" , pipe);return -EINVAL ; }
@@ -6231,8 +6156,7 @@ allocate_delay_frames(struct ia_css_pipe *pipe) {if (dvs_frame_delay >0 ) num_delay_frames = dvs_frame_delay +1 ; -switch (mode) - { +switch (mode) {case IA_CSS_PIPE_ID_CAPTURE : {struct ia_css_capture_settings *mycs_capture = &pipe->pipe_settings.capture; (void )mycs_capture;
@@ -6284,8 +6208,7 @@ allocate_delay_frames(struct ia_css_pipe *pipe) { ref_info.raw_bit_depth =SH_CSS_REF_BIT_DEPTH ;assert (num_delay_frames <=MAX_NUM_VIDEO_DELAY_FRAMES ); -for (i =0 ; i < num_delay_frames; i++) - { +for (i =0 ; i < num_delay_frames; i++) { err =ia_css_frame_allocate_from_info (&delay_frames[i], &ref_info);if (err)return err;
@@ -6295,7 +6218,8 @@ allocate_delay_frames(struct ia_css_pipe *pipe) { }static int load_advanced_binaries ( -struct ia_css_pipe *pipe) { +struct ia_css_pipe *pipe) +{struct ia_css_frame_info pre_in_info, gdc_in_info, post_in_info, post_out_info, vf_info, *vf_pp_in_info, *pipe_out_info,
@@ -6412,7 +6336,8 @@ static int load_advanced_binaries( }static int load_bayer_isp_binaries ( -struct ia_css_pipe *pipe) { +struct ia_css_pipe *pipe) +{struct ia_css_frame_info pre_isp_in_info, *pipe_out_info;int err =0 ;struct ia_css_binary_descr pre_de_descr;
@@ -6441,7 +6366,8 @@ static int load_bayer_isp_binaries( }static int load_low_light_binaries ( -struct ia_css_pipe *pipe) { +struct ia_css_pipe *pipe) +{struct ia_css_frame_info pre_in_info, anr_in_info, post_in_info, post_out_info, vf_info, *pipe_vf_out_info, *pipe_out_info,
@@ -6579,7 +6505,8 @@ static bool copy_on_sp(struct ia_css_pipe *pipe) }static int load_capture_binaries ( -struct ia_css_pipe *pipe) { +struct ia_css_pipe *pipe) +{int err =0 ;bool must_be_raw;
@@ -6647,13 +6574,13 @@ static int load_capture_binaries( }static int -unload_capture_binaries (struct ia_css_pipe *pipe) { +unload_capture_binaries (struct ia_css_pipe *pipe) +{unsigned int i;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || ((pipe->mode !=IA_CSS_PIPE_ID_CAPTURE ) && (pipe->mode !=IA_CSS_PIPE_ID_COPY ))) - { +if ((!pipe) || ((pipe->mode !=IA_CSS_PIPE_ID_CAPTURE ) && (pipe->mode !=IA_CSS_PIPE_ID_COPY ))) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -6681,7 +6608,8 @@ unload_capture_binaries(struct ia_css_pipe *pipe) {static bool need_downscaling (const struct ia_css_resolution in_res, -const struct ia_css_resolution out_res) { +const struct ia_css_resolution out_res) +{if (in_res.width > out_res.width || in_res.height > out_res.height)return true;
@@ -6689,7 +6617,8 @@ need_downscaling(const struct ia_css_resolution in_res, }static bool -need_yuv_scaler_stage (const struct ia_css_pipe *pipe) { +need_yuv_scaler_stage (const struct ia_css_pipe *pipe) +{unsigned int i;struct ia_css_resolution in_res, out_res;
@@ -6731,7 +6660,8 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output(struct ia_css_frame_info *cas_scaler_in_info, struct ia_css_frame_info *cas_scaler_out_info, struct ia_css_frame_info *cas_scaler_vf_info, - struct ia_css_cas_binary_descr *descr) { + struct ia_css_cas_binary_descr *descr) +{ unsigned int i;unsigned int hor_ds_factor =0 , ver_ds_factor =0 ;int err =0 ;
@@ -6849,7 +6779,8 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output(/* FIXME: merge most of this and single output version */ static int ia_css_pipe_create_cas_scaler_desc (struct ia_css_pipe *pipe, -struct ia_css_cas_binary_descr *descr) { +struct ia_css_cas_binary_descr *descr) +{struct ia_css_frame_info in_info =IA_CSS_BINARY_DEFAULT_FRAME_INFO ;struct ia_css_frame_info *out_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE ];struct ia_css_frame_info *vf_out_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE ];
@@ -7005,7 +6936,8 @@ static int ia_css_pipe_create_cas_scaler_desc( }static void ia_css_pipe_destroy_cas_scaler_desc (struct ia_css_cas_binary_descr - *descr) { + *descr) +{ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"ia_css_pipe_destroy_cas_scaler_desc() enter:\n" );kfree (descr->in_info);
@@ -7023,7 +6955,8 @@ static void ia_css_pipe_destroy_cas_scaler_desc(struct ia_css_cas_binary_descr }static int -load_yuvpp_binaries (struct ia_css_pipe *pipe) { +load_yuvpp_binaries (struct ia_css_pipe *pipe) +{int err =0 ;bool need_scaler = false;struct ia_css_frame_info *vf_pp_in_info[IA_CSS_PIPE_MAX_OUTPUT_STAGE ];
@@ -7048,8 +6981,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { mycs = &pipe->pipe_settings.yuvpp; -for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) - { +for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) {if (pipe->vf_output_info[i].res.width !=0 ) { err =ia_css_util_check_vf_out_info (&pipe->output_info[i], &pipe->vf_output_info[i]);
@@ -7063,8 +6995,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) {/* we build up the pipeline starting at the end */ /* Capture post-processing */ -if (need_scaler) - { +if (need_scaler) {struct ia_css_binary_descr yuv_scaler_descr; err = ia_css_pipe_create_cas_scaler_desc(pipe,
@@ -7098,18 +7029,14 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { goto ERR; }ia_css_pipe_destroy_cas_scaler_desc (&cas_scaler_descr); - }else - { + }else { mycs->num_output =1 ; }if (need_scaler) - { next_binary = &mycs->yuv_scaler_binary[0 ]; - }else - { +else next_binary =NULL ; - }#if defined(ISP2401 )/*
@@ -7135,8 +7062,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { need_isp_copy_binary = true;#endif /* ISP2401 */ -if (need_isp_copy_binary) - { +if (need_isp_copy_binary) { err =load_copy_binary (pipe, &mycs->copy_binary, next_binary);
@@ -7166,8 +7092,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { }/* Viewfinder post-processing */ -if (need_scaler) - { +if (need_scaler) {for (i =0 , j =0 ; i < mycs->num_yuv_scaler; i++) {if (mycs->is_output_stage[i]) {assert (j <2 );
@@ -7177,19 +7102,17 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { } } mycs->num_vf_pp = j; - }else - { + }else { vf_pp_in_info[0 ] = &mycs->copy_binary.vf_frame_info; -for (i =1 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) { +for (i =1 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) vf_pp_in_info[i] =NULL ; - } + mycs->num_vf_pp =1 ; } mycs->vf_pp_binary =kzalloc (mycs->num_vf_pp *sizeof (struct ia_css_binary ),GFP_KERNEL ); -if (!mycs->vf_pp_binary) - { +if (!mycs->vf_pp_binary) { err = -ENOMEM ; goto ERR; }
@@ -7197,8 +7120,7 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { {struct ia_css_binary_descr vf_pp_descr; -for (i =0 ; i < mycs->num_vf_pp; i++) - { +for (i =0 ; i < mycs->num_vf_pp; i++) {if (pipe->vf_output_info[i].res.width !=0 ) {ia_css_pipe_get_vfpp_binarydesc (pipe, &vf_pp_descr, vf_pp_in_info[i], &pipe->vf_output_info[i]);
@@ -7214,34 +7136,31 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) { ERR:if (need_scaler) - {ia_css_pipe_destroy_cas_scaler_desc (&cas_scaler_descr); - } +ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"load_yuvpp_binaries() leave, err=%d\n" , err);return err; }static int -unload_yuvpp_binaries (struct ia_css_pipe *pipe) { +unload_yuvpp_binaries (struct ia_css_pipe *pipe) +{unsigned int i;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (pipe->mode !=IA_CSS_PIPE_ID_YUVPP )) - { +if ((!pipe) || (pipe->mode !=IA_CSS_PIPE_ID_YUVPP )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }ia_css_binary_unload (&pipe->pipe_settings.yuvpp.copy_binary);for (i =0 ; i < pipe->pipe_settings.yuvpp.num_yuv_scaler; i++) - {ia_css_binary_unload (&pipe->pipe_settings.yuvpp.yuv_scaler_binary[i]); - } +for (i =0 ; i < pipe->pipe_settings.yuvpp.num_vf_pp; i++) - {ia_css_binary_unload (&pipe->pipe_settings.yuvpp.vf_pp_binary[i]); - } +kfree (pipe->pipe_settings.yuvpp.is_output_stage); pipe->pipe_settings.yuvpp.is_output_stage =NULL ;kfree (pipe->pipe_settings.yuvpp.yuv_scaler_binary);
@@ -7291,25 +7210,23 @@ static int yuvpp_start(struct ia_css_pipe *pipe) }static int -sh_css_pipe_unload_binaries (struct ia_css_pipe *pipe) { +sh_css_pipe_unload_binaries (struct ia_css_pipe *pipe) +{int err =0 ;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if (!pipe) - { +if (!pipe) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }/* PIPE_MODE_COPY has no binaries, but has output frames to outside*/ -if (pipe->config.mode ==IA_CSS_PIPE_MODE_COPY ) - { +if (pipe->config.mode ==IA_CSS_PIPE_MODE_COPY ) {IA_CSS_LEAVE_ERR_PRIVATE (0 );return 0 ; } -switch (pipe->mode) - { +switch (pipe->mode) {case IA_CSS_PIPE_ID_PREVIEW : err =unload_preview_binaries (pipe);break ;
@@ -7330,7 +7247,8 @@ sh_css_pipe_unload_binaries(struct ia_css_pipe *pipe) { }static int -sh_css_pipe_load_binaries (struct ia_css_pipe *pipe) { +sh_css_pipe_load_binaries (struct ia_css_pipe *pipe) +{int err =0 ;assert (pipe);
@@ -7340,8 +7258,7 @@ sh_css_pipe_load_binaries(struct ia_css_pipe *pipe) {if (pipe->config.mode ==IA_CSS_PIPE_MODE_COPY )return err; -switch (pipe->mode) - { +switch (pipe->mode) {case IA_CSS_PIPE_ID_PREVIEW : err =load_preview_binaries (pipe);break ;
@@ -7360,8 +7277,7 @@ sh_css_pipe_load_binaries(struct ia_css_pipe *pipe) { err = -EINVAL ;break ; } -if (err) - { +if (err) {if (sh_css_pipe_unload_binaries (pipe)) {/* currently css does not support multiple error returns in a single function, * using -EINVAL in this case */
@@ -7372,7 +7288,8 @@ sh_css_pipe_load_binaries(struct ia_css_pipe *pipe) { }static int -create_host_yuvpp_pipeline (struct ia_css_pipe *pipe) { +create_host_yuvpp_pipeline (struct ia_css_pipe *pipe) +{struct ia_css_pipeline *me;int err =0 ; struct ia_css_pipeline_stage *vf_pp_stage = NULL,
@@ -7399,15 +7316,13 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) {#endif IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe); -if ((!pipe) || (!pipe->stream) || (pipe->mode !=IA_CSS_PIPE_ID_YUVPP )) - { +if ((!pipe) || (!pipe->stream) || (pipe->mode !=IA_CSS_PIPE_ID_YUVPP )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; } me = &pipe->pipeline;ia_css_pipeline_clean (me); -for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) - { +for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) { out_frame[i] =NULL ; vf_frame[i] =NULL ; }
@@ -7435,8 +7350,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) {/* the input frame can come from: * a) memory: connect yuvscaler to me->in_frame * b) sensor, via copy binary: connect yuvscaler to copy binary later on */ -if (need_in_frameinfo_memory) - { +if (need_in_frameinfo_memory) {/* TODO: improve for different input formats. */ /*
@@ -7485,13 +7399,11 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { } in_frame = &me->in_frame; - }else - { + }else { in_frame =NULL ; } -for (i =0 ; i < num_output_stage; i++) - { +for (i =0 ; i < num_output_stage; i++) {assert (i <IA_CSS_PIPE_MAX_OUTPUT_STAGE );if (pipe->output_info[i].res.width !=0 ) { err =init_out_frameinfo_defaults (pipe, &me->out_frame[i], i);
@@ -7518,8 +7430,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { yuv_scaler_binary = pipe->pipe_settings.yuvpp.yuv_scaler_binary; need_scaler =need_yuv_scaler_stage (pipe); -if (pipe->pipe_settings.yuvpp.copy_binary.info) - { +if (pipe->pipe_settings.yuvpp.copy_binary.info) {struct ia_css_frame *in_frame_local =NULL ;#ifdef ISP2401
@@ -7557,8 +7468,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { } } -if (need_scaler) - { +if (need_scaler) {struct ia_css_frame *tmp_out_frame =NULL ;struct ia_css_frame *tmp_vf_frame =NULL ;struct ia_css_frame *tmp_in_frame = in_frame;
@@ -7598,8 +7508,7 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) { j++; } } - }else if (copy_stage) - { + }else if (copy_stage) {if (vf_frame[0 ] && vf_frame[0 ]->info.res.width !=0 ) { in_frame = copy_stage->args.out_vf_frame; err = add_vf_pp_stage(pipe, in_frame, vf_frame[0], &vf_pp_binary[0],
@@ -7621,7 +7530,8 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) {static int create_host_copy_pipeline (struct ia_css_pipe *pipe,unsigned int max_input_width, -struct ia_css_frame *out_frame) { +struct ia_css_frame *out_frame) +{struct ia_css_pipeline *me;int err =0 ;struct ia_css_pipeline_stage_desc stage_desc;
@@ -7638,16 +7548,14 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe, out_frame->flash_state =IA_CSS_FRAME_FLASH_STATE_NONE ;if (copy_on_sp (pipe) && - pipe->stream->config.input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 ) - { + pipe->stream->config.input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 ) {ia_css_frame_info_init ( &out_frame->info,JPEG_BYTES ,1 ,IA_CSS_FRAME_FORMAT_BINARY_8 ,0 ); - }else if (out_frame->info.format ==IA_CSS_FRAME_FORMAT_RAW ) - { + }else if (out_frame->info.format ==IA_CSS_FRAME_FORMAT_RAW ) { out_frame->info.raw_bit_depth =ia_css_pipe_util_pipe_input_format_bpp (pipe); }
@@ -7671,7 +7579,8 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe, }static int -create_host_isyscopy_capture_pipeline (struct ia_css_pipe *pipe) { +create_host_isyscopy_capture_pipeline (struct ia_css_pipe *pipe) +{struct ia_css_pipeline *me = &pipe->pipeline;int err =0 ;struct ia_css_pipeline_stage_desc stage_desc;
@@ -7715,7 +7624,8 @@ create_host_isyscopy_capture_pipeline(struct ia_css_pipe *pipe) { }static int -create_host_regular_capture_pipeline (struct ia_css_pipe *pipe) { +create_host_regular_capture_pipeline (struct ia_css_pipe *pipe) +{struct ia_css_pipeline *me;int err =0 ;enum ia_css_capture_mode mode;
@@ -7779,8 +7689,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {/* Construct in_frame info (only in case we have dynamic input */ need_in_frameinfo_memory = pipe->stream->config.mode ==IA_CSS_INPUT_MODE_MEMORY ;#endif -if (need_in_frameinfo_memory) - { +if (need_in_frameinfo_memory) { err =init_in_frameinfo_memory_defaults (pipe, &me->in_frame,IA_CSS_FRAME_FORMAT_RAW );if (err) {
@@ -7789,22 +7698,19 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { } in_frame = &me->in_frame; - }else - { + }else { in_frame =NULL ; } err =init_out_frameinfo_defaults (pipe, &me->out_frame[0 ],0 ); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; } out_frame = &me->out_frame[0 ];/* Construct vf_frame info (only in case we have VF) */ -if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0 ]) - { +if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0 ]) {if (mode ==IA_CSS_CAPTURE_MODE_RAW || mode ==IA_CSS_CAPTURE_MODE_BAYER ) {/* These modes don't support viewfinder output */ vf_frame =NULL ;
@@ -7812,22 +7718,20 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {init_vf_frameinfo_defaults (pipe, &me->vf_frame[0 ],0 ); vf_frame = &me->vf_frame[0 ]; } - }else - { + }else { vf_frame =NULL ; } copy_binary = &pipe->pipe_settings.capture.copy_binary; num_primary_stage = pipe->pipe_settings.capture.num_primary_stage; -if ((num_primary_stage ==0 ) && (mode ==IA_CSS_CAPTURE_MODE_PRIMARY )) - { +if ((num_primary_stage ==0 ) && (mode ==IA_CSS_CAPTURE_MODE_PRIMARY )) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; } +for (i =0 ; i < num_primary_stage; i++) - { primary_binary[i] = &pipe->pipe_settings.capture.primary_binary[i]; - } + vf_pp_binary = &pipe->pipe_settings.capture.vf_pp_binary; pre_isp_binary = &pipe->pipe_settings.capture.pre_isp_binary; anr_gdc_binary = &pipe->pipe_settings.capture.anr_gdc_binary;
@@ -7844,8 +7748,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { need_yuv_pp = (yuv_scaler_binary && yuv_scaler_binary->info); need_ldc = (capture_ldc_binary && capture_ldc_binary->info); -if (pipe->pipe_settings.capture.copy_binary.info) - { +if (pipe->pipe_settings.capture.copy_binary.info) {if (raw) {ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame);#if defined(ISP2401 )
@@ -7874,13 +7777,11 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; } - }else if (pipe->stream->config.continuous) - { + }else if (pipe->stream->config.continuous) { in_frame = pipe->stream->last_pipe->continuous_frames[0 ]; } -if (mode ==IA_CSS_CAPTURE_MODE_PRIMARY ) - { +if (mode ==IA_CSS_CAPTURE_MODE_PRIMARY ) {struct ia_css_frame *local_in_frame =NULL ;struct ia_css_frame *local_out_frame =NULL ;
@@ -7925,8 +7826,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {IA_CSS_BINARY_MODE_COPY ; current_stage->args.copy_output = current_stage->args.copy_vf; }else if (mode ==IA_CSS_CAPTURE_MODE_ADVANCED || - mode ==IA_CSS_CAPTURE_MODE_LOW_LIGHT ) - { + mode ==IA_CSS_CAPTURE_MODE_LOW_LIGHT ) {ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, pre_isp_binary, out_frames, in_frame,NULL );
@@ -7962,8 +7862,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; } - }else if (mode ==IA_CSS_CAPTURE_MODE_BAYER ) - { + }else if (mode ==IA_CSS_CAPTURE_MODE_BAYER ) {ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame);ia_css_pipe_get_generic_stage_desc (&stage_desc, pre_isp_binary, out_frames, in_frame,NULL );
@@ -7977,8 +7876,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { }#ifndef ISP2401 -if (need_pp && current_stage) - { +if (need_pp && current_stage) {struct ia_css_frame *local_in_frame =NULL ; local_in_frame = current_stage->args.out_frame[0 ];
@@ -7996,8 +7894,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { need_yuv_pp ? NULL : out_frame,#else /* ldc and capture_pp not supported in same pipeline */ -if (need_ldc && current_stage) - { +if (need_ldc && current_stage) { in_frame = current_stage->args.out_frame[0 ];ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame); ia_css_pipe_get_generic_stage_desc(&stage_desc, capture_ldc_binary,
@@ -8005,8 +7902,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, NULL); - }else if (need_pp && current_stage) - { + }else if (need_pp && current_stage) { in_frame = current_stage->args.out_frame[0 ]; err = add_capture_pp_stage(pipe, me, in_frame, need_yuv_pp ? NULL : out_frame, #endif
@@ -8018,8 +7914,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { } } -if (need_yuv_pp && current_stage) - { +if (need_yuv_pp && current_stage) {struct ia_css_frame *tmp_in_frame = current_stage->args.out_frame[0 ];struct ia_css_frame *tmp_out_frame =NULL ;
@@ -8051,8 +7946,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) {* should not be considered as a clean solution. Proper * investigation should be done to come up with the clean solution. * */ -if (mode !=IA_CSS_CAPTURE_MODE_RAW && mode !=IA_CSS_CAPTURE_MODE_BAYER && current_stage && vf_frame) - { +if (mode !=IA_CSS_CAPTURE_MODE_RAW && mode !=IA_CSS_CAPTURE_MODE_BAYER && current_stage && vf_frame) { in_frame = current_stage->args.out_vf_frame; err =add_vf_pp_stage (pipe, in_frame, vf_frame, vf_pp_binary, ¤t_stage);
@@ -8070,7 +7964,8 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) { }static int -create_host_capture_pipeline (struct ia_css_pipe *pipe) { +create_host_capture_pipeline (struct ia_css_pipe *pipe) +{int err =0 ;IA_CSS_ENTER_PRIVATE ("pipe = %p" , pipe);
@@ -8079,8 +7974,7 @@ create_host_capture_pipeline(struct ia_css_pipe *pipe) { err =create_host_isyscopy_capture_pipeline (pipe); else err =create_host_regular_capture_pipeline (pipe); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; }
@@ -8091,7 +7985,8 @@ create_host_capture_pipeline(struct ia_css_pipe *pipe) { }static int capture_start ( -struct ia_css_pipe *pipe) { +struct ia_css_pipe *pipe) +{struct ia_css_pipeline *me;int err =0 ;
@@ -8162,7 +8057,8 @@ static int capture_start(static int sh_css_pipe_get_output_frame_info (struct ia_css_pipe *pipe,struct ia_css_frame_info *info, -unsigned int idx) { +unsigned int idx) +{assert (pipe);assert (info);
@@ -8171,8 +8067,7 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe, *info = pipe->output_info[idx];if (copy_on_sp (pipe) && - pipe->stream->config.input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 ) - { + pipe->stream->config.input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 ) { ia_css_frame_info_init( info, JPEG_BYTES,
@@ -8180,8 +8075,7 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe,IA_CSS_FRAME_FORMAT_BINARY_8 , 0); }else if (info->format ==IA_CSS_FRAME_FORMAT_RAW || - info->format ==IA_CSS_FRAME_FORMAT_RAW_PACKED ) - { + info->format ==IA_CSS_FRAME_FORMAT_RAW_PACKED ) { info->raw_bit_depth =ia_css_pipe_util_pipe_input_format_bpp (pipe); }
@@ -8195,7 +8089,8 @@ void ia_css_stream_send_input_frame(const struct ia_css_stream *stream, const unsigned short *data, unsigned int width, - unsigned int height) { + unsigned int height) +{assert (stream); ia_css_inputfifo_send_input_frame(
@@ -8206,7 +8101,8 @@ ia_css_stream_send_input_frame(const struct ia_css_stream *stream, }void -ia_css_stream_start_input_frame (const struct ia_css_stream *stream) { +ia_css_stream_start_input_frame (const struct ia_css_stream *stream) +{assert (stream); ia_css_inputfifo_start_frame(
@@ -8220,7 +8116,8 @@ ia_css_stream_send_input_line(const struct ia_css_stream *stream,const unsigned short *data, unsigned int width, const unsigned short *data2, - unsigned int width2) { + unsigned int width2) +{assert (stream ); ia_css_inputfifo_send_line(stream->config.channel_id,
@@ -8231,7 +8128,8 @@ void ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream, enum atomisp_input_format format, const unsigned short *data, - unsigned int width) { + unsigned int width) +{assert (stream);if (!data || width ==0 )return ;
@@ -8240,14 +8138,16 @@ ia_css_stream_send_input_embedded_line(const struct ia_css_stream *stream, }void -ia_css_stream_end_input_frame (const struct ia_css_stream *stream) { +ia_css_stream_end_input_frame (const struct ia_css_stream *stream) +{assert (stream);ia_css_inputfifo_end_frame (stream->config.channel_id); }static void -append_firmware (struct ia_css_fw_info **l,struct ia_css_fw_info *firmware) { +append_firmware (struct ia_css_fw_info **l,struct ia_css_fw_info *firmware) +{IA_CSS_ENTER_PRIVATE ("l = %p, firmware = %p" , l, firmware);if (!l) {IA_CSS_ERROR ("NULL fw_info" );
@@ -8262,7 +8162,8 @@ append_firmware(struct ia_css_fw_info **l, struct ia_css_fw_info *firmware) { }static void -remove_firmware (struct ia_css_fw_info **l,struct ia_css_fw_info *firmware) { +remove_firmware (struct ia_css_fw_info **l,struct ia_css_fw_info *firmware) +{assert (*l);assert (firmware); (void )l;
@@ -8304,12 +8205,12 @@ static int upload_isp_code(struct ia_css_fw_info *firmware) }static int -acc_load_extension (struct ia_css_fw_info *firmware) { +acc_load_extension (struct ia_css_fw_info *firmware) +{int err;struct ia_css_fw_info *hd = firmware; -while (hd) - { +while (hd) { err =upload_isp_code (hd);if (err)return err;
@@ -8323,7 +8224,8 @@ acc_load_extension(struct ia_css_fw_info *firmware) { }static void -acc_unload_extension (struct ia_css_fw_info *firmware) { +acc_unload_extension (struct ia_css_fw_info *firmware) +{struct ia_css_fw_info *hd = firmware;struct ia_css_fw_info *hdn =NULL ;
@@ -8347,13 +8249,13 @@ acc_unload_extension(struct ia_css_fw_info *firmware) {/* Load firmware for extension */ static int ia_css_pipe_load_extension (struct ia_css_pipe *pipe, -struct ia_css_fw_info *firmware) { +struct ia_css_fw_info *firmware) +{int err =0 ;IA_CSS_ENTER_PRIVATE ("fw = %p pipe = %p" , firmware, pipe); -if ((!firmware) || (!pipe)) - { +if ((!firmware) || (!pipe)) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -8371,7 +8273,8 @@ ia_css_pipe_load_extension(struct ia_css_pipe *pipe,/* Unload firmware for extension */ static void ia_css_pipe_unload_extension (struct ia_css_pipe *pipe, -struct ia_css_fw_info *firmware) { +struct ia_css_fw_info *firmware) +{IA_CSS_ENTER_PRIVATE ("fw = %p pipe = %p" , firmware, pipe);if ((!firmware) || (!pipe)) {
@@ -8390,7 +8293,8 @@ ia_css_pipe_unload_extension(struct ia_css_pipe *pipe, }bool -ia_css_pipeline_uses_params (struct ia_css_pipeline *me) { +ia_css_pipeline_uses_params (struct ia_css_pipeline *me) +{struct ia_css_pipeline_stage *stage;assert (me);
@@ -8411,7 +8315,8 @@ ia_css_pipeline_uses_params(struct ia_css_pipeline *me) {static int sh_css_pipeline_add_acc_stage (struct ia_css_pipeline *pipeline, -const void *acc_fw) { +const void *acc_fw) +{struct ia_css_fw_info *fw = (struct ia_css_fw_info *)acc_fw;/* In QoS case, load_extension already called, so skipping */ int err =0 ;
@@ -8423,8 +8328,7 @@ sh_css_pipeline_add_acc_stage(struct ia_css_pipeline *pipeline,"sh_css_pipeline_add_acc_stage() enter: pipeline=%p, acc_fw=%p\n" , pipeline, acc_fw); -if (!err) - { +if (!err) {struct ia_css_pipeline_stage_desc stage_desc;ia_css_pipe_get_acc_stage_desc (&stage_desc,NULL , fw);
@@ -8443,7 +8347,8 @@ sh_css_pipeline_add_acc_stage(struct ia_css_pipeline *pipeline,* Refer to "sh_css_internal.h" for details. */ int ia_css_stream_capture_frame (struct ia_css_stream *stream, -unsigned int exp_id) { +unsigned int exp_id) +{struct sh_css_tag_descr tag_descr;u32 encoded_tag_descr;int err;
@@ -8485,7 +8390,8 @@ int ia_css_stream_capture(struct ia_css_stream *stream, int num_captures, unsigned int skip, - int offset) { + int offset) +{ struct sh_css_tag_descr tag_descr;unsigned int encoded_tag_descr;int return_err;
@@ -8548,8 +8454,9 @@ void ia_css_stream_request_flash(struct ia_css_stream *stream)ia_css_debug_dump_sp_sw_debug_info (); ia_css_debug_dump_debug_info(NULL); } - }else + }else {IA_CSS_LOG ("SP is not running!" ); + }#endif ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@@ -8557,7 +8464,8 @@ void ia_css_stream_request_flash(struct ia_css_stream *stream) }static void -sh_css_init_host_sp_control_vars (void ) { +sh_css_init_host_sp_control_vars (void ) +{const struct ia_css_fw_info *fw;unsigned int HIVE_ADDR_ia_css_ispctrl_sp_isp_started;
@@ -8641,7 +8549,8 @@ void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config)void ia_css_pipe_extra_config_defaults (struct ia_css_pipe_extra_config - *extra_config) { + *extra_config) +{if (!extra_config) {IA_CSS_ERROR ("NULL input parameter" );return ;
@@ -8671,11 +8580,11 @@ void ia_css_stream_config_defaults(struct ia_css_stream_config *stream_config) }static int -ia_css_acc_pipe_create (struct ia_css_pipe *pipe) { +ia_css_acc_pipe_create (struct ia_css_pipe *pipe) +{int err =0 ; -if (!pipe) - { +if (!pipe) {IA_CSS_ERROR ("NULL input parameter" );return -EINVAL ; }
@@ -8685,9 +8594,7 @@ ia_css_acc_pipe_create(struct ia_css_pipe *pipe) { pipe->config.acc_num_execs =1 ;if (pipe->config.acc_extension) - { err =ia_css_pipe_load_extension (pipe, pipe->config.acc_extension); - }return err; }
@@ -8706,9 +8613,8 @@ int ia_css_pipe_create(const struct ia_css_pipe_config *config, err =ia_css_pipe_create_extra (config,NULL , pipe); -if (err ==0 ) { +if (err ==0 )IA_CSS_LOG ("pipe created successfully = %p" , *pipe); - }IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -8718,7 +8624,8 @@ int ia_css_pipe_create(const struct ia_css_pipe_config *config,int ia_css_pipe_create_extra (const struct ia_css_pipe_config *config,const struct ia_css_pipe_extra_config *extra_config, -struct ia_css_pipe **pipe) { +struct ia_css_pipe **pipe) +{int err = -EINVAL ;struct ia_css_pipe *internal_pipe =NULL ;unsigned int i;
@@ -8726,14 +8633,12 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,IA_CSS_ENTER_PRIVATE ("config = %p, extra_config = %p and pipe = %p" , config, extra_config, pipe);/* do not allow to create more than the maximum limit */ -if (my_css.pipe_counter >=IA_CSS_PIPELINE_NUM_MAX ) - { +if (my_css.pipe_counter >=IA_CSS_PIPELINE_NUM_MAX ) {IA_CSS_LEAVE_ERR_PRIVATE (-ENOSPC );return -EINVAL ; } -if ((!pipe) || (!config)) - { +if ((!pipe) || (!config)) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; }
@@ -8742,8 +8647,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,ia_css_debug_dump_pipe_extra_config (extra_config); err =create_pipe (config->mode, &internal_pipe, false); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; }
@@ -8755,8 +8659,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,else ia_css_pipe_extra_config_defaults (&internal_pipe->extra_config); -if (config->mode ==IA_CSS_PIPE_MODE_ACC ) - { +if (config->mode ==IA_CSS_PIPE_MODE_ACC ) {/* Temporary hack to migrate acceleration to CSS 2.0. * In the future the code for all pipe types should be * unified. */
@@ -8783,15 +8686,13 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,set bayer_ds_out_res equal to IF output resolution(IF may do cropping on sensor output) or use default decimation factor 1. */ if (internal_pipe->extra_config.enable_raw_binning && - internal_pipe->config.bayer_ds_out_res.width) - { + internal_pipe->config.bayer_ds_out_res.width) {/* fill some code here, if no code is needed, please remove it during integration */ }/* YUV downscaling */ if ((internal_pipe->config.vf_pp_in_res.width || - internal_pipe->config.capt_pp_in_res.width)) - { + internal_pipe->config.capt_pp_in_res.width)) {enum ia_css_frame_format format;if (internal_pipe->config.vf_pp_in_res.width) {
@@ -8812,8 +8713,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, } }if (internal_pipe->config.vf_pp_in_res.width && - internal_pipe->config.mode ==IA_CSS_PIPE_MODE_PREVIEW ) - { + internal_pipe->config.mode ==IA_CSS_PIPE_MODE_PREVIEW ) { ia_css_frame_info_init( &internal_pipe->vf_yuv_ds_input_info, internal_pipe->config.vf_pp_in_res.width,
@@ -8821,8 +8721,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, IA_CSS_FRAME_FORMAT_YUV_LINE, 0); }/* handle bayer downscaling output info */ -if (internal_pipe->config.bayer_ds_out_res.width) - { +if (internal_pipe->config.bayer_ds_out_res.width) { ia_css_frame_info_init( &internal_pipe->bds_output_info, internal_pipe->config.bayer_ds_out_res.width,
@@ -8831,8 +8730,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, }/* handle output info, assume always needed */ -for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) - { +for (i =0 ; i <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; i++) {if (internal_pipe->config.output_info[i].res.width) { err = sh_css_pipe_configure_output( internal_pipe,
@@ -8868,8 +8766,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, } } } -if (internal_pipe->config.acc_extension) - { +if (internal_pipe->config.acc_extension) { err =ia_css_pipe_load_extension (internal_pipe, internal_pipe->config.acc_extension);if (err) {
@@ -8889,18 +8786,18 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,int ia_css_pipe_get_info (const struct ia_css_pipe *pipe, -struct ia_css_pipe_info *pipe_info) { +struct ia_css_pipe_info *pipe_info) +{ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_pipe_get_info()\n" ); +assert (pipe_info); -if (!pipe_info) - { +if (!pipe_info) {ia_css_debug_dtrace (IA_CSS_DEBUG_ERROR ,"ia_css_pipe_get_info: pipe_info cannot be NULL\n" );return -EINVAL ; } -if (!pipe || !pipe->stream) - { +if (!pipe || !pipe->stream) {ia_css_debug_dtrace (IA_CSS_DEBUG_ERROR ,"ia_css_pipe_get_info: ia_css_stream_create needs to be called before ia_css_[stream/pipe]_get_info\n" );return -EINVAL ;
@@ -8928,40 +8825,36 @@ bool ia_css_pipe_has_dvs_stats(struct ia_css_pipe_info *pipe_info)int ia_css_pipe_override_frame_format (struct ia_css_pipe *pipe,int pin_index, -enum ia_css_frame_format new_format) { +enum ia_css_frame_format new_format) +{int err =0 ;IA_CSS_ENTER_PRIVATE ("pipe = %p, pin_index = %d, new_formats = %d" , pipe, pin_index, new_format); -if (!pipe) - { +if (!pipe) {IA_CSS_ERROR ("pipe is not set" ); err = -EINVAL ;IA_CSS_LEAVE_ERR_PRIVATE (err);return err; } -if (0 != pin_index &&1 != pin_index) - { +if (0 != pin_index &&1 != pin_index) {IA_CSS_ERROR ("pin index is not valid" ); err = -EINVAL ;IA_CSS_LEAVE_ERR_PRIVATE (err);return err; } -if (new_format !=IA_CSS_FRAME_FORMAT_NV12_TILEY ) - { +if (new_format !=IA_CSS_FRAME_FORMAT_NV12_TILEY ) {IA_CSS_ERROR ("new format is not valid" ); err = -EINVAL ;IA_CSS_LEAVE_ERR_PRIVATE (err);return err; - }else - { + }else { err =ia_css_pipe_check_format (pipe, new_format);if (!err) { -if (pin_index ==0 ) { +if (pin_index ==0 ) pipe->output_info[0 ].format = new_format; - }else { +else pipe->vf_output_info[0 ].format = new_format; - } } }IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -8971,7 +8864,8 @@ ia_css_pipe_override_frame_format(struct ia_css_pipe *pipe,#if !defined(ISP2401 )/* Configuration of INPUT_SYSTEM_VERSION_2401 is done on SP */ static int -ia_css_stream_configure_rx (struct ia_css_stream *stream) { +ia_css_stream_configure_rx (struct ia_css_stream *stream) +{struct ia_css_input_port *config;assert (stream);
@@ -9000,11 +8894,10 @@ ia_css_stream_configure_rx(struct ia_css_stream *stream) {if (config->compression.type ==IA_CSS_CSI2_COMPRESSION_TYPE_NONE ) stream->csi_rx_config.comp =MIPI_PREDICTOR_NONE ;else - {/* not implemented yet, requires extension of the rx_cfg_t * struct */ return -EINVAL ; - } + stream->csi_rx_config.is_two_ppc = (stream->config.pixels_per_clock ==2 ); stream->reconfigure_css_rx = true;return 0 ;
@@ -9015,7 +8908,8 @@ static struct ia_css_pipe * find_pipe(struct ia_css_pipe *pipes[], unsigned int num_pipes, enum ia_css_pipe_mode mode, - bool copy_pipe) { + bool copy_pipe) +{ unsigned int i;assert (pipes);
@@ -9031,21 +8925,20 @@ find_pipe(struct ia_css_pipe *pipes[], }static int -ia_css_acc_stream_create (struct ia_css_stream *stream) { +ia_css_acc_stream_create (struct ia_css_stream *stream) +{int i;int err =0 ;assert (stream);IA_CSS_ENTER_PRIVATE ("stream = %p" , stream); -if (!stream) - { +if (!stream) {IA_CSS_LEAVE_ERR_PRIVATE (-EINVAL );return -EINVAL ; } -for (i =0 ; i < stream->num_pipes; i++) - { +for (i =0 ; i < stream->num_pipes; i++) {struct ia_css_pipe *pipe = stream->pipes[i];assert (pipe);
@@ -9059,14 +8952,12 @@ ia_css_acc_stream_create(struct ia_css_stream *stream) {/* Map SP threads before doing anything. */ err =map_sp_threads (stream, true); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; } -for (i =0 ; i < stream->num_pipes; i++) - { +for (i =0 ; i < stream->num_pipes; i++) {struct ia_css_pipe *pipe = stream->pipes[i];assert (pipe);
@@ -9074,8 +8965,7 @@ ia_css_acc_stream_create(struct ia_css_stream *stream) { } err =create_host_pipeline_structure (stream); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; }
@@ -9089,7 +8979,8 @@ ia_css_acc_stream_create(struct ia_css_stream *stream) {static int metadata_info_init (const struct ia_css_metadata_config *mdc, -struct ia_css_metadata_info *md) { +struct ia_css_metadata_info *md) +{/* Either both width and height should be set or neither */ if ((mdc->resolution.height >0 ) ^ (mdc->resolution.width >0 ))return -EINVAL ;
@@ -9149,7 +9040,8 @@ int ia_css_stream_create(const struct ia_css_stream_config *stream_config, int num_pipes, struct ia_css_pipe *pipes[], - struct ia_css_stream **stream) { + struct ia_css_stream **stream) +{ struct ia_css_pipe *curr_pipe;struct ia_css_stream *curr_stream =NULL ;bool spcopyonly;
@@ -9168,8 +9060,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,/* some checks */ if (num_pipes ==0 || !stream || - !pipes) - { + !pipes) { err = -EINVAL ;IA_CSS_LEAVE_ERR (err);return err;
@@ -9178,8 +9069,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,#if !defined(ISP2401 )/* We don't support metadata for JPEG stream, since they both use str2mem */ if (stream_config->input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 && - stream_config->metadata_config.resolution.height >0 ) - { + stream_config->metadata_config.resolution.height >0 ) { err = -EINVAL ;IA_CSS_LEAVE_ERR (err);return err;
@@ -9187,8 +9077,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,#endif #ifdef ISP2401 -if (stream_config->online && stream_config->pack_raw_pixels) - { +if (stream_config->online && stream_config->pack_raw_pixels) {IA_CSS_LOG ("online and pack raw is invalid on input system 2401" ); err = -EINVAL ;IA_CSS_LEAVE_ERR (err);
@@ -9243,16 +9132,14 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,/* Currently we only supported metadata up to a certain size. */ err =metadata_info_init (&stream_config->metadata_config, &md_info); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err);return err; }/* allocate the stream instance */ curr_stream =kzalloc (sizeof (struct ia_css_stream ),GFP_KERNEL ); -if (!curr_stream) - { +if (!curr_stream) { err = -ENOMEM ;IA_CSS_LEAVE_ERR (err);return err;
@@ -9263,8 +9150,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,/* allocate pipes */ curr_stream->num_pipes = num_pipes; curr_stream->pipes =kcalloc (num_pipes,sizeof (struct ia_css_pipe *),GFP_KERNEL ); -if (!curr_stream->pipes) - { +if (!curr_stream->pipes) { curr_stream->num_pipes =0 ;kfree (curr_stream); curr_stream =NULL ;
@@ -9287,8 +9173,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,#endif #ifdef ISP2401 -if (curr_stream->config.online) - { +if (curr_stream->config.online) { curr_stream->config.source.port.num_lanes = stream_config->source.port.num_lanes; curr_stream->config.mode =IA_CSS_INPUT_MODE_BUFFERED_SENSOR ;
@@ -9306,8 +9191,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, curr_stream->config.lock_all);/* copy mode specific stuff */ -switch (curr_stream->config.mode) - { +switch (curr_stream->config.mode) {case IA_CSS_INPUT_MODE_SENSOR :case IA_CSS_INPUT_MODE_BUFFERED_SENSOR :#if !defined(ISP2401 )
@@ -9349,14 +9233,12 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, err =aspect_ratio_crop_init (curr_stream, pipes, &aspect_ratio_crop_enabled); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err); goto ERR; }#endif -for (i =0 ; i < num_pipes; i++) - { +for (i =0 ; i < num_pipes; i++) {struct ia_css_resolution effective_res; curr_pipe = pipes[i];
@@ -9396,9 +9278,8 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,if (pipes[i]->config.mode !=IA_CSS_PIPE_MODE_ACC && pipes[i]->config.mode !=IA_CSS_PIPE_MODE_COPY ) { err =check_pipe_resolutions (pipes[i]); -if (err) { +if (err) goto ERR; - } } } }
@@ -9408,20 +9289,17 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, goto ERR;IA_CSS_LOG ("isp_params_configs: %p" , curr_stream->isp_params_configs); -if (num_pipes ==1 && pipes[0 ]->config.mode ==IA_CSS_PIPE_MODE_ACC ) - { +if (num_pipes ==1 && pipes[0 ]->config.mode ==IA_CSS_PIPE_MODE_ACC ) { *stream = curr_stream; err =ia_css_acc_stream_create (curr_stream); goto ERR; }/* sensor binning */ -if (!spcopyonly) - { +if (!spcopyonly) { sensor_binning_changed =sh_css_params_set_binning_factor (curr_stream, curr_stream->config.sensor_binning_factor); - }else - { + }else { sensor_binning_changed = false; }
@@ -9432,8 +9310,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, curr_stream->cont_capt = false;/* Temporary hack: we give the preview pipe a reference to the capture * pipe in continuous capture mode. */ -if (curr_stream->config.continuous) - { +if (curr_stream->config.continuous) {/* Search for the preview pipe and create the copy pipe */ struct ia_css_pipe *preview_pipe;struct ia_css_pipe *video_pipe;
@@ -9481,9 +9358,9 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, preview_pipe->pipe_settings.preview.copy_pipe = copy_pipe; copy_pipe->stream = curr_stream; } -if (preview_pipe && curr_stream->cont_capt) { +if (preview_pipe && curr_stream->cont_capt) preview_pipe->pipe_settings.preview.capture_pipe = capture_pipe; - } +if (video_pipe && !video_pipe->pipe_settings.video.copy_pipe) { err =create_pipe (IA_CSS_PIPE_MODE_CAPTURE , ©_pipe, true);if (err)
@@ -9492,15 +9369,13 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, video_pipe->pipe_settings.video.copy_pipe = copy_pipe; copy_pipe->stream = curr_stream; } -if (video_pipe && curr_stream->cont_capt) { +if (video_pipe && curr_stream->cont_capt) video_pipe->pipe_settings.video.capture_pipe = capture_pipe; - } -if (preview_pipe && acc_pipe) { + +if (preview_pipe && acc_pipe) preview_pipe->pipe_settings.preview.acc_pipe = acc_pipe; - } } -for (i =0 ; i < num_pipes; i++) - { +for (i =0 ; i < num_pipes; i++) { curr_pipe = pipes[i];/* set current stream */ curr_pipe->stream = curr_stream;
@@ -9521,8 +9396,7 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, }/* now pipes have been configured, info should be available */ -for (i =0 ; i < num_pipes; i++) - { +for (i =0 ; i < num_pipes; i++) {struct ia_css_pipe_info *pipe_info =NULL ; curr_pipe = pipes[i];
@@ -9572,22 +9446,19 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,/* Map SP threads before doing anything. */ err =map_sp_threads (curr_stream, true); -if (err) - { +if (err) {IA_CSS_LOG ("map_sp_threads: return_err=%d" , err); goto ERR; } -for (i =0 ; i < num_pipes; i++) - { +for (i =0 ; i < num_pipes; i++) { curr_pipe = pipes[i];ia_css_pipe_map_queue (curr_pipe, true); }/* Create host side pipeline objects without stages */ err =create_host_pipeline_structure (curr_stream); -if (err) - { +if (err) {IA_CSS_LOG ("create_host_pipeline_structure: return_err=%d" , err); goto ERR; }
@@ -9625,13 +9496,13 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, }int -ia_css_stream_destroy (struct ia_css_stream *stream) { +ia_css_stream_destroy (struct ia_css_stream *stream) +{int i;int err =0 ;IA_CSS_ENTER_PRIVATE ("stream = %p" , stream); -if (!stream) - { +if (!stream) { err = -EINVAL ;IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -9640,8 +9511,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream) {ia_css_stream_isp_parameters_uninit (stream);if ((stream->last_pipe) && -ia_css_pipeline_is_mapped (stream->last_pipe->pipe_num)) - { +ia_css_pipeline_is_mapped (stream->last_pipe->pipe_num)) {#if defined(ISP2401 )bool free_mpi;
@@ -9703,8 +9573,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream) { }/* remove references from pipes to stream */ -for (i =0 ; i < stream->num_pipes; i++) - { +for (i =0 ; i < stream->num_pipes; i++) {struct ia_css_pipe *entry = stream->pipes[i];assert (entry);
@@ -9733,8 +9602,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream) {/* working mode: take out of the seed list */ if (my_css_save.mode == sh_css_mode_working) {for (i =0 ; i <MAX_ACTIVE_STREAMS ; i++) { -if (my_css_save.stream_seeds[i].stream == stream) - { +if (my_css_save.stream_seeds[i].stream == stream) {IA_CSS_LOG ("took out stream %d" , i); my_css_save.stream_seeds[i].stream =NULL ;break ;
@@ -9750,7 +9618,8 @@ ia_css_stream_destroy(struct ia_css_stream *stream) {int ia_css_stream_get_info (const struct ia_css_stream *stream, -struct ia_css_stream_info *stream_info) { +struct ia_css_stream_info *stream_info) +{ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_get_info: enter/exit\n" );assert (stream);assert (stream_info);
@@ -9766,15 +9635,15 @@ ia_css_stream_get_info(const struct ia_css_stream *stream,* The stream handle is used to identify the correct entry in the css_save struct */ int -ia_css_stream_load (struct ia_css_stream *stream) { +ia_css_stream_load (struct ia_css_stream *stream) +{if (!IS_ISP2401 ) {int i;int err;assert (stream);ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_load() enter,\n" ); -for (i =0 ; i <MAX_ACTIVE_STREAMS ; i++) - { +for (i =0 ; i <MAX_ACTIVE_STREAMS ; i++) {if (my_css_save.stream_seeds[i].stream == stream) {int j;
@@ -9813,12 +9682,12 @@ ia_css_stream_load(struct ia_css_stream *stream) { }int -ia_css_stream_start (struct ia_css_stream *stream) { +ia_css_stream_start (struct ia_css_stream *stream) +{int err =0 ;IA_CSS_ENTER ("stream = %p" , stream); -if ((!stream) || (!stream->last_pipe)) - { +if ((!stream) || (!stream->last_pipe)) {IA_CSS_LEAVE_ERR (-EINVAL );return -EINVAL ; }
@@ -9828,8 +9697,7 @@ ia_css_stream_start(struct ia_css_stream *stream) {/* Create host side pipeline. */ err =create_host_pipeline (stream); -if (err) - { +if (err) {IA_CSS_LEAVE_ERR (err);return err; }
@@ -9842,8 +9710,7 @@ ia_css_stream_start(struct ia_css_stream *stream) {#if !defined(ISP2401 )/* Initialize mipi size checks */ -if (stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR ) - { +if (stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR ) {unsigned int idx;unsigned int port = (unsigned int )(stream->config.source.port.port);
@@ -9854,8 +9721,7 @@ ia_css_stream_start(struct ia_css_stream *stream) { }#endif -if (stream->config.mode !=IA_CSS_INPUT_MODE_MEMORY ) - { +if (stream->config.mode !=IA_CSS_INPUT_MODE_MEMORY ) { err =sh_css_config_input_network (stream);if (err)return err;
@@ -9867,7 +9733,8 @@ ia_css_stream_start(struct ia_css_stream *stream) { }int -ia_css_stream_stop (struct ia_css_stream *stream) { +ia_css_stream_stop (struct ia_css_stream *stream) +{int err =0 ;ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_stop() enter/exit\n" );
@@ -9878,22 +9745,19 @@ ia_css_stream_stop(struct ia_css_stream *stream) {#if !defined(ISP2401 )/* De-initialize mipi size checks */ -if (stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR ) - { +if (stream->config.mode ==IA_CSS_INPUT_MODE_BUFFERED_SENSOR ) {unsigned int idx;unsigned int port = (unsigned int )(stream->config.source.port.port); -for (idx =0 ; idx <IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT ; idx++) { +for (idx =0 ; idx <IA_CSS_MIPI_SIZE_CHECK_MAX_NOF_ENTRIES_PER_PORT ; idx++) sh_css_sp_group.config.mipi_sizes_for_check[port][idx] =0 ; - } }#endif -if (!IS_ISP2401 ) { +if (!IS_ISP2401 ) err =ia_css_pipeline_request_stop (&stream->last_pipe->pipeline); - }else { +else err =sh_css_pipes_stop (stream); - }if (err)return err;
@@ -9906,16 +9770,16 @@ ia_css_stream_stop(struct ia_css_stream *stream) { }bool -ia_css_stream_has_stopped (struct ia_css_stream *stream) { +ia_css_stream_has_stopped (struct ia_css_stream *stream) +{bool stopped;assert (stream); -if (!IS_ISP2401 ) { +if (!IS_ISP2401 ) stopped =ia_css_pipeline_has_stopped (&stream->last_pipe->pipeline); - }else { +else stopped =sh_css_pipes_have_stopped (stream); - }return stopped; }
@@ -9926,7 +9790,8 @@ ia_css_stream_has_stopped(struct ia_css_stream *stream) {* The stream handle is used to identify the correct entry in the css_save struct */ int -ia_css_stream_unload (struct ia_css_stream *stream) { +ia_css_stream_unload (struct ia_css_stream *stream) +{int i;assert (stream);
@@ -9934,8 +9799,7 @@ ia_css_stream_unload(struct ia_css_stream *stream) {/* some checks */ assert (stream);for (i =0 ; i <MAX_ACTIVE_STREAMS ; i++) -if (my_css_save.stream_seeds[i].stream == stream) - { +if (my_css_save.stream_seeds[i].stream == stream) {int j; ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@@ -9955,7 +9819,8 @@ ia_css_stream_unload(struct ia_css_stream *stream) {int ia_css_temp_pipe_to_pipe_id (const struct ia_css_pipe *pipe, -enum ia_css_pipe_id *pipe_id) { +enum ia_css_pipe_id *pipe_id) +{ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_temp_pipe_to_pipe_id() enter/exit\n" );if (pipe) *pipe_id = pipe->mode;
@@ -9966,18 +9831,21 @@ ia_css_temp_pipe_to_pipe_id(const struct ia_css_pipe *pipe, }enum atomisp_input_format -ia_css_stream_get_format (const struct ia_css_stream *stream) { +ia_css_stream_get_format (const struct ia_css_stream *stream) +{return stream->config.input_config.format; }bool -ia_css_stream_get_two_pixels_per_clock (const struct ia_css_stream *stream) { +ia_css_stream_get_two_pixels_per_clock (const struct ia_css_stream *stream) +{return (stream->config.pixels_per_clock ==2 ); }struct ia_css_binary *ia_css_stream_get_shading_correction_binary (const struct ia_css_stream - *stream) { + *stream) +{struct ia_css_pipe *pipe;assert (stream);
@@ -9995,7 +9863,8 @@ ia_css_stream_get_shading_correction_binary(const struct ia_css_stream }struct ia_css_binary * -ia_css_stream_get_dvs_binary (const struct ia_css_stream *stream) { +ia_css_stream_get_dvs_binary (const struct ia_css_stream *stream) +{int i;struct ia_css_pipe *video_pipe =NULL ;
@@ -10014,7 +9883,8 @@ ia_css_stream_get_dvs_binary(const struct ia_css_stream *stream) { }struct ia_css_binary * -ia_css_stream_get_3a_binary (const struct ia_css_stream *stream) { +ia_css_stream_get_3a_binary (const struct ia_css_stream *stream) +{struct ia_css_pipe *pipe;struct ia_css_binary *s3a_binary =NULL ;
@@ -10036,7 +9906,8 @@ ia_css_stream_get_3a_binary(const struct ia_css_stream *stream) {int ia_css_stream_set_output_padded_width (struct ia_css_stream *stream, -unsigned int output_padded_width) { +unsigned int output_padded_width) +{struct ia_css_pipe *pipe;assert (stream);
@@ -10053,7 +9924,8 @@ ia_css_stream_set_output_padded_width(struct ia_css_stream *stream, }static struct ia_css_binary * -ia_css_pipe_get_shading_correction_binary (const struct ia_css_pipe *pipe) { +ia_css_pipe_get_shading_correction_binary (const struct ia_css_pipe *pipe) +{struct ia_css_binary *binary =NULL ;assert (pipe);
@@ -10098,7 +9970,8 @@ ia_css_pipe_get_shading_correction_binary(const struct ia_css_pipe *pipe) { }static struct ia_css_binary * -ia_css_pipe_get_s3a_binary (const struct ia_css_pipe *pipe) { +ia_css_pipe_get_s3a_binary (const struct ia_css_pipe *pipe) +{struct ia_css_binary *binary =NULL ;assert (pipe);
@@ -10121,9 +9994,9 @@ ia_css_pipe_get_s3a_binary(const struct ia_css_pipe *pipe) { } } }else if (pipe->config.default_capture_config.mode == -IA_CSS_CAPTURE_MODE_BAYER ) +IA_CSS_CAPTURE_MODE_BAYER ) { binary = (struct ia_css_binary *)&pipe->pipe_settings.capture.pre_isp_binary; -else if (pipe->config.default_capture_config.mode == + }else if (pipe->config.default_capture_config.mode ==IA_CSS_CAPTURE_MODE_ADVANCED || pipe->config.default_capture_config.mode ==IA_CSS_CAPTURE_MODE_LOW_LIGHT ) {if (pipe->config.isp_pipe_version ==IA_CSS_PIPE_VERSION_1 )
@@ -10145,7 +10018,8 @@ ia_css_pipe_get_s3a_binary(const struct ia_css_pipe *pipe) { }static struct ia_css_binary * -ia_css_pipe_get_sdis_binary (const struct ia_css_pipe *pipe) { +ia_css_pipe_get_sdis_binary (const struct ia_css_pipe *pipe) +{struct ia_css_binary *binary =NULL ;assert (pipe);
@@ -10165,14 +10039,16 @@ ia_css_pipe_get_sdis_binary(const struct ia_css_pipe *pipe) { }struct ia_css_pipeline * -ia_css_pipe_get_pipeline (const struct ia_css_pipe *pipe) { +ia_css_pipe_get_pipeline (const struct ia_css_pipe *pipe) +{assert (pipe);return (struct ia_css_pipeline *)&pipe->pipeline; }unsigned int -ia_css_pipe_get_pipe_num (const struct ia_css_pipe *pipe) { +ia_css_pipe_get_pipe_num (const struct ia_css_pipe *pipe) +{assert (pipe);/* KW was not sure this function was not returning a value
@@ -10189,7 +10065,8 @@ ia_css_pipe_get_pipe_num(const struct ia_css_pipe *pipe) { }unsigned int -ia_css_pipe_get_isp_pipe_version (const struct ia_css_pipe *pipe) { +ia_css_pipe_get_isp_pipe_version (const struct ia_css_pipe *pipe) +{assert (pipe);return (unsigned int )pipe->config.isp_pipe_version;
@@ -10198,7 +10075,8 @@ ia_css_pipe_get_isp_pipe_version(const struct ia_css_pipe *pipe) {#define SP_START_TIMEOUT_US 30000000int -ia_css_start_sp (void ) { +ia_css_start_sp (void ) +{unsigned long timeout;int err =0 ;
@@ -10207,13 +10085,11 @@ ia_css_start_sp(void) {/* waiting for the SP is completely started */ timeout =SP_START_TIMEOUT_US ; -while ((ia_css_spctrl_get_state (SP0_ID ) !=IA_CSS_SP_SW_INITIALIZED ) && timeout) - { +while ((ia_css_spctrl_get_state (SP0_ID ) !=IA_CSS_SP_SW_INITIALIZED ) && timeout) { timeout--;udelay (1 ); } -if (timeout ==0 ) - { +if (timeout ==0 ) {IA_CSS_ERROR ("timeout during SP initialization" );return -EINVAL ; }
@@ -10241,14 +10117,14 @@ ia_css_start_sp(void) {#define SP_SHUTDOWN_TIMEOUT_US 200000int -ia_css_stop_sp (void ) { +ia_css_stop_sp (void ) +{unsigned long timeout;int err =0 ;IA_CSS_ENTER ("void" ); -if (!sh_css_sp_is_running ()) - { +if (!sh_css_sp_is_running ()) { err = -EINVAL ;IA_CSS_LEAVE ("SP already stopped : return_err=%d" , err);
@@ -10260,8 +10136,7 @@ ia_css_stop_sp(void) {if (!IS_ISP2401 ) {sh_css_write_host2sp_command (host2sp_cmd_terminate); }else { -if (!sh_css_write_host2sp_command (host2sp_cmd_terminate)) - { +if (!sh_css_write_host2sp_command (host2sp_cmd_terminate)) {IA_CSS_ERROR ("Call to 'sh-css_write_host2sp_command()' failed" );ia_css_debug_dump_sp_sw_debug_info ();ia_css_debug_dump_debug_info (NULL );
@@ -10271,27 +10146,23 @@ ia_css_stop_sp(void) {sh_css_sp_set_sp_running (false); timeout =SP_SHUTDOWN_TIMEOUT_US ; -while (!ia_css_spctrl_is_idle (SP0_ID ) && timeout) - { +while (!ia_css_spctrl_is_idle (SP0_ID ) && timeout) { timeout--;udelay (1 ); }if ((ia_css_spctrl_get_state (SP0_ID ) !=IA_CSS_SP_SW_TERMINATED ))IA_CSS_WARNING ("SP has not terminated (SW)" ); -if (timeout ==0 ) - { +if (timeout ==0 ) {IA_CSS_WARNING ("SP is not idle" );ia_css_debug_dump_sp_sw_debug_info (); } timeout =SP_SHUTDOWN_TIMEOUT_US ; -while (!isp_ctrl_getbit (ISP0_ID ,ISP_SC_REG ,ISP_IDLE_BIT ) && timeout) - { +while (!isp_ctrl_getbit (ISP0_ID ,ISP_SC_REG ,ISP_IDLE_BIT ) && timeout) { timeout--;udelay (1 ); } -if (timeout ==0 ) - { +if (timeout ==0 ) {IA_CSS_WARNING ("ISP is not idle" );ia_css_debug_dump_sp_sw_debug_info (); }
@@ -10306,7 +10177,8 @@ ia_css_stop_sp(void) { }int -ia_css_update_continuous_frames (struct ia_css_stream *stream) { +ia_css_update_continuous_frames (struct ia_css_stream *stream) +{struct ia_css_pipe *pipe;unsigned int i;
@@ -10314,8 +10186,7 @@ ia_css_update_continuous_frames(struct ia_css_stream *stream) {IA_CSS_DEBUG_TRACE , "sh_css_update_continuous_frames() enter:\n"); -if (!stream) - { +if (!stream) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"sh_css_update_continuous_frames() leave: invalid stream, return_void\n" );
@@ -10326,10 +10197,9 @@ ia_css_update_continuous_frames(struct ia_css_stream *stream) {for (i = stream->config.init_num_cont_raw_buf; i < stream->config.target_num_cont_raw_buf; i++) - {sh_css_update_host2sp_offline_frame (i, pipe->continuous_frames[i], pipe->cont_md_buffers[i]); - } +sh_css_update_host2sp_cont_num_raw_frames (stream->config.target_num_cont_raw_buf, true); ia_css_debug_dtrace(
@@ -10455,7 +10325,8 @@ void ia_css_pipe_map_queue(struct ia_css_pipe *pipe, bool map)#if CONFIG_ON_FRAME_ENQUEUE ()static int set_config_on_frame_enqueue (struct ia_css_frame_info - *info,struct frame_data_wrapper *frame) { + *info,struct frame_data_wrapper *frame) +{ frame->config_on_frame_enqueue.padded_width =0 ;/* currently we support configuration on frame enqueue only on YUV formats */
@@ -10463,11 +10334,11 @@ static int set_config_on_frame_enqueue(struct ia_css_frame_infoswitch (info->format) {case IA_CSS_FRAME_FORMAT_YUV420 :case IA_CSS_FRAME_FORMAT_NV12 : -if (info->padded_width > info->res.width) { +if (info->padded_width > info->res.width) frame->config_on_frame_enqueue.padded_width = info->padded_width; - }else if ((info->padded_width < info->res.width) && (info->padded_width >0 )) { +else if ((info->padded_width < info->res.width) && (info->padded_width >0 ))return -EINVAL ; - } +/* nothing to do if width == padded width or padded width is zeroed (the same) */ break ;default :
@@ -10479,22 +10350,21 @@ static int set_config_on_frame_enqueue(struct ia_css_frame_info#endif int -ia_css_unlock_raw_frame (struct ia_css_stream *stream,uint32_t exp_id) { +ia_css_unlock_raw_frame (struct ia_css_stream *stream,uint32_t exp_id) +{int ret;IA_CSS_ENTER ("" );/* Only continuous streams have a tagger to which we can send the * unlock message. */ -if (!stream || !stream->config.continuous) - { +if (!stream || !stream->config.continuous) {IA_CSS_ERROR ("invalid stream pointer" );return -EINVAL ; }if (exp_id >IA_CSS_ISYS_MAX_EXPOSURE_ID || - exp_id <IA_CSS_ISYS_MIN_EXPOSURE_ID ) - { + exp_id <IA_CSS_ISYS_MIN_EXPOSURE_ID ) {IA_CSS_ERROR ("invalid exposure ID: %d\n" , exp_id);return -EINVAL ; }
@@ -10513,7 +10383,8 @@ ia_css_unlock_raw_frame(struct ia_css_stream *stream, uint32_t exp_id) {*/ int ia_css_pipe_set_qos_ext_state (struct ia_css_pipe *pipe,uint32_t fw_handle, -bool enable) { +bool enable) +{unsigned int thread_id;struct ia_css_pipeline_stage *stage;int err =0 ;
@@ -10521,20 +10392,16 @@ ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe, uint32_t fw_handle,IA_CSS_ENTER ("" );/* Parameter Check */ -if (!pipe || !pipe->stream) - { +if (!pipe || !pipe->stream) {IA_CSS_ERROR ("Invalid Pipe." ); err = -EINVAL ; - }else if (!(pipe->config.acc_extension)) - { + }else if (!(pipe->config.acc_extension)) {IA_CSS_ERROR ("Invalid Pipe(No Extension Firmware)" ); err = -EINVAL ; - }else if (!sh_css_sp_is_running ()) - { + }else if (!sh_css_sp_is_running ()) {IA_CSS_ERROR ("Leaving: queue unavailable." ); err = -EBUSY ; - }else - { + }else {/* Query the threadid and stage_num for the Extension firmware*/ ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (pipe), &thread_id); err =ia_css_pipeline_get_stage_from_fw (&pipe->pipeline, fw_handle, &stage);
@@ -10562,7 +10429,8 @@ ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe, uint32_t fw_handle,*/ int ia_css_pipe_get_qos_ext_state (struct ia_css_pipe *pipe,uint32_t fw_handle, -bool *enable) { +bool *enable) +{struct ia_css_pipeline_stage *stage;unsigned int thread_id;int err =0 ;
@@ -10570,20 +10438,16 @@ ia_css_pipe_get_qos_ext_state(struct ia_css_pipe *pipe, uint32_t fw_handle,IA_CSS_ENTER ("" );/* Parameter Check */ -if (!pipe || !pipe->stream) - { +if (!pipe || !pipe->stream) {IA_CSS_ERROR ("Invalid Pipe." ); err = -EINVAL ; - }else if (!(pipe->config.acc_extension)) - { + }else if (!(pipe->config.acc_extension)) {IA_CSS_ERROR ("Invalid Pipe (No Extension Firmware)." ); err = -EINVAL ; - }else if (!sh_css_sp_is_running ()) - { + }else if (!sh_css_sp_is_running ()) {IA_CSS_ERROR ("Leaving: queue unavailable." ); err = -EBUSY ; - }else - { + }else {/* Query the threadid and stage_num corresponding to the Extension firmware*/ ia_css_pipeline_get_sp_thread_id (ia_css_pipe_get_pipe_num (pipe), &thread_id); err =ia_css_pipeline_get_stage_from_fw (&pipe->pipeline, fw_handle, &stage);
@@ -10603,7 +10467,8 @@ int ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, u32 fw_handle, struct ia_css_isp_param_css_segments *css_seg, - struct ia_css_isp_param_isp_segments *isp_seg) { + struct ia_css_isp_param_isp_segments *isp_seg) +{
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Signature · 1 line
2.53.0
Part of the diff is not shown here. View the raw message.
Sasha Levin
maintainerPATCH 4/6 media: staging: media: atomisp: Replace if else clause with a ternary
In reply to Sasha LevinFrom: Martiros Shakhzadyan <[email protected]>
[ Upstream commit d4bc34d18201120b247506b4a6ed17af694dfcf7 ]
Use the ternary operator for conditional variable assignment in create_host_video_pipeline().
Stable-dep-of: f4d51e55dd47 ("staging: media: atomisp: reduce load_primary_binaries() stack usage")
--- drivers/staging/media/atomisp/pci/sh_css.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +2 -5
@@ -3623,11 +3623,8 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe)struct ia_css_frame *tmp_out_frame =NULL ;for (i =0 ; i < num_yuv_scaler; i++) { -if (is_output_stage[i]) { - tmp_out_frame = out_frame; - }else { - tmp_out_frame =NULL ; - } + tmp_out_frame = is_output_stage[i] ? out_frame :NULL ; + err = add_yuv_scaler_stage(pipe, me, tmp_in_frame, tmp_out_frame, NULL, &yuv_scaler_binary[i],
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 5/6 media: staging: media: atomisp: Fix alignment and line length issues
In reply to Sasha LevinFrom: Martiros Shakhzadyan <[email protected]>
[ Upstream commit 7796e455170efa1823457b17a292b1c65bb8c1e0 ]
Fix alignment style issues and adjacent line length issues in sh_css.c
Stable-dep-of: f4d51e55dd47 ("staging: media: atomisp: reduce load_primary_binaries() stack usage")
--- drivers/staging/media/atomisp/pci/sh_css.c | 619 +++++++++++---------- 1 file changed, 333 insertions(+), 286 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +333 -286
@@ -242,8 +242,8 @@ ia_css_reset_defaults(struct sh_css *css);static void sh_css_init_host_sp_control_vars (void ); -static int set_num_primary_stages (unsigned int *num, -enum ia_css_pipe_version version); +static int +set_num_primary_stages (unsigned int *num,enum ia_css_pipe_version version);static bool need_capture_pp (const struct ia_css_pipe *pipe);
@@ -3002,9 +3002,8 @@ static int add_firmwares(ia_css_pipe_get_firmwares_stage_desc (&stage_desc, binary, out, in, vf, fw, binary_mode); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - &extra_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + &extra_stage);if (err)return err;if (fw->info.isp.sp.enable.output !=0 )
@@ -3112,9 +3111,8 @@ static int add_yuv_scaler_stage(ia_css_pipe_get_generic_stage_desc (&stage_desc, yuv_scaler_binary, out_frames, in_frame, vf_frame); } - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - pre_vf_pp_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + pre_vf_pp_stage);if (err)return err; in_frame = (*pre_vf_pp_stage)->args.out_frame[0 ];
@@ -3172,9 +3170,8 @@ static int add_capture_pp_stage(ia_css_pipe_get_generic_stage_desc (&stage_desc, capture_pp_binary, out_frames,NULL , vf_frame); } - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - capture_pp_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + capture_pp_stage);if (err)return err; err = add_firmwares(me, capture_pp_binary, pipe->output_stage, last_fw,
@@ -3529,9 +3526,8 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe)ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, out_frames,NULL ,NULL ); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - ©_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + ©_stage);if (err) goto ERR; in_frame = me->stages->args.out_frame[0 ];
@@ -3558,9 +3554,8 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe)ia_css_pipe_get_generic_stage_desc (&stage_desc, video_binary, out_frames, in_frame, vf_frame); } - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - &video_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + &video_stage);if (err) goto ERR;
@@ -3625,8 +3620,8 @@ static int create_host_video_pipeline(struct ia_css_pipe *pipe)for (i =0 ; i < num_yuv_scaler; i++) { tmp_out_frame = is_output_stage[i] ? out_frame :NULL ; - err =add_yuv_scaler_stage (pipe, me, tmp_in_frame, tmp_out_frame, -NULL , + err =add_yuv_scaler_stage (pipe, me, tmp_in_frame, + tmp_out_frame,NULL , &yuv_scaler_binary[i], &yuv_scaler_stage);
@@ -3765,9 +3760,8 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe)ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, out_frames,NULL ,NULL ); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - ©_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + ©_stage);if (err) goto ERR; in_frame = me->stages->args.out_frame[0 ];
@@ -3793,9 +3787,8 @@ create_host_preview_pipeline(struct ia_css_pipe *pipe)ia_css_pipe_get_generic_stage_desc (&stage_desc, preview_binary, out_frames, in_frame,NULL ); } - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - &preview_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + &preview_stage);if (err) goto ERR;/* If we use copy iso preview, the input must be yuv iso raw */
@@ -4131,8 +4124,8 @@ ia_css_pipe_enqueue_buffer(struct ia_css_pipe *pipe, }hmm_store (h_vbuf->vptr, - (void *)(&ddr_buffer), -sizeof (struct sh_css_hmm_buffer )); + (void *)(&ddr_buffer), +sizeof (struct sh_css_hmm_buffer ));if ((buf_type ==IA_CSS_BUFFER_TYPE_3A_STATISTICS ) || (buf_type ==IA_CSS_BUFFER_TYPE_DIS_STATISTICS ) || (buf_type ==IA_CSS_BUFFER_TYPE_LACE_STATISTICS )) {
@@ -4293,8 +4286,8 @@ ia_css_pipe_dequeue_buffer(struct ia_css_pipe *pipe, }hmm_load (ddr_buffer_addr, - &ddr_buffer, -sizeof (struct sh_css_hmm_buffer )); + &ddr_buffer, +sizeof (struct sh_css_hmm_buffer ));/* if the kernel_ptr is 0 or an invalid, return an error. * do not access the buffer via the kernal_ptr.
@@ -4949,7 +4942,7 @@ sh_css_pipes_stop(struct ia_css_stream *stream)for (i =0 ; i < stream->num_pipes; i++) {/* send the "stop" request to the "ia_css_pipe" instance */ IA_CSS_LOG ("Send the stop-request to the pipe: pipe_id=%d" , - stream->pipes[i]->pipeline.pipe_id); + stream->pipes[i]->pipeline.pipe_id); err =ia_css_pipeline_request_stop (&stream->pipes[i]->pipeline);/*
@@ -4999,7 +4992,7 @@ sh_css_pipes_stop(struct ia_css_stream *stream)/* send the "stop" request to "Copy Pipe" */ IA_CSS_LOG ("Send the stop-request to the pipe: pipe_id=%d" , - copy_pipe->pipeline.pipe_id); + copy_pipe->pipeline.pipe_id); err =ia_css_pipeline_request_stop (©_pipe->pipeline); }
@@ -5832,7 +5825,7 @@ static bool need_capt_ldc( }static int set_num_primary_stages (unsigned int *num, -enum ia_css_pipe_version version) +enum ia_css_pipe_version version) {int err =0 ;
@@ -6032,10 +6025,13 @@ static int load_primary_binaries( capt_pp_in_info = &prim_out_info;ia_css_pipe_get_capturepp_binarydesc (pipe, - &capture_pp_descr, capt_pp_in_info, - &capt_pp_out_info, &vf_info); + &capture_pp_descr, + capt_pp_in_info, + &capt_pp_out_info, + &vf_info); + err =ia_css_binary_find (&capture_pp_descr, - &mycs->capture_pp_binary); + &mycs->capture_pp_binary);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -6045,11 +6041,12 @@ static int load_primary_binaries(struct ia_css_binary_descr capt_ldc_descr;ia_css_pipe_get_ldc_binarydesc (pipe, - &capt_ldc_descr, &prim_out_info, - &capt_ldc_out_info); + &capt_ldc_descr, + &prim_out_info, + &capt_ldc_out_info); err =ia_css_binary_find (&capt_ldc_descr, - &mycs->capture_ldc_binary); + &mycs->capture_ldc_binary);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -6066,8 +6063,9 @@ static int load_primary_binaries(if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0 ] && (i == mycs->num_primary_stage -1 )) local_vf_info = &vf_info; -ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr[i], &prim_in_info, - &prim_out_info, local_vf_info, i); +ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr[i], + &prim_in_info, &prim_out_info, + local_vf_info, i); err =ia_css_binary_find (&prim_descr[i], &mycs->primary_binary[i]);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -6119,8 +6117,8 @@ static int load_primary_binaries(/* ISP Copy */ if (need_isp_copy_binary) { err =load_copy_binary (pipe, - &mycs->copy_binary, - &mycs->primary_binary[0 ]); + &mycs->copy_binary, + &mycs->primary_binary[0 ]);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -6229,7 +6227,7 @@ static int load_advanced_binaries(assert (pipe);assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE || - pipe->mode ==IA_CSS_PIPE_ID_COPY ); + pipe->mode ==IA_CSS_PIPE_ID_COPY );if (pipe->pipe_settings.capture.pre_isp_binary.info)return 0 ; pipe_out_info = &pipe->output_info[0 ];
@@ -6242,17 +6240,18 @@ static int load_advanced_binaries( need_pp =need_capture_pp (pipe);ia_css_frame_info_set_format (&vf_info, -IA_CSS_FRAME_FORMAT_YUV_LINE ); +IA_CSS_FRAME_FORMAT_YUV_LINE );/* we build up the pipeline starting at the end */ /* Capture post-processing */ if (need_pp) {struct ia_css_binary_descr capture_pp_descr; -ia_css_pipe_get_capturepp_binarydesc (pipe, - &capture_pp_descr, &post_out_info, pipe_out_info, &vf_info); +ia_css_pipe_get_capturepp_binarydesc (pipe, &capture_pp_descr, + &post_out_info, + pipe_out_info, &vf_info); err =ia_css_binary_find (&capture_pp_descr, - &pipe->pipe_settings.capture.capture_pp_binary); + &pipe->pipe_settings.capture.capture_pp_binary);if (err)return err; }else {
@@ -6263,10 +6262,11 @@ static int load_advanced_binaries( {struct ia_css_binary_descr post_gdc_descr; -ia_css_pipe_get_post_gdc_binarydesc (pipe, - &post_gdc_descr, &post_in_info, &post_out_info, &vf_info); +ia_css_pipe_get_post_gdc_binarydesc (pipe, &post_gdc_descr, + &post_in_info, + &post_out_info, &vf_info); err =ia_css_binary_find (&post_gdc_descr, - &pipe->pipe_settings.capture.post_isp_binary); + &pipe->pipe_settings.capture.post_isp_binary);if (err)return err; }
@@ -6276,9 +6276,9 @@ static int load_advanced_binaries(struct ia_css_binary_descr gdc_descr;ia_css_pipe_get_gdc_binarydesc (pipe, &gdc_descr, &gdc_in_info, - &pipe->pipe_settings.capture.post_isp_binary.in_frame_info); + &pipe->pipe_settings.capture.post_isp_binary.in_frame_info); err =ia_css_binary_find (&gdc_descr, - &pipe->pipe_settings.capture.anr_gdc_binary); + &pipe->pipe_settings.capture.anr_gdc_binary);if (err)return err; }
@@ -6290,9 +6290,9 @@ static int load_advanced_binaries(struct ia_css_binary_descr pre_gdc_descr;ia_css_pipe_get_pre_gdc_binarydesc (pipe, &pre_gdc_descr, &pre_in_info, - &pipe->pipe_settings.capture.anr_gdc_binary.in_frame_info); + &pipe->pipe_settings.capture.anr_gdc_binary.in_frame_info); err =ia_css_binary_find (&pre_gdc_descr, - &pipe->pipe_settings.capture.pre_isp_binary); + &pipe->pipe_settings.capture.pre_isp_binary);if (err)return err; }
@@ -6314,7 +6314,7 @@ static int load_advanced_binaries(ia_css_pipe_get_vfpp_binarydesc (pipe, &vf_pp_descr, vf_pp_in_info, pipe_vf_out_info); err =ia_css_binary_find (&vf_pp_descr, - &pipe->pipe_settings.capture.vf_pp_binary); + &pipe->pipe_settings.capture.vf_pp_binary);if (err)return err; }
@@ -6326,8 +6326,8 @@ static int load_advanced_binaries(#endif if (need_isp_copy)load_copy_binary (pipe, - &pipe->pipe_settings.capture.copy_binary, - &pipe->pipe_settings.capture.pre_isp_binary); + &pipe->pipe_settings.capture.copy_binary, + &pipe->pipe_settings.capture.pre_isp_binary);return err; }
@@ -6342,7 +6342,7 @@ static int load_bayer_isp_binaries(IA_CSS_ENTER_PRIVATE ("" );assert (pipe);assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE || - pipe->mode ==IA_CSS_PIPE_ID_COPY ); + pipe->mode ==IA_CSS_PIPE_ID_COPY ); pipe_out_info = &pipe->output_info[0 ];if (pipe->pipe_settings.capture.pre_isp_binary.info)
@@ -6353,11 +6353,11 @@ static int load_bayer_isp_binaries(return err;ia_css_pipe_get_pre_de_binarydesc (pipe, &pre_de_descr, - &pre_isp_in_info, - pipe_out_info); + &pre_isp_in_info, + pipe_out_info); err =ia_css_binary_find (&pre_de_descr, - &pipe->pipe_settings.capture.pre_isp_binary); + &pipe->pipe_settings.capture.pre_isp_binary);return err; }
@@ -6376,7 +6376,7 @@ static int load_low_light_binaries(IA_CSS_ENTER_PRIVATE ("" );assert (pipe);assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE || - pipe->mode ==IA_CSS_PIPE_ID_COPY ); + pipe->mode ==IA_CSS_PIPE_ID_COPY );if (pipe->pipe_settings.capture.pre_isp_binary.info)return 0 ;
@@ -6391,17 +6391,18 @@ static int load_low_light_binaries( need_pp =need_capture_pp (pipe);ia_css_frame_info_set_format (&vf_info, -IA_CSS_FRAME_FORMAT_YUV_LINE ); +IA_CSS_FRAME_FORMAT_YUV_LINE );/* we build up the pipeline starting at the end */ /* Capture post-processing */ if (need_pp) {struct ia_css_binary_descr capture_pp_descr; -ia_css_pipe_get_capturepp_binarydesc (pipe, - &capture_pp_descr, &post_out_info, pipe_out_info, &vf_info); +ia_css_pipe_get_capturepp_binarydesc (pipe, &capture_pp_descr, + &post_out_info, + pipe_out_info, &vf_info); err =ia_css_binary_find (&capture_pp_descr, - &pipe->pipe_settings.capture.capture_pp_binary); + &pipe->pipe_settings.capture.capture_pp_binary);if (err)return err; }else {
@@ -6415,7 +6416,7 @@ static int load_low_light_binaries(ia_css_pipe_get_post_anr_binarydesc (pipe, &post_anr_descr, &post_in_info, &post_out_info, &vf_info); err =ia_css_binary_find (&post_anr_descr, - &pipe->pipe_settings.capture.post_isp_binary); + &pipe->pipe_settings.capture.post_isp_binary);if (err)return err; }
@@ -6425,9 +6426,9 @@ static int load_low_light_binaries(struct ia_css_binary_descr anr_descr;ia_css_pipe_get_anr_binarydesc (pipe, &anr_descr, &anr_in_info, - &pipe->pipe_settings.capture.post_isp_binary.in_frame_info); + &pipe->pipe_settings.capture.post_isp_binary.in_frame_info); err =ia_css_binary_find (&anr_descr, - &pipe->pipe_settings.capture.anr_gdc_binary); + &pipe->pipe_settings.capture.anr_gdc_binary);if (err)return err; }
@@ -6439,9 +6440,9 @@ static int load_low_light_binaries(struct ia_css_binary_descr pre_anr_descr;ia_css_pipe_get_pre_anr_binarydesc (pipe, &pre_anr_descr, &pre_in_info, - &pipe->pipe_settings.capture.anr_gdc_binary.in_frame_info); + &pipe->pipe_settings.capture.anr_gdc_binary.in_frame_info); err =ia_css_binary_find (&pre_anr_descr, - &pipe->pipe_settings.capture.pre_isp_binary); + &pipe->pipe_settings.capture.pre_isp_binary);if (err)return err; }
@@ -6460,10 +6461,10 @@ static int load_low_light_binaries( {struct ia_css_binary_descr vf_pp_descr; -ia_css_pipe_get_vfpp_binarydesc (pipe, - &vf_pp_descr, vf_pp_in_info, pipe_vf_out_info); +ia_css_pipe_get_vfpp_binarydesc (pipe, &vf_pp_descr, + vf_pp_in_info, pipe_vf_out_info); err =ia_css_binary_find (&vf_pp_descr, - &pipe->pipe_settings.capture.vf_pp_binary); + &pipe->pipe_settings.capture.vf_pp_binary);if (err)return err; }
@@ -6475,8 +6476,8 @@ static int load_low_light_binaries(#endif if (need_isp_copy) err =load_copy_binary (pipe, - &pipe->pipe_settings.capture.copy_binary, - &pipe->pipe_settings.capture.pre_isp_binary); + &pipe->pipe_settings.capture.copy_binary, + &pipe->pipe_settings.capture.pre_isp_binary);return err; }
@@ -6510,7 +6511,7 @@ static int load_capture_binaries(IA_CSS_ENTER_PRIVATE ("" );assert (pipe);assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE || - pipe->mode ==IA_CSS_PIPE_ID_COPY ); + pipe->mode ==IA_CSS_PIPE_ID_COPY );if (pipe->pipe_settings.capture.primary_binary[0 ].info) {IA_CSS_LEAVE_ERR_PRIVATE (0 );
@@ -6605,7 +6606,7 @@ unload_capture_binaries(struct ia_css_pipe *pipe)static bool need_downscaling (const struct ia_css_resolution in_res, -const struct ia_css_resolution out_res) +const struct ia_css_resolution out_res) {if (in_res.width > out_res.width || in_res.height > out_res.height)return true;
@@ -6676,9 +6677,9 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output( descr->num_output_stage =1 ; hor_ds_factor =CEIL_DIV (cas_scaler_in_info->res.width, - cas_scaler_out_info->res.width); + cas_scaler_out_info->res.width); ver_ds_factor =CEIL_DIV (cas_scaler_in_info->res.height, - cas_scaler_out_info->res.height); + cas_scaler_out_info->res.height);/* use the same horizontal and vertical downscaling factor for simplicity */ assert (hor_ds_factor == ver_ds_factor);
@@ -6688,31 +6689,36 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output( i *= max_scale_factor_per_stage; } - descr->in_info =kmalloc (descr->num_stage *sizeof (struct ia_css_frame_info ), -GFP_KERNEL ); + descr->in_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->in_info) { err = -ENOMEM ; goto ERR; } - descr->internal_out_info =kmalloc (descr->num_stage *sizeof ( -struct ia_css_frame_info ),GFP_KERNEL ); + descr->internal_out_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->internal_out_info) { err = -ENOMEM ; goto ERR; } - descr->out_info =kmalloc (descr->num_stage *sizeof (struct ia_css_frame_info ), -GFP_KERNEL ); + descr->out_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->out_info) { err = -ENOMEM ; goto ERR; } - descr->vf_info =kmalloc (descr->num_stage *sizeof (struct ia_css_frame_info ), -GFP_KERNEL ); + descr->vf_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->vf_info) { err = -ENOMEM ; goto ERR; } - descr->is_output_stage =kmalloc (descr->num_stage *sizeof (bool ),GFP_KERNEL ); + descr->is_output_stage =kmalloc (descr->num_stage *sizeof (bool ), +GFP_KERNEL );if (!descr->is_output_stage) { err = -ENOMEM ; goto ERR;
@@ -6756,9 +6762,9 @@ static int ia_css_pipe_create_cas_scaler_desc_single_output( max_scale_factor_per_stage; descr->internal_out_info[i].format =IA_CSS_FRAME_FORMAT_YUV420 ;ia_css_frame_info_init (&descr->internal_out_info[i], - tmp_in_info.res.width / max_scale_factor_per_stage, - tmp_in_info.res.height / max_scale_factor_per_stage, -IA_CSS_FRAME_FORMAT_YUV420 ,0 ); + tmp_in_info.res.width / max_scale_factor_per_stage, + tmp_in_info.res.height / max_scale_factor_per_stage, +IA_CSS_FRAME_FORMAT_YUV420 ,0 ); descr->out_info[i].res.width =0 ; descr->out_info[i].res.height =0 ; descr->vf_info[i].res.width =0 ;
@@ -6834,30 +6840,35 @@ static int ia_css_pipe_create_cas_scaler_desc( descr->num_stage = num_stages; descr->in_info =kmalloc_array (descr->num_stage, -sizeof (struct ia_css_frame_info ),GFP_KERNEL ); +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->in_info) { err = -ENOMEM ; goto ERR; } - descr->internal_out_info =kmalloc (descr->num_stage *sizeof ( -struct ia_css_frame_info ),GFP_KERNEL ); + descr->internal_out_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->internal_out_info) { err = -ENOMEM ; goto ERR; } - descr->out_info =kmalloc (descr->num_stage *sizeof (struct ia_css_frame_info ), -GFP_KERNEL ); + descr->out_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->out_info) { err = -ENOMEM ; goto ERR; } - descr->vf_info =kmalloc (descr->num_stage *sizeof (struct ia_css_frame_info ), -GFP_KERNEL ); + descr->vf_info =kmalloc (descr->num_stage * +sizeof (struct ia_css_frame_info ), +GFP_KERNEL );if (!descr->vf_info) { err = -ENOMEM ; goto ERR; } - descr->is_output_stage =kmalloc (descr->num_stage *sizeof (bool ),GFP_KERNEL ); + descr->is_output_stage =kmalloc (descr->num_stage *sizeof (bool ), +GFP_KERNEL );if (!descr->is_output_stage) { err = -ENOMEM ; goto ERR;
@@ -6867,7 +6878,7 @@ static int ia_css_pipe_create_cas_scaler_desc(if (out_info[i]) {if (i >0 ) {assert ((out_info[i -1 ]->res.width >= out_info[i]->res.width) && - (out_info[i -1 ]->res.height >= out_info[i]->res.height)); + (out_info[i -1 ]->res.height >= out_info[i]->res.height)); } } }
@@ -6915,9 +6926,9 @@ static int ia_css_pipe_create_cas_scaler_desc( max_scale_factor_per_stage; descr->internal_out_info[i].format =IA_CSS_FRAME_FORMAT_YUV420 ;ia_css_frame_info_init (&descr->internal_out_info[i], - tmp_in_info.res.width / max_scale_factor_per_stage, - tmp_in_info.res.height / max_scale_factor_per_stage, -IA_CSS_FRAME_FORMAT_YUV420 ,0 ); + tmp_in_info.res.width / max_scale_factor_per_stage, + tmp_in_info.res.height / max_scale_factor_per_stage, +IA_CSS_FRAME_FORMAT_YUV420 ,0 ); descr->out_info[i].res.width =0 ; descr->out_info[i].res.height =0 ; descr->vf_info[i].res.width =0 ;
@@ -6996,13 +7007,14 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe)struct ia_css_binary_descr yuv_scaler_descr; err =ia_css_pipe_create_cas_scaler_desc (pipe, - &cas_scaler_descr); + &cas_scaler_descr);if (err) goto ERR; mycs->num_output = cas_scaler_descr.num_output_stage; mycs->num_yuv_scaler = cas_scaler_descr.num_stage; mycs->yuv_scaler_binary =kzalloc (cas_scaler_descr.num_stage * -sizeof (struct ia_css_binary ),GFP_KERNEL ); +sizeof (struct ia_css_binary ), +GFP_KERNEL );if (!mycs->yuv_scaler_binary) { err = -ENOMEM ; goto ERR;
@@ -7016,12 +7028,13 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe)for (i =0 ; i < cas_scaler_descr.num_stage; i++) { mycs->is_output_stage[i] = cas_scaler_descr.is_output_stage[i];ia_css_pipe_get_yuvscaler_binarydesc (pipe, - &yuv_scaler_descr, &cas_scaler_descr.in_info[i], - &cas_scaler_descr.out_info[i], - &cas_scaler_descr.internal_out_info[i], - &cas_scaler_descr.vf_info[i]); + &yuv_scaler_descr, + &cas_scaler_descr.in_info[i], + &cas_scaler_descr.out_info[i], + &cas_scaler_descr.internal_out_info[i], + &cas_scaler_descr.vf_info[i]); err =ia_css_binary_find (&yuv_scaler_descr, - &mycs->yuv_scaler_binary[i]); + &mycs->yuv_scaler_binary[i]);if (err) goto ERR; }
@@ -7061,8 +7074,8 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe)if (need_isp_copy_binary) { err =load_copy_binary (pipe, - &mycs->copy_binary, - next_binary); + &mycs->copy_binary, + next_binary);if (err) goto ERR;
@@ -7107,8 +7120,9 @@ load_yuvpp_binaries(struct ia_css_pipe *pipe) mycs->num_vf_pp =1 ; } - mycs->vf_pp_binary =kzalloc (mycs->num_vf_pp *sizeof (struct ia_css_binary ), -GFP_KERNEL ); + mycs->vf_pp_binary =kzalloc (mycs->num_vf_pp * +sizeof (struct ia_css_binary ), +GFP_KERNEL );if (!mycs->vf_pp_binary) { err = -ENOMEM ; goto ERR;
@@ -7437,18 +7451,26 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe)#endif if (need_scaler) { -ia_css_pipe_util_set_output_frames (bin_out_frame,0 ,NULL ); -ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, - bin_out_frame, in_frame_local,NULL ); +ia_css_pipe_util_set_output_frames (bin_out_frame, +0 ,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + copy_binary, + bin_out_frame, + in_frame_local, +NULL ); }else { -ia_css_pipe_util_set_output_frames (bin_out_frame,0 , out_frame[0 ]); -ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, - bin_out_frame, in_frame_local,NULL ); +ia_css_pipe_util_set_output_frames (bin_out_frame, +0 , out_frame[0 ]); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + copy_binary, + bin_out_frame, + in_frame_local, +NULL ); } err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - ©_stage); + &stage_desc, + ©_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -7480,10 +7502,11 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) tmp_vf_frame =NULL ; } - err =add_yuv_scaler_stage (pipe, me, tmp_in_frame, tmp_out_frame, -NULL , - &yuv_scaler_binary[i], - &yuv_scaler_stage); + err =add_yuv_scaler_stage (pipe, me, tmp_in_frame, + tmp_out_frame, +NULL , + &yuv_scaler_binary[i], + &yuv_scaler_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -7494,8 +7517,10 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe)if (pipe->pipe_settings.yuvpp.is_output_stage[i]) {if (tmp_vf_frame && (tmp_vf_frame->info.res.width !=0 )) { in_frame = yuv_scaler_stage->args.out_vf_frame; - err =add_vf_pp_stage (pipe, in_frame, tmp_vf_frame, &vf_pp_binary[j], - &vf_pp_stage); + err =add_vf_pp_stage (pipe, in_frame, + tmp_vf_frame, + &vf_pp_binary[j], + &vf_pp_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -7508,8 +7533,8 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) }else if (copy_stage) {if (vf_frame[0 ] && vf_frame[0 ]->info.res.width !=0 ) { in_frame = copy_stage->args.out_vf_frame; - err =add_vf_pp_stage (pipe, in_frame, vf_frame[0 ], &vf_pp_binary[0 ], - &vf_pp_stage); + err =add_vf_pp_stage (pipe, in_frame, vf_frame[0 ], + &vf_pp_binary[0 ], &vf_pp_stage); }if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);
@@ -7517,7 +7542,8 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe) } } -ia_css_pipeline_finalize_stages (&pipe->pipeline, pipe->stream->config.continuous); +ia_css_pipeline_finalize_stages (&pipe->pipeline, + pipe->stream->config.continuous);IA_CSS_LEAVE_ERR_PRIVATE (0 );
@@ -7526,8 +7552,8 @@ create_host_yuvpp_pipeline(struct ia_css_pipe *pipe)static int create_host_copy_pipeline (struct ia_css_pipe *pipe, -unsigned int max_input_width, -struct ia_css_frame *out_frame) +unsigned int max_input_width, +struct ia_css_frame *out_frame) {struct ia_css_pipeline *me;int err =0 ;
@@ -7546,12 +7572,8 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe,if (copy_on_sp (pipe) && pipe->stream->config.input_config.format ==ATOMISP_INPUT_FORMAT_BINARY_8 ) { -ia_css_frame_info_init ( - &out_frame->info, -JPEG_BYTES , -1 , -IA_CSS_FRAME_FORMAT_BINARY_8 , -0 ); +ia_css_frame_info_init (&out_frame->info,JPEG_BYTES ,1 , +IA_CSS_FRAME_FORMAT_BINARY_8 ,0 ); }else if (out_frame->info.format ==IA_CSS_FRAME_FORMAT_RAW ) { out_frame->info.raw_bit_depth =ia_css_pipe_util_pipe_input_format_bpp (pipe);
@@ -7562,12 +7584,12 @@ create_host_copy_pipeline(struct ia_css_pipe *pipe, pipe->mode =IA_CSS_PIPE_ID_COPY ;ia_css_pipe_get_sp_func_stage_desc (&stage_desc, out_frame, -IA_CSS_PIPELINE_RAW_COPY , max_input_width); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, -NULL ); +IA_CSS_PIPELINE_RAW_COPY , + max_input_width); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc,NULL ); -ia_css_pipeline_finalize_stages (&pipe->pipeline, pipe->stream->config.continuous); +ia_css_pipeline_finalize_stages (&pipe->pipeline, + pipe->stream->config.continuous);ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE_PRIVATE ,"create_host_copy_pipeline() leave:\n" );
@@ -7606,9 +7628,10 @@ create_host_isyscopy_capture_pipeline(struct ia_css_pipe *pipe) me->pipe_id =IA_CSS_PIPE_ID_CAPTURE ; pipe->mode =IA_CSS_PIPE_ID_CAPTURE ;ia_css_pipe_get_sp_func_stage_desc (&stage_desc, out_frame, -IA_CSS_PIPELINE_ISYS_COPY , max_input_width); +IA_CSS_PIPELINE_ISYS_COPY , + max_input_width); err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, &out_stage); + &stage_desc, &out_stage);if (err)return err;
@@ -7660,7 +7683,8 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)IA_CSS_ENTER_PRIVATE ("" );assert (pipe);assert (pipe->stream); -assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE || pipe->mode ==IA_CSS_PIPE_ID_COPY ); +assert (pipe->mode ==IA_CSS_PIPE_ID_CAPTURE || + pipe->mode ==IA_CSS_PIPE_ID_COPY ); me = &pipe->pipeline; mode = pipe->config.default_capture_config.mode;
@@ -7750,26 +7774,37 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame);#if defined(ISP2401 )if (!continuous) { -ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, - out_frames, in_frame,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + copy_binary, + out_frames, + in_frame, +NULL ); }else { in_frame = pipe->stream->last_pipe->continuous_frames[0 ]; -ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, - out_frames, in_frame,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + copy_binary, + out_frames, + in_frame, +NULL ); }#else -ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, - out_frames,NULL ,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + copy_binary, + out_frames, +NULL ,NULL );#endif }else { -ia_css_pipe_util_set_output_frames (out_frames,0 , in_frame); -ia_css_pipe_get_generic_stage_desc (&stage_desc, copy_binary, - out_frames,NULL ,NULL ); +ia_css_pipe_util_set_output_frames (out_frames,0 , + in_frame); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + copy_binary, + out_frames, +NULL ,NULL ); } err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - ¤t_stage); + &stage_desc, + ¤t_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7806,11 +7841,14 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)* Proper investigation should be done to come up with the clean * solution. * */ -ia_css_pipe_get_generic_stage_desc (&stage_desc, primary_binary[i], - out_frames, local_in_frame,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + primary_binary[i], + out_frames, + local_in_frame, +NULL ); err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - ¤t_stage); + &stage_desc, + ¤t_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7826,18 +7864,18 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) mode == IA_CSS_CAPTURE_MODE_LOW_LIGHT) {ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, pre_isp_binary, - out_frames, in_frame,NULL ); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc,NULL ); + out_frames, in_frame,NULL ); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, +NULL );if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err; }ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL );ia_css_pipe_get_generic_stage_desc (&stage_desc, anr_gdc_binary, - out_frames,NULL ,NULL ); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc,NULL ); + out_frames,NULL ,NULL ); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, +NULL );if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7845,16 +7883,21 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)if (need_pp) {ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL ); -ia_css_pipe_get_generic_stage_desc (&stage_desc, post_isp_binary, - out_frames,NULL ,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + post_isp_binary, + out_frames, +NULL ,NULL ); }else { -ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame); -ia_css_pipe_get_generic_stage_desc (&stage_desc, post_isp_binary, - out_frames,NULL ,NULL ); +ia_css_pipe_util_set_output_frames (out_frames,0 , + out_frame); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + post_isp_binary, + out_frames, +NULL ,NULL ); } - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, ¤t_stage); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, + ¤t_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7862,10 +7905,9 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe) }else if (mode ==IA_CSS_CAPTURE_MODE_BAYER ) {ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame);ia_css_pipe_get_generic_stage_desc (&stage_desc, pre_isp_binary, - out_frames, in_frame,NULL ); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, -NULL ); + out_frames, in_frame,NULL ); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, +NULL );if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7880,31 +7922,34 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)if (need_ldc) {ia_css_pipe_util_set_output_frames (out_frames,0 ,NULL ); -ia_css_pipe_get_generic_stage_desc (&stage_desc, capture_ldc_binary, - out_frames, local_in_frame,NULL ); +ia_css_pipe_get_generic_stage_desc (&stage_desc, + capture_ldc_binary, + out_frames, + local_in_frame, +NULL ); err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, - ¤t_stage); + &stage_desc, + ¤t_stage); local_in_frame = current_stage->args.out_frame[0 ]; } err =add_capture_pp_stage (pipe, me, local_in_frame, - need_yuv_pp ?NULL : out_frame, + need_yuv_pp ?NULL : out_frame, #else /* ldc and capture_pp not supported in same pipeline */ if (need_ldc && current_stage) { in_frame = current_stage->args.out_frame[0 ];ia_css_pipe_util_set_output_frames (out_frames,0 , out_frame);ia_css_pipe_get_generic_stage_desc (&stage_desc, capture_ldc_binary, - out_frames, in_frame,NULL ); - err =ia_css_pipeline_create_and_add_stage (me, - &stage_desc, -NULL ); + out_frames, in_frame,NULL ); + err =ia_css_pipeline_create_and_add_stage (me, &stage_desc, +NULL ); } else if (need_pp && current_stage) { in_frame = current_stage->args.out_frame[0 ]; - err =add_capture_pp_stage (pipe, me, in_frame, need_yuv_pp ?NULL : out_frame, + err =add_capture_pp_stage (pipe, me, in_frame, + need_yuv_pp ?NULL : out_frame, #endif - capture_pp_binary, - ¤t_stage); + capture_pp_binary, + ¤t_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7921,10 +7966,10 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)else tmp_out_frame =NULL ; - err =add_yuv_scaler_stage (pipe, me, tmp_in_frame, tmp_out_frame, -NULL , - &yuv_scaler_binary[i], - &yuv_scaler_stage); + err =add_yuv_scaler_stage (pipe, me, tmp_in_frame, + tmp_out_frame,NULL , + &yuv_scaler_binary[i], + &yuv_scaler_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7946,7 +7991,7 @@ create_host_regular_capture_pipeline(struct ia_css_pipe *pipe)if (mode !=IA_CSS_CAPTURE_MODE_RAW && mode !=IA_CSS_CAPTURE_MODE_BAYER && current_stage && vf_frame) { in_frame = current_stage->args.out_vf_frame; err =add_vf_pp_stage (pipe, in_frame, vf_frame, vf_pp_binary, - ¤t_stage); + ¤t_stage);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
@@ -7998,7 +8043,7 @@ static int capture_start( me = &pipe->pipeline;if ((pipe->config.default_capture_config.mode ==IA_CSS_CAPTURE_MODE_RAW || - pipe->config.default_capture_config.mode ==IA_CSS_CAPTURE_MODE_BAYER ) && + pipe->config.default_capture_config.mode ==IA_CSS_CAPTURE_MODE_BAYER ) && (pipe->config.mode !=IA_CSS_PIPE_MODE_COPY )) {if (copy_on_sp (pipe)) { err =start_copy_on_sp (pipe, &me->out_frame[0 ]);
@@ -8042,7 +8087,7 @@ static int capture_start(if (pipe->config.mode ==IA_CSS_PIPE_MODE_COPY && pipe->stream->reconfigure_css_rx) {ia_css_isys_rx_configure (&pipe->stream->csi_rx_config, - pipe->stream->config.mode); + pipe->stream->config.mode); pipe->stream->reconfigure_css_rx = false; }#endif
@@ -8053,8 +8098,8 @@ static int capture_start(static int sh_css_pipe_get_output_frame_info (struct ia_css_pipe *pipe, -struct ia_css_frame_info *info, -unsigned int idx) +struct ia_css_frame_info *info, +unsigned int idx) {assert (pipe);assert (info);
@@ -8072,7 +8117,7 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe,IA_CSS_FRAME_FORMAT_BINARY_8 , 0); }else if (info->format ==IA_CSS_FRAME_FORMAT_RAW || - info->format ==IA_CSS_FRAME_FORMAT_RAW_PACKED ) { + info->format ==IA_CSS_FRAME_FORMAT_RAW_PACKED ) { info->raw_bit_depth =ia_css_pipe_util_pipe_input_format_bpp (pipe); }
@@ -8084,9 +8129,9 @@ sh_css_pipe_get_output_frame_info(struct ia_css_pipe *pipe,void ia_css_stream_send_input_frame (const struct ia_css_stream *stream, -const unsigned short *data, -unsigned int width, -unsigned int height) +const unsigned short *data, +unsigned int width, +unsigned int height) {assert (stream);
@@ -8110,22 +8155,22 @@ ia_css_stream_start_input_frame(const struct ia_css_stream *stream)void ia_css_stream_send_input_line (const struct ia_css_stream *stream, -const unsigned short *data, -unsigned int width, -const unsigned short *data2, -unsigned int width2) +const unsigned short *data, +unsigned int width, +const unsigned short *data2, +unsigned int width2) {assert (stream);ia_css_inputfifo_send_line (stream->config.channel_id, - data, width, data2, width2); + data, width, data2, width2); }void ia_css_stream_send_input_embedded_line (const struct ia_css_stream *stream, -enum atomisp_input_format format, -const unsigned short *data, -unsigned int width) +enum atomisp_input_format format, +const unsigned short *data, +unsigned int width) {assert (stream);if (!data || width ==0 )
@@ -8246,7 +8291,7 @@ acc_unload_extension(struct ia_css_fw_info *firmware)/* Load firmware for extension */ static int ia_css_pipe_load_extension (struct ia_css_pipe *pipe, -struct ia_css_fw_info *firmware) +struct ia_css_fw_info *firmware) {int err =0 ;
@@ -8270,7 +8315,7 @@ ia_css_pipe_load_extension(struct ia_css_pipe *pipe,/* Unload firmware for extension */ static void ia_css_pipe_unload_extension (struct ia_css_pipe *pipe, -struct ia_css_fw_info *firmware) +struct ia_css_fw_info *firmware) {IA_CSS_ENTER_PRIVATE ("fw = %p pipe = %p" , firmware, pipe);
@@ -8312,7 +8357,7 @@ ia_css_pipeline_uses_params(struct ia_css_pipeline *me)static int sh_css_pipeline_add_acc_stage (struct ia_css_pipeline *pipeline, -const void *acc_fw) +const void *acc_fw) {struct ia_css_fw_info *fw = (struct ia_css_fw_info *)acc_fw;/* In QoS case, load_extension already called, so skipping */
@@ -8330,8 +8375,8 @@ sh_css_pipeline_add_acc_stage(struct ia_css_pipeline *pipeline,ia_css_pipe_get_acc_stage_desc (&stage_desc,NULL , fw); err =ia_css_pipeline_create_and_add_stage (pipeline, - &stage_desc, -NULL ); + &stage_desc, +NULL ); } ia_css_debug_dtrace(IA_CSS_DEBUG_TRACE,
@@ -8344,7 +8389,7 @@ sh_css_pipeline_add_acc_stage(struct ia_css_pipeline *pipeline,* Refer to "sh_css_internal.h" for details. */ int ia_css_stream_capture_frame (struct ia_css_stream *stream, -unsigned int exp_id) +unsigned int exp_id) {struct sh_css_tag_descr tag_descr;u32 encoded_tag_descr;
@@ -8503,22 +8548,22 @@ sh_css_init_host_sp_control_vars(void) (void )HIVE_ADDR_host_sp_com;sp_dmem_store_uint32 (SP0_ID , - (unsigned int )sp_address_of (ia_css_ispctrl_sp_isp_started), - (uint32_t )(0 )); + (unsigned int )sp_address_of (ia_css_ispctrl_sp_isp_started), + (uint32_t )(0 ));sp_dmem_store_uint32 (SP0_ID , - (unsigned int )sp_address_of (host_sp_queues_initialized), - (uint32_t )(0 )); + (unsigned int )sp_address_of (host_sp_queues_initialized), + (uint32_t )(0 ));sp_dmem_store_uint32 (SP0_ID , - (unsigned int )sp_address_of (sp_sleep_mode), - (uint32_t )(0 )); + (unsigned int )sp_address_of (sp_sleep_mode), + (uint32_t )(0 ));sp_dmem_store_uint32 (SP0_ID , - (unsigned int )sp_address_of (ia_css_dmaproxy_sp_invalidate_tlb), - (uint32_t )(false)); + (unsigned int )sp_address_of (ia_css_dmaproxy_sp_invalidate_tlb), + (uint32_t )(false));#ifndef ISP2401 sp_dmem_store_uint32 (SP0_ID , - (unsigned int )sp_address_of (sp_stop_copy_preview), - my_css.stop_copy_preview ? (uint32_t )(1 ) : (uint32_t )(0 )); + (unsigned int )sp_address_of (sp_stop_copy_preview), + my_css.stop_copy_preview ? (uint32_t )(1 ) : (uint32_t )(0 ));#endif store_sp_array_uint (host_sp_com, o, host2sp_cmd_ready);
@@ -8545,8 +8590,7 @@ void ia_css_pipe_config_defaults(struct ia_css_pipe_config *pipe_config) }void -ia_css_pipe_extra_config_defaults (struct ia_css_pipe_extra_config - *extra_config) +ia_css_pipe_extra_config_defaults (struct ia_css_pipe_extra_config *extra_config) {if (!extra_config) {IA_CSS_ERROR ("NULL input parameter" );
@@ -8620,8 +8664,8 @@ int ia_css_pipe_create(const struct ia_css_pipe_config *config,int ia_css_pipe_create_extra (const struct ia_css_pipe_config *config, -const struct ia_css_pipe_extra_config *extra_config, -struct ia_css_pipe **pipe) +const struct ia_css_pipe_extra_config *extra_config, +struct ia_css_pipe **pipe) {int err = -EINVAL ;struct ia_css_pipe *internal_pipe =NULL ;
@@ -8689,7 +8733,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,/* YUV downscaling */ if ((internal_pipe->config.vf_pp_in_res.width || - internal_pipe->config.capt_pp_in_res.width)) { + internal_pipe->config.capt_pp_in_res.width)) {enum ia_css_frame_format format;if (internal_pipe->config.vf_pp_in_res.width) {
@@ -8765,7 +8809,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config, }if (internal_pipe->config.acc_extension) { err =ia_css_pipe_load_extension (internal_pipe, - internal_pipe->config.acc_extension); + internal_pipe->config.acc_extension);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);kvfree (internal_pipe);
@@ -8783,7 +8827,7 @@ ia_css_pipe_create_extra(const struct ia_css_pipe_config *config,int ia_css_pipe_get_info (const struct ia_css_pipe *pipe, -struct ia_css_pipe_info *pipe_info) +struct ia_css_pipe_info *pipe_info) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_pipe_get_info()\n" );
@@ -8821,8 +8865,8 @@ bool ia_css_pipe_has_dvs_stats(struct ia_css_pipe_info *pipe_info)int ia_css_pipe_override_frame_format (struct ia_css_pipe *pipe, -int pin_index, -enum ia_css_frame_format new_format) +int pin_index, +enum ia_css_frame_format new_format) {int err =0 ;
@@ -8902,10 +8946,8 @@ ia_css_stream_configure_rx(struct ia_css_stream *stream)#endif static struct ia_css_pipe * -find_pipe (struct ia_css_pipe *pipes[], -unsigned int num_pipes, -enum ia_css_pipe_mode mode, -bool copy_pipe) +find_pipe (struct ia_css_pipe *pipes[],unsigned int num_pipes, +enum ia_css_pipe_mode mode,bool copy_pipe) {unsigned int i;
@@ -8976,7 +9018,7 @@ ia_css_acc_stream_create(struct ia_css_stream *stream)static int metadata_info_init (const struct ia_css_metadata_config *mdc, -struct ia_css_metadata_info *md) +struct ia_css_metadata_info *md) {/* Either both width and height should be set or neither */ if ((mdc->resolution.height >0 ) ^ (mdc->resolution.width >0 ))
@@ -9004,7 +9046,7 @@ static int check_pipe_resolutions(const struct ia_css_pipe *pipe) }if (ia_css_util_check_res (pipe->config.input_effective_res.width, - pipe->config.input_effective_res.height) !=0 ) { + pipe->config.input_effective_res.height) !=0 ) {IA_CSS_ERROR ("effective resolution not supported" ); err = -EINVAL ; goto EXIT;
@@ -9012,7 +9054,7 @@ static int check_pipe_resolutions(const struct ia_css_pipe *pipe)if (!ia_css_util_resolution_is_zero ( pipe->stream->config.input_config.input_res)) {if (!ia_css_util_res_leq (pipe->config.input_effective_res, - pipe->stream->config.input_config.input_res)) { + pipe->stream->config.input_config.input_res)) {IA_CSS_ERROR ("effective resolution is larger than input resolution" ); err = -EINVAL ; goto EXIT;
@@ -9035,9 +9077,9 @@ static int check_pipe_resolutions(const struct ia_css_pipe *pipe)int ia_css_stream_create (const struct ia_css_stream_config *stream_config, -int num_pipes, -struct ia_css_pipe *pipes[], -struct ia_css_stream **stream) +int num_pipes, +struct ia_css_pipe *pipes[], +struct ia_css_stream **stream) {struct ia_css_pipe *curr_pipe;struct ia_css_stream *curr_stream =NULL ;
@@ -9198,11 +9240,11 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,case IA_CSS_INPUT_MODE_TPG :#if !defined(ISP2401 )IA_CSS_LOG ("tpg_configuration: x_mask=%d, y_mask=%d, x_delta=%d, y_delta=%d, xy_mask=%d" , - curr_stream->config.source.tpg.x_mask, - curr_stream->config.source.tpg.y_mask, - curr_stream->config.source.tpg.x_delta, - curr_stream->config.source.tpg.y_delta, - curr_stream->config.source.tpg.xy_mask); + curr_stream->config.source.tpg.x_mask, + curr_stream->config.source.tpg.y_mask, + curr_stream->config.source.tpg.x_delta, + curr_stream->config.source.tpg.y_delta, + curr_stream->config.source.tpg.xy_mask); sh_css_sp_configure_tpg( curr_stream->config.source.tpg.x_mask,
@@ -9227,9 +9269,8 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, }#ifdef ISP2401 - err =aspect_ratio_crop_init (curr_stream, - pipes, - &aspect_ratio_crop_enabled); + err =aspect_ratio_crop_init (curr_stream, pipes, + &aspect_ratio_crop_enabled);if (err) {IA_CSS_LEAVE_ERR (err); goto ERR;
@@ -9266,8 +9307,8 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, curr_pipe->config.input_effective_res = effective_res; }IA_CSS_LOG ("effective_res=%dx%d" , - effective_res.width, - effective_res.height); + effective_res.width, + effective_res.height); }if (IS_ISP2401 ) {
@@ -9295,13 +9336,13 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,if (!spcopyonly) { sensor_binning_changed =sh_css_params_set_binning_factor (curr_stream, - curr_stream->config.sensor_binning_factor); + curr_stream->config.sensor_binning_factor); }else { sensor_binning_changed = false; }IA_CSS_LOG ("sensor_binning=%d, changed=%d" , - curr_stream->config.sensor_binning_factor, sensor_binning_changed); + curr_stream->config.sensor_binning_factor, sensor_binning_changed);/* loop over pipes */ IA_CSS_LOG ("num_pipes=%d" , num_pipes); curr_stream->cont_capt = false;
@@ -9325,17 +9366,18 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,/* Create copy pipe here, since it may not be exposed to the driver */ preview_pipe =find_pipe (pipes, num_pipes, -IA_CSS_PIPE_MODE_PREVIEW , false); +IA_CSS_PIPE_MODE_PREVIEW , false); video_pipe =find_pipe (pipes, num_pipes, -IA_CSS_PIPE_MODE_VIDEO , false); - acc_pipe =find_pipe (pipes, num_pipes, -IA_CSS_PIPE_MODE_ACC , false); +IA_CSS_PIPE_MODE_VIDEO , false); + acc_pipe =find_pipe (pipes, num_pipes,IA_CSS_PIPE_MODE_ACC , + false);if (acc_pipe && num_pipes ==2 && curr_stream->cont_capt) curr_stream->cont_capt = false;/* preview + QoS case will not need cont_capt switch */ if (curr_stream->cont_capt) { capture_pipe =find_pipe (pipes, num_pipes, -IA_CSS_PIPE_MODE_CAPTURE , false); +IA_CSS_PIPE_MODE_CAPTURE , + false);if (!capture_pipe) { err = -EINVAL ; goto ERR;
@@ -9417,10 +9459,12 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config,if (!spcopyonly) {if (!IS_ISP2401 ) err =sh_css_pipe_get_shading_info (curr_pipe, - &pipe_info->shading_info,NULL ); + &pipe_info->shading_info, +NULL );else err =sh_css_pipe_get_shading_info (curr_pipe, - &pipe_info->shading_info, &curr_pipe->config); + &pipe_info->shading_info, + &curr_pipe->config);if (err) goto ERR;
@@ -9430,7 +9474,8 @@ ia_css_stream_create(const struct ia_css_stream_config *stream_config, goto ERR;for (j =0 ; j <IA_CSS_PIPE_MAX_OUTPUT_STAGE ; j++) {sh_css_pipe_get_viewfinder_frame_info (curr_pipe, - &pipe_info->vf_output_info[j], j); + &pipe_info->vf_output_info[j], + j);if (err) goto ERR; }
@@ -9615,7 +9660,7 @@ ia_css_stream_destroy(struct ia_css_stream *stream)int ia_css_stream_get_info (const struct ia_css_stream *stream, -struct ia_css_stream_info *stream_info) +struct ia_css_stream_info *stream_info) {ia_css_debug_dtrace (IA_CSS_DEBUG_TRACE ,"ia_css_stream_get_info: enter/exit\n" );assert (stream);
@@ -9903,7 +9948,7 @@ ia_css_stream_get_3a_binary(const struct ia_css_stream *stream)int ia_css_stream_set_output_padded_width (struct ia_css_stream *stream, -unsigned int output_padded_width) +unsigned int output_padded_width) {struct ia_css_pipe *pipe;
@@ -10380,7 +10425,7 @@ ia_css_unlock_raw_frame(struct ia_css_stream *stream, uint32_t exp_id)*/ int ia_css_pipe_set_qos_ext_state (struct ia_css_pipe *pipe,uint32_t fw_handle, -bool enable) +bool enable) {unsigned int thread_id;struct ia_css_pipeline_stage *stage;
@@ -10426,7 +10471,7 @@ ia_css_pipe_set_qos_ext_state(struct ia_css_pipe *pipe, uint32_t fw_handle,*/ int ia_css_pipe_get_qos_ext_state (struct ia_css_pipe *pipe,uint32_t fw_handle, -bool *enable) +bool *enable) {struct ia_css_pipeline_stage *stage;unsigned int thread_id;
@@ -10462,9 +10507,9 @@ ia_css_pipe_get_qos_ext_state(struct ia_css_pipe *pipe, uint32_t fw_handle,/* ISP2401 */ int ia_css_pipe_update_qos_ext_mapped_arg (struct ia_css_pipe *pipe, -u32 fw_handle, -struct ia_css_isp_param_css_segments *css_seg, -struct ia_css_isp_param_isp_segments *isp_seg) +u32 fw_handle, +struct ia_css_isp_param_css_segments *css_seg, +struct ia_css_isp_param_isp_segments *isp_seg) {unsigned int HIVE_ADDR_sp_group;static struct sh_css_sp_group sp_group;
@@ -10499,7 +10544,7 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe,if (!err) {/* Get the Extension State */ enabled = (SH_CSS_QOS_STAGE_IS_ENABLED (&sh_css_sp_group.pipe[thread_id], - stage->stage_num)) ? true : false; + stage->stage_num)) ? true : false;/* Update mapped arg only when extension stage is not enabled */ if (enabled) {IA_CSS_ERROR ("Leaving: cannot update when stage is enabled." );
@@ -10509,13 +10554,14 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, HIVE_ADDR_sp_group = fw->info.sp.group;sp_dmem_load (SP0_ID , - (unsigned int )sp_address_of (sp_group), - &sp_group,sizeof (struct sh_css_sp_group )); + (unsigned int )sp_address_of (sp_group), + &sp_group, +sizeof (struct sh_css_sp_group ));hmm_load (sp_group.pipe[thread_id].sp_stage_addr[stage_num], - &sp_stage,sizeof (struct sh_css_sp_stage )); + &sp_stage,sizeof (struct sh_css_sp_stage ));hmm_load (sp_stage.isp_stage_addr, - &isp_stage,sizeof (struct sh_css_isp_stage )); + &isp_stage,sizeof (struct sh_css_isp_stage ));for (mem =0 ; mem <N_IA_CSS_ISP_MEMORIES ; mem++) { isp_stage.mem_initializers.params[IA_CSS_PARAM_CLASS_PARAM][mem].address =
@@ -10531,7 +10577,8 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe, }hmm_store (sp_stage.isp_stage_addr, - &isp_stage,sizeof (struct sh_css_isp_stage )); + &isp_stage, +sizeof (struct sh_css_isp_stage )); } } }
@@ -10542,8 +10589,8 @@ ia_css_pipe_update_qos_ext_mapped_arg(struct ia_css_pipe *pipe,#ifdef ISP2401 static int aspect_ratio_crop_init (struct ia_css_stream *curr_stream, -struct ia_css_pipe *pipes[], -bool *do_crop_status) +struct ia_css_pipe *pipes[], +bool *do_crop_status) {int err =0 ;int i;
@@ -10589,7 +10636,7 @@ aspect_ratio_crop_check(bool enabled, struct ia_css_pipe *curr_pipe)static int aspect_ratio_crop (struct ia_css_pipe *curr_pipe, -struct ia_css_resolution *effective_res) +struct ia_css_resolution *effective_res) {int err =0 ;struct ia_css_resolution crop_res;
@@ -10649,7 +10696,7 @@ aspect_ratio_crop(struct ia_css_pipe *curr_pipe,case IA_CSS_PIPE_MODE_YUVPP :default :IA_CSS_ERROR ("aspect ratio cropping invalid args: mode[%d]\n" , - curr_pipe->config.mode); + curr_pipe->config.mode);assert (0 );break ; }
@@ -10713,7 +10760,7 @@ static struct sh_css_hmm_buffer_recordassert (h_vbuf);assert ((type >IA_CSS_BUFFER_TYPE_INVALID ) && - (type <IA_CSS_NUM_DYNAMIC_BUFFER_TYPE )); + (type <IA_CSS_NUM_DYNAMIC_BUFFER_TYPE ));assert (kernel_ptr !=0 ); buffer_record = &hmm_buffer_record[0 ];
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 6/6 staging: media: atomisp: reduce load_primary_binaries() stack usage
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit f4d51e55dd47ef467fbe37d8575e20eee41b092d ]
The load_primary_binaries() function is overly complex and has som large variables on the stack, which can cause warnings depending on CONFIG_FRAME_WARN setting:
drivers/staging/media/atomisp/pci/sh_css.c: In function 'load_primary_binaries':drivers/staging/media/atomisp/pci/sh_css.c:5260:1: error: the frame size of 1560 bytes is larger than 1536 bytes [-Werror=frame-larger-than=]
Half of the stack usage is for the prim_descr[] array, but only one member of the array is used at any given time.
Reduce the stack usage by turning the array into a single structure.
--- drivers/staging/media/atomisp/pci/sh_css.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/media/atomisp/pci/sh_css.c +3 -3
@@ -5870,7 +5870,6 @@ static int load_primary_binaries(struct ia_css_capture_settings *mycs;unsigned int i;bool need_extra_yuv_scaler = false; -struct ia_css_binary_descr prim_descr[MAX_NUM_PRIMARY_STAGES ];IA_CSS_ENTER_PRIVATE ("" );assert (pipe);
@@ -6058,15 +6057,16 @@ static int load_primary_binaries(/* Primary */ for (i =0 ; i < mycs->num_primary_stage; i++) { +struct ia_css_binary_descr prim_descr;struct ia_css_frame_info *local_vf_info =NULL ;if (pipe->enable_viewfinder[IA_CSS_PIPE_OUTPUT_STAGE_0 ] && (i == mycs->num_primary_stage -1 )) local_vf_info = &vf_info; -ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr[i], +ia_css_pipe_get_primary_binarydesc (pipe, &prim_descr, &prim_in_info, &prim_out_info, local_vf_info, i); - err =ia_css_binary_find (&prim_descr[i], &mycs->primary_binary[i]); + err =ia_css_binary_find (&prim_descr, &mycs->primary_binary[i]);if (err) {IA_CSS_LEAVE_ERR_PRIVATE (err);return err;
Signature · 1 line
2.53.0