module_adapter: Add flags to skip source/sink buffer invalidate/writeback

Some modules like the mixin/mixout do the invalidate/writebacks for the
source/sink buffers themselves. So, add flags in struct
processing_module to skip doing the same again in the module adapter
code.

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
This commit is contained in:
Ranjani Sridharan 2022-12-22 06:37:44 -08:00 committed by Liam Girdwood
parent fba35b13f4
commit 33fa026524
3 changed files with 21 additions and 3 deletions

View File

@ -121,6 +121,7 @@ static int mixin_init(struct processing_module *mod)
dev->ipc_config.frame_fmt = frame_fmt;
mod->simple_copy = true;
mod->skip_src_buffer_invalidate = true;
return 0;
}
@ -149,6 +150,7 @@ static int mixout_init(struct processing_module *mod)
dev->ipc_config.frame_fmt = frame_fmt;
mod->simple_copy = true;
mod->skip_sink_buffer_writeback = true;
return 0;
}

View File

@ -569,6 +569,7 @@ static void module_adapter_process_output(struct comp_dev *dev)
sink = container_of(blist, struct comp_buffer, source_list);
sink_c = buffer_acquire(sink);
if (!mod->skip_sink_buffer_writeback)
buffer_stream_writeback(sink_c, mod->output_buffers[i].size);
comp_update_buffer_produce(sink_c, mod->output_buffers[i].size);
@ -650,6 +651,7 @@ module_single_sink_setup(struct comp_dev *dev,
comp_get_copy_limits_frame_aligned(source_c[i], sinks_c[0], &c);
if (!mod->skip_src_buffer_invalidate)
buffer_stream_invalidate(source_c[i], c.frames * c.source_frame_bytes);
/*
@ -701,7 +703,9 @@ module_single_source_setup(struct comp_dev *dev,
i++;
}
if (!mod->skip_src_buffer_invalidate)
buffer_stream_invalidate(source_c[0], min_frames * source_frame_bytes);
/* note that the size is in number of frames not the number of bytes */
mod->input_buffers[0].size = min_frames;
mod->input_buffers[0].consumed = 0;

View File

@ -195,6 +195,18 @@ struct processing_module {
/* flag to indicate module does not pause */
bool no_pause;
/*
* flag to indicate that the sink buffer writeback should be skipped. It will be handled
* in the module's process callback
*/
bool skip_sink_buffer_writeback;
/*
* flag to indicate that the source buffer invalidate should be skipped. It will be handled
* in the module's process callback
*/
bool skip_src_buffer_invalidate;
/* table containing the list of connected sources */
struct module_source_info *source_info;
};