From 4fb1090c54c3fc271502b303e02f409599c962f1 Mon Sep 17 00:00:00 2001 From: Marcin Szkudlinski Date: Fri, 20 Oct 2023 11:50:09 +0200 Subject: [PATCH] DP: LL module should get 1ms data chunk in each cycle 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 Signed-off-by: Marcin Szkudlinski --- src/audio/module_adapter/module_adapter.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/audio/module_adapter/module_adapter.c b/src/audio/module_adapter/module_adapter.c index 2b3ab4faaad7..4fab7200b9a5 100644 --- a/src/audio/module_adapter/module_adapter.c +++ b/src/audio/module_adapter/module_adapter.c @@ -1056,13 +1056,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), source_get_data_available(data_src)); err = source_to_sink_copy(data_src, data_sink, true, to_copy);