-
Notifications
You must be signed in to change notification settings - Fork 350
Compressed offload support for IPC4 #10492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Add a global ID for module specific init data in the extended init data section and update the decode function to save the data in the module's init_data. Signed-off-by: Ranjani Sridharan <[email protected]>
When a modules advertises the input and output buffer requirements for processing, use that to determine the size of the secondary buffer when attaching them to buffers interfacing with DP modules. Signed-off-by: Ranjani Sridharan <[email protected]>
Split the implementation for IPC3 for the cadence decoder and add a new implementation for IPC4. The IPC4 implementation assumes that the codec info is passed to the firmware during the module init IPC as module specific data. The implementation includes support for MP3 decoder, MP3 encoder and AAC decoder for the time being. Signed-off-by: Ranjani Sridharan <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds compressed offload support for IPC4 by refactoring the Cadence codec implementation. It splits the existing implementation into IPC3 and IPC4-specific variants while keeping common functionality shared.
Changes:
- Split Cadence codec implementation into IPC3 (
cadence_ipc3.c) and IPC4 (cadence_ipc4.c) specific files - Modified ring buffer creation to account for module-specific buffer size requirements
- Added support for module initialization data in IPC4
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/ipc/ipc4/helper.c | Updated ring buffer size calculation to use MAX of default sizes and module-specific buffer requirements |
| src/include/sof/audio/module_adapter/module/cadence.h | Exposed common Cadence codec functions, added IPC4-specific structures, moved API ID enum from .c file |
| src/include/sof/audio/cadence/mp3_enc/xa_mp3_enc_api.h | Added new MP3 encoder API header with configuration parameters and error codes |
| src/include/ipc4/module.h | Added MODULE_DATA initialization data type to support codec-specific init data |
| src/audio/module_adapter/module_adapter_ipc4.c | Added handling for MODULE_DATA initialization data type |
| src/audio/module_adapter/module/cadence_ipc4.c | New IPC4-specific Cadence codec implementation with DP-aware processing |
| src/audio/module_adapter/module/cadence_ipc3.c | Extracted IPC3-specific Cadence codec implementation |
| src/audio/module_adapter/module/cadence.c | Refactored to contain only common codec functionality shared between IPC3/IPC4 |
| src/audio/module_adapter/CMakeLists.txt | Updated build configuration to compile IPC-specific implementations |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cd->direction = *((uint32_t *)codec->cfg.init_data + | ||
| sizeof(struct snd_codec) / sizeof(uint32_t)); |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pointer arithmetic error: adding the result of sizeof(struct snd_codec) / sizeof(uint32_t) to a uint32_t* pointer will skip that many uint32_t elements (multiplying by sizeof(uint32_t) again). This should be cast to uint8_t* first, then offset by sizeof(struct snd_codec), then cast back to uint32_t* and dereferenced.
| cd->direction = *((uint32_t *)codec->cfg.init_data + | |
| sizeof(struct snd_codec) / sizeof(uint32_t)); | |
| uint8_t *init_bytes = (uint8_t *)codec->cfg.init_data; | |
| cd->direction = *(uint32_t *)(init_bytes + sizeof(struct snd_codec)); |
| { | ||
| struct cadence_codec_data *cd = module_get_private_data(mod); | ||
| struct comp_dev *dev = mod->dev; | ||
| int word_size = 16; |
Copilot
AI
Jan 21, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded word size value 16 is used here but then validated against audio_fmt.depth in the switch statement below. Consider using a constant definition or deriving the value from the configuration to make the relationship clearer.
|
@dbaluta would you be able to give this PR a try to make sure IPC3 compressed support is still good? On the kernel side, the split was cleaner but I had to retain the common parts in this PR for IPC3 and IPC4. Thanks! |
This PR is part 1 of the compressed offload support which includes splitting up the cadence implementation for IPC3 and IPC4 along with the required patches for setting a DP module's ring buffer size based on what the input buffer size requirements for the codec are and the init data required for module init. The topology patches showing the compressed path will be included in the next part