Skip to content
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

Audio: DRC: Use audio_stream_copy() with pass-through configuration #9626

Merged
merged 1 commit into from
Nov 1, 2024

Conversation

singalsu
Copy link
Collaborator

The configuration blob is checked in drc_prepare(). If the blob does not have params.enable set, then it is safe to switch to a more efficient buffer copy function that bypasses the internal DRC lookup delay with channels de-interleave and interleave operations. The enable in the blob is a master switch for DRC. With such configuration in the blob the switch control from user space can't switch the processing on. Therefore it is safe to change the processing function. This change minimizes the MCPS overhead of unused DRC and reduces audio latency.

If a new blob is received during streaming, the params.enable is checked again and the processing function is set again if the pass-through copy mode was in use.

A pass-through blob can be applied e.g. when the same pipeline is used for both headphone and speaker, where DRC is usually disabled for headphone mode.

This change saves in hda-generic topologies with the default blob about 1.2 MCPS in TGL platform.

@singalsu singalsu force-pushed the drc_passthrough_mode branch from 57cdc86 to bbda6e8 Compare October 30, 2024 09:33
@singalsu
Copy link
Collaborator Author

Note: When a blob has the params.enable set, then the user space switch control as before controls the processing on/off while preserving the internal lookup delay so this change doesn't cause glitches when normally controlling processing.

Copy link
Member

@lgirdwood lgirdwood left a comment

Choose a reason for hiding this comment

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

Good MCPS savings @singalsu !

Comment on lines 281 to 292

if (cd->drc_func == drc_default_pass && cd->config->params.enabled)
cd->drc_func = drc_find_proc_func(cd->source_format);

if (!cd->config->params.enabled)
cd->drc_func = drc_default_pass;
Copy link
Member

Choose a reason for hiding this comment

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

Can we spell out the configuration flow and selection in an inline comment too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yep, it's useful to document.

The configuration blob is checked in drc_prepare(). If
the blob does not have params.enable set, then it is safe
to switch to a more efficient buffer copy function that
bypasses the internal DRC lookup delay with channels
de-interleave and interleave operations. The enable in the
blob is a master switch for DRC. With such configuration in
the blob the switch control from user space can't switch the
processing on. Therefore it is safe to change the processing
function. This change minimizes the MCPS overhead of unused
DRC and reduces audio latency.

If a new blob is received during streaming, the params.enable
is checked again and the processing function is set again
if the pass-through copy mode was in use. If the new blob
has enable false, then the processing is changed to pass-through
mode.

The pass-through blob configuration is useful when the same
pipeline is used for both headphone and speaker, where DRC
is usually disabled for headphone mode.

This change saves in hda-generic topologies with the default
blob about 1.2 MCPS in TGL platform.

Signed-off-by: Seppo Ingalsuo <[email protected]>
@singalsu singalsu force-pushed the drc_passthrough_mode branch from bbda6e8 to c5ef0e3 Compare October 31, 2024 10:24
@singalsu singalsu marked this pull request as ready for review October 31, 2024 10:24
@singalsu singalsu requested a review from a team as a code owner October 31, 2024 10:24
@singalsu singalsu requested review from kv2019i and lyakh October 31, 2024 10:25
@lgirdwood lgirdwood merged commit c041966 into thesofproject:main Nov 1, 2024
45 of 47 checks passed
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