module: cadence: rework module to use sink/source api#10792
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reworks the Cadence codec module (IPC3 variant) to use the sink/source APIs (aligning with the pipeline 2.0 transition), and consolidates ring-buffer wrap copy logic into shared helpers used by both IPC3 and IPC4 variants.
Changes:
- Added shared ring-buffer copy helpers
cadence_copy_data_from_buffer()andcadence_copy_data_to_buffer()to remove duplicated wrap-handling logic. - Converted IPC3 Cadence processing to the sink/source
.processinterface (instead of the deprecated.process_raw_datainterface). - Simplified IPC4 output copy path to use the new shared helper and adjusted
sink_buffer_startmutability.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
src/include/sof/audio/module_adapter/module/cadence.h |
Declares new shared ring-buffer copy helper APIs. |
src/audio/module_adapter/module/cadence.c |
Implements the shared ring-buffer copy helper functions. |
src/audio/module_adapter/module/cadence_ipc4.c |
Removes local copy helper and uses the shared helper for sink writes. |
src/audio/module_adapter/module/cadence_ipc3.c |
Switches to sink/source .process API and updates data movement to use shared helpers. |
kv2019i
left a comment
There was a problem hiding this comment.
Please check the raw_buffer_list usage is safe in process
|
|
||
| remaining -= codec->mpd.consumed; | ||
| input_buffers[0].consumed = codec->mpd.consumed; | ||
| source_release_data(sources[0], codec->mpd.consumed); |
There was a problem hiding this comment.
L263 in this process() function still uses "raw_data_buffers_list":
local_buff = list_first_item(&mod->raw_data_buffers_list, struct comp_buffer, buffers_list);
This cannot work, right? module_adapter_prepare() doesn't allocate the raw data buffer list if not in raw processing mode.
There was a problem hiding this comment.
This list is populated in module_adapter_prepare() regardless of which processing function is used, but it is still good to remove it here.
Rework the cadence ipc3 module variant to only use the sink/source api to prepare sof for the full transition to pipeline 2.0. Make cadence_copy_data_from_buffer() shared across both ipc3 and ipc4 variants. Add a common cadence_copy_data_to_buffer() function. Remove the unnecessary const modifier from sink_buffer_start and eliminate redundant type casts. Signed-off-by: Adrian Warecki <adrian.warecki@intel.com>
Rework the cadence ipc3 module variant to only use the sink/source api to prepare sof for the full transition to pipeline 2.0.
Make cadence_copy_data_from_buffer() shared across both ipc3 and ipc4 variants. Add a common cadence_copy_data_to_buffer() function. Remove the unnecessary const modifier from sink_buffer_start and eliminate redundant type casts.