Skip to content

Audio: Buffers: Add support for DP-to-DP component binding - #10562

Open
singalsu wants to merge 1 commit into
thesofproject:mainfrom
singalsu:audio_buffers_dp_to_dp_bind
Open

Audio: Buffers: Add support for DP-to-DP component binding#10562
singalsu wants to merge 1 commit into
thesofproject:mainfrom
singalsu:audio_buffers_dp_to_dp_bind

Conversation

@singalsu

Copy link
Copy Markdown
Collaborator

Previously binding two DP (Data Processing) scheduled components was rejected with IPC4_INVALID_REQUEST. This patch adds support for DP-to-DP binding by creating a dual ring buffer configuration where each DP module gets its own ring buffer on either side of the intermediate comp_buffer.

Data flow for DP-to-DP:
src_DP -> ring_buf_src -> comp_buffer -> ring_buf_sink -> sink_DP

Changes in helper.c:

  • Remove the DP-to-DP bind rejection in ipc_comp_connect().
  • Add src_is_dp, sink_is_dp, and dp_to_dp flags to detect the DP-to-DP case.
  • Create a second ring_buffer allocated from the source module's heap for the source side of the comp_buffer.
  • Track ring_buffer client_count on the DP heap with a NULL guard to avoid unsafe container_of when CONFIG_USERSPACE is disabled.

Changes in audio_buffer.c:

  • Change audio_buffer_attach_secondary_buffer() from a global rejection to per-side checks, allowing both secondary_buffer_sink and secondary_buffer_source to be set simultaneously.
  • Add a dual-secondary sync path in audio_buffer_sync_secondary_buffer()
    that cascades data through: input ring_buffer -> comp_buffer ->
    output ring_buffer, with rate-limiting applied on the output side.

Changes in ring_buffer.c:

  • Add DP heap client_count decrement in ring_buffer_free() with a NULL heap guard, matching the pattern used in comp_buffer_free().

@lgirdwood lgirdwood left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@singalsu so this is not breaking anything atm, but its probably worth while to modify the nocodec topology to have this DP-DP config and see what happens...

@softwarecki
softwarecki self-requested a review February 20, 2026 15:56
@softwarecki

Copy link
Copy Markdown
Collaborator

No, no, no! No comp_buffer between dp modules! Just single ring buffer. We plan to remove comp_buffer and add support for dp-dp connection.

@singalsu

Copy link
Copy Markdown
Collaborator Author

No, no, no! No comp_buffer between dp modules! Just single ring buffer. We plan to remove comp_buffer and add support for dp-dp connection.

Would be great if that can be done! I need this to have decoder and phase_vocoder in same pipeline without LL components in between throttling the playback data. The phase vocoder consumes at input the audio data at 0.5x to 2.0x speed vs. normal. There can't be LL components with speed higher than 1.0.

@lgirdwood

Copy link
Copy Markdown
Member

No, no, no! No comp_buffer between dp modules! Just single ring buffer. We plan to remove comp_buffer and add support for dp-dp connection.

Would be great if that can be done! I need this to have decoder and phase_vocoder in same pipeline without LL components in between throttling the playback data. The phase vocoder consumes at input the audio data at 0.5x to 2.0x speed vs. normal. There can't be LL components with speed higher than 1.0.

@softwarecki whats your rough schedule for dp-dp ? It seems like we have a real use case now that needs it.

Previously binding two DP (Data Processing) scheduled components
was rejected with IPC4_INVALID_REQUEST. This patch adds support
for DP-to-DP binding by creating a dual ring buffer configuration
where each DP module gets its own ring buffer on either side of
the intermediate comp_buffer.

Data flow for DP-to-DP:
  src_DP -> ring_buf_src -> comp_buffer -> ring_buf_sink -> sink_DP

Changes in helper.c:
- Remove the DP-to-DP bind rejection in ipc_comp_connect().
- Add src_is_dp, sink_is_dp, and dp_to_dp flags to detect the
  DP-to-DP case.
- Create a second ring_buffer allocated from the source module's
  mod_alloc_ctx for the source side of the comp_buffer.
- Refcount the DP vregion for each created ring_buffer via
  vregion_get(), with a NULL alloc guard.

Changes in audio_buffer.c:
- Change audio_buffer_attach_secondary_buffer() from a global
  rejection to per-side checks, allowing both secondary_buffer_sink
  and secondary_buffer_source to be set simultaneously.
- Add a dual-secondary sync path in audio_buffer_sync_secondary_buffer()
  that cascades data through: input ring_buffer -> comp_buffer ->
  output ring_buffer, with rate-limiting applied on the output side.

Changes in ring_buffer.c:
- Release the DP vregion in ring_buffer_free() via vregion_put()
  and free the mod_alloc_ctx when the refcount reaches zero,
  matching the pattern used in comp_buffer_free().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu
singalsu force-pushed the audio_buffers_dp_to_dp_bind branch from 46ecff9 to cdc456a Compare August 14, 2026 08:17
@singalsu singalsu changed the title [DNM] Audio: Buffers: Add support for DP-to-DP component binding Audio: Buffers: Add support for DP-to-DP component binding Aug 14, 2026
@singalsu
singalsu marked this pull request as ready for review August 14, 2026 08:18
Copilot AI lite review requested due to automatic review settings August 14, 2026 08:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 extends the IPC4 binding and buffering infrastructure to allow binding two DP-scheduled components together by introducing a dual-ring-buffer “hybrid” topology around an intermediate comp_buffer, enabling lock-free DP access on both sides while preserving LL-cycle synchronization semantics.

Changes:

  • Allow DP→DP binds in ipc_comp_connect() and create/attach a second ring_buffer for the source side in the DP→DP case.
  • Update secondary-buffer attachment and syncing logic to permit and handle both secondary_buffer_sink and secondary_buffer_source simultaneously.
  • Add vregion refcount release in ring_buffer_free() to match new vregion refcounting during ring buffer creation.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/ipc/ipc4/helper.c Removes DP→DP bind rejection and adds dual ring-buffer creation/attachment for DP→DP connections.
src/audio/buffers/audio_buffer.c Allows per-side secondary attachments and adds a dual-secondary sync path for DP→DP cascaded copying.
src/audio/buffers/ring_buffer.c Releases vregion references during ring buffer free to match new vregion refcounting behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment on lines +63 to +70
* Both steps run in order (source DP first, then sink DP). Performing
* them both here in a single call ensures atomicity and correct
* rate-limiting. The second call for the same buffer will be a no-op
* since the comp_buffer will be empty.
*
* Step 1: copy from input secondary buffer to primary (comp_buffer).
* No limit on input side - copy all available data.
*/
singalsu added a commit to singalsu/sof that referenced this pull request Aug 14, 2026
See thesofproject#10562

Previously binding two DP (Data Processing) scheduled components
was rejected with IPC4_INVALID_REQUEST. This patch adds support
for DP-to-DP binding by creating a dual ring buffer configuration
where each DP module gets its own ring buffer on either side of
the intermediate comp_buffer.

Data flow for DP-to-DP:
  src_DP -> ring_buf_src -> comp_buffer -> ring_buf_sink -> sink_DP

Changes in helper.c:
- Remove the DP-to-DP bind rejection in ipc_comp_connect().
- Add src_is_dp, sink_is_dp, and dp_to_dp flags to detect the
  DP-to-DP case.
- Create a second ring_buffer allocated from the source module's
  mod_alloc_ctx for the source side of the comp_buffer.
- Refcount the DP vregion for each created ring_buffer via
  vregion_get(), with a NULL alloc guard.

Changes in audio_buffer.c:
- Change audio_buffer_attach_secondary_buffer() from a global
  rejection to per-side checks, allowing both secondary_buffer_sink
  and secondary_buffer_source to be set simultaneously.
- Add a dual-secondary sync path in audio_buffer_sync_secondary_buffer()
  that cascades data through: input ring_buffer -> comp_buffer ->
  output ring_buffer, with rate-limiting applied on the output side.

Changes in ring_buffer.c:
- Release the DP vregion in ring_buffer_free() via vregion_put()
  and free the mod_alloc_ctx when the refcount reaches zero,
  matching the pattern used in comp_buffer_free().

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants