Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion src/audio/module_adapter/module_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -1053,13 +1053,24 @@ static int module_adapter_copy_dp_queues(struct comp_dev *dev)
list_for_item(blist, &dev->bsink_list) {
/* output - we need to copy data from dp_queue (as source)
* to audio_stream (as sink)
*
* a trick is needed there:
* DP may produce a huge chunk of output data (i.e. 10 LL cycles), and the
* following module should be able to consume it in 1 cycle chunks, one by one
*
* unfortunately LL modules are designed to drain input buffer
* That leads to issues when DP provide huge data portion
*
* FIX: copy only the following module's IBS in each LL cycle
*/
assert(dp_queue);
struct comp_buffer *buffer =
container_of(blist, struct comp_buffer, source_list);
struct sof_sink *data_sink = audio_stream_get_sink(&buffer->stream);
struct sof_source *following_mod_data_source =
audio_stream_get_source(&buffer->stream);
struct sof_source *data_src = dp_queue_get_source(dp_queue);
uint32_t to_copy = MIN(sink_get_free_size(data_sink),
uint32_t to_copy = MIN(source_get_min_available(following_mod_data_source),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are two possible data listed in DP output buffer:

  1. copy 1 LL cycle, then keep read ptr as current position, next time will start from this read ptr.
  2. once copy 1 LL cycle from DP output buffer, then move data from current to the beginning of the buffer.

2 will give LL modules always fetch data from beginning, i.e, linear buffer, what do you think about this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@marcinszkudlinski @andrula-song I assume this will always give us a size that is aligned to hifi2/3/4/5 SIMD preferred data stride ?

Copy link
Contributor

@andrula-song andrula-song Dec 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the code it is from IBS/OBS, if we don't set restrictions in tplg, there may be potential issues
sink_set_min_free_space(audio_stream_get_sink(&buffer->stream), source_src_cfg.obs); source_set_min_available(audio_stream_get_source(&buffer->stream), sink_src_cfg.ibs);

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, so not a problem to block this PR, but it sounds like we need a HiFi specific check around OBS/IBS as an incremental validation around IPC.

source_get_data_available(data_src));

err = source_to_sink_copy(data_src, data_sink, true, to_copy);
Expand Down