Skip to content

Tools: Topology: Add selector to compress playback pipeline#10618

Open
singalsu wants to merge 2 commits intothesofproject:mainfrom
singalsu:tplg_add_selector_to_compress
Open

Tools: Topology: Add selector to compress playback pipeline#10618
singalsu wants to merge 2 commits intothesofproject:mainfrom
singalsu:tplg_add_selector_to_compress

Conversation

@singalsu
Copy link
Copy Markdown
Collaborator

@singalsu singalsu commented Mar 12, 2026

WIP, this needs #10613 and thesofproject/linux#5694 .

The above are now merged, so I can convert this to non-draft.

@singalsu
Copy link
Copy Markdown
Collaborator Author

sof-mtl-rt713-l0-rt1316-l12-compr

@singalsu singalsu requested a review from ujfalusi March 13, 2026 14:33
<include/components/micsel/stereo_endpoint_playback_updownmix.conf>
}
<include/formats/compr_input_audio_formats_s32_48k.conf>
<include/formats/compr_output_audio_formats_s32_48k_stereo.conf>
Copy link
Copy Markdown
Contributor

@ujfalusi ujfalusi Mar 19, 2026

Choose a reason for hiding this comment

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

If you add the 'micsel' right after the decoder then the module-copier, src, does not need new formats as they would keep receiving stereo?
Or is it better to run with mono on them and convert to stereo as late as possible?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

As far as I understand this convert to stereo late is the only option that kernel can support (and still needs #5694). I tried early convert to stereo but kernel could not handle the formats. Early convert to stereo will be beneficial for 5.1 and 7.1, while this late convert to stereo is optimal for mono content. The first is more critical though. Ideally kernel should support both and let the approach be chosen in topology.

Copy link
Copy Markdown
Contributor

@ujfalusi ujfalusi Mar 26, 2026

Choose a reason for hiding this comment

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

you cannot swap topology based on how many channels the file you play have...
You could have 2x micsel, the first would support mono and stereo out, the second would support only stereo.
if mono is played then it would pass the micsel as mono, if 5.1/7.1 then it gets converted to stereo. Mono->stereo would be done on the second micsel down the path.

But no idea how this can be done nicely in kernel, it sounds simple, but I don't like to add much heuristics.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Two micsel would do it but I feel it's too complicated. Early convert to stereo is the better long term solution, while this late convert works with mono and stereo well. And our offload codecs so far are mono/stereo only. I've tested 5.1 and 7.1 with patch #10554 and wav format but the patch still needs work with stream end handling.

@singalsu singalsu marked this pull request as ready for review March 27, 2026 10:40
@singalsu singalsu requested review from jsarha and ranj063 as code owners March 27, 2026 10:40
Copilot AI review requested due to automatic review settings March 27, 2026 10:40
@singalsu singalsu requested review from kv2019i and lgirdwood March 27, 2026 10:44
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a selector (micsel) stage to the CAVS compressed playback pipeline so the playback path can be constrained/converted to stereo, and refactors repeated format blocks into reusable include files.

Changes:

  • Insert micsel into the compr-playback pipeline graph between src and gain.
  • Update Intel compressed playback topology (compr.conf) to use shared format include files and to configure the new micsel widget/control.
  • Add new include/formats/* snippets for compressed pipeline input/output format declarations (including SRC S32→48k and stereo-only output).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/topology/topology2/platform/intel/compr.conf Refactors format declarations into includes and adds a new micsel widget/control in the compressed playback pipeline instances.
tools/topology/topology2/include/pipelines/cavs/compr-playback.conf Adds micsel component to the pipeline class and routes src -> micsel -> gain.
tools/topology/topology2/include/formats/compr_input_audio_formats.conf New shared input format definitions for host-copier/decoder/module-copier.
tools/topology/topology2/include/formats/compr_output_audio_formats.conf New shared output format definitions for host-copier/decoder.
tools/topology/topology2/include/formats/compr_output_audio_formats_s32.conf New shared S32 output format definitions (e.g., module-copier).
tools/topology/topology2/include/formats/compr_input_output_formats_src_s32_to_48k.conf New SRC-specific input/output format definitions supporting mono+stereo at 48k output.
tools/topology/topology2/include/formats/compr_input_audio_formats_s32_48k.conf New input format definitions intended for the post-SRC stage feeding micsel.
tools/topology/topology2/include/formats/compr_output_audio_formats_s32_48k_stereo.conf New single stereo S32/48k output format definition for micsel.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Object.Widget.micsel.1 {
Object.Control.bytes."1" {
name '$COMPR_2_PCM_NAME selector bytes'
<include/components/micsel/stereo_endpoint_playback_updownmix.conf>
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The referenced include file include/components/micsel/stereo_endpoint_playback_updownmix.conf does not exist in the repository, so topology generation will fail. Add this missing include file (and ensure it defines the intended selector bytes) or switch to an existing micsel profile include (e.g., passthrough/upmix/downmix configs) that matches the desired behavior.

Suggested change
<include/components/micsel/stereo_endpoint_playback_updownmix.conf>
<include/components/micsel/stereo_endpoint_playback_upmix.conf>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

same as previous, it exists

@@ -22,6 +22,7 @@
<include/components/pipeline.conf>
<include/components/gain.conf>
<include/components/decoder.conf>
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

This pipeline instantiates a src widget (src."1" {}) but does not include include/components/src.conf in the header includes. This makes the pipeline definition depend on external include order and is inconsistent with other pipeline templates that include their component classes explicitly. Add the missing src.conf include here to keep the pipeline self-contained.

Suggested change
<include/components/decoder.conf>
<include/components/decoder.conf>
<include/components/src.conf>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

ok

Object.Widget.micsel.1 {
Object.Control.bytes."1" {
name '$COMPR_PCM_NAME selector bytes'
<include/components/micsel/stereo_endpoint_playback_updownmix.conf>
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The referenced include file include/components/micsel/stereo_endpoint_playback_updownmix.conf does not exist in the repository, so topology generation will fail. Add this missing include file (and ensure it defines the intended selector bytes) or switch to an existing micsel profile include (e.g., passthrough/upmix/downmix configs) that matches the desired behavior.

Suggested change
<include/components/micsel/stereo_endpoint_playback_updownmix.conf>
<include/components/micsel/stereo_endpoint_playback_passthrough.conf>

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

This patch moves formats definitions for the objects in
pipeline compr-playback to separate include files in new
directory include/formats.

It avoids duplication of same input and output formats several
times and prepares to add new formats and sample rates later.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
The purpose of this patch is to add conversion of possible mono
output from decoder to stereo format in the selector (micsel)
module. If the decoded output is stereo, the selector goes to
pass-through mode with minimal impact to processing load.

This patch adds the mono format to all needed objects (host-copier,
decoder, module-copier, src, input of selector). Selector has
single stereo, S32_LE, 48 kHz output format.

Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
@singalsu singalsu force-pushed the tplg_add_selector_to_compress branch from eff2fbb to 993f81e Compare March 27, 2026 18:28
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.

3 participants