Skip to content

Conversation

@RanderWang
Copy link
Collaborator

This PR add ipc src support in topology2.

@RanderWang
Copy link
Collaborator Author

updated, thanks

@RanderWang RanderWang changed the title topology2: add src support [RFC] topology2: add src support Jun 15, 2022
@RanderWang
Copy link
Collaborator Author

change it to RFC since we need to support
(1) all the formats. The debugging and validation effort will be significantly increased
(2) add mixin & mixout

@RanderWang
Copy link
Collaborator Author

RanderWang commented Jun 15, 2022

@plbossart @lgirdwood @ranj063 @bardliao I have an idea bout SRC support in Linux kernel.
SOF can support many sample rates but it is not optimized to build it in topology. The reason is that 48khz audio file will be used in 4x% chance, 4x% 44.1khz and n% for other sample rates. If SRC is built in topology it will introduce more cpu usage for normal 48khz audio. It is not a good deal.

My solution is dynamically add SRC in driver according to sample rate so that we have optimized performance. Another way is to build it in topology but delete it in driver for no conversion rate.

@lgirdwood
Copy link
Member

@plbossart @lgirdwood @ranj063 @bardliao I have an idea bout SRC support in Linux kernel. SOF can support many sample rates but it is not optimized to build it in topology. The reason is that 48khz audio file will be used in 4x% chance, 4x% 44.1khz and n% for other sample rates. If SRC is built in topology it will introduce more cpu usage for normal 48khz audio. It is not a good deal.

My solution is dynamically add SRC in driver according to sample rate so that we have optimized performance. Another way is to build it in topology but delete it in driver for no conversion rate.

@RanderWang just a thought, rather than expressing all the supported in/out rates for the SRC in the topology, we could use a wildcard rate (like SNDRV_PCM_RATE_CONTINUOUS using 0) which means we can define a single SRC object with wildcard in/out rates where the FW could reject any invalid combination.

@plbossart
Copy link
Member

@plbossart @lgirdwood @ranj063 @bardliao I have an idea bout SRC support in Linux kernel. SOF can support many sample rates but it is not optimized to build it in topology. The reason is that 48khz audio file will be used in 4x% chance, 4x% 44.1khz and n% for other sample rates. If SRC is built in topology it will introduce more cpu usage for normal 48khz audio. It is not a good deal.

My solution is dynamically add SRC in driver according to sample rate so that we have optimized performance. Another way is to build it in topology but delete it in driver for no conversion rate.

That's what others have suggested in the 'AVS' driver, you could bind modules only if required, e.g. if you don't need an instance of SRC you can bypass the SRC.

The problem is that it's of course a lot more complicated to decide whether to bind or not. This would not work for e.g. multiple steps of conversions, because at the moment the DPCM driver cannot be informed of possible rate changes.

Also the introduction of the SRC is a nice feature, but who needs it? In practice, sound servers (CRAS, PulseAudio, etc) already resample to a desired rate, so it's not like we can expect tons of different configurations. Specifically the 44.1kHz case is not required, we've lived since 2013 without SRC in the firmware and no one ever complained about the host-based conversion.

And last, SRC takes resources that could be used for other things that have more added value, such as branded processing, speaker amp. SRC is an item on a program manager checklist, its value as part of the firmware is very very questionable with very very limited returned IMHO. I vote that we don't spend too much time on the optimization and just focus on getting SRC to work. It remains to be seen whether this will actually be used in a product.

The original calculation will generate 44 sample size for
44.1khz, actually it at least needs 45 sample size.
This patch uses ceil value for such rate, also inlcude
11.025kh, 22.05kh, 88.2khz, 176.4khz.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Cavs src is different with sof src. It has different uuid
and param which are composed of base module definition and
output rate.

Signed-off-by: Rander Wang <rander.wang@intel.com>
@RanderWang
Copy link
Collaborator Author

updated.
(1) support all the rate from 8k to 192k
(2) add mixer support

Validated on ADL

@RanderWang RanderWang changed the title [RFC] topology2: add src support topology2: add src support Jun 16, 2022
@marc-hb marc-hb removed their request for review June 16, 2022 17:17
@RanderWang
Copy link
Collaborator Author

updated, thanks!

Copy link
Collaborator

@singalsu singalsu left a comment

Choose a reason for hiding this comment

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

Looks OK to me for discussed part: frames count calculation.

This pipeline supports conversion from 8k ~ 192k to 48k.

Signed-off-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Rander Wang <rander.wang@intel.com>
S24LE is the major format used by SOF IPC4 FW and windows platform
and has better perfomance than S32.

Signed-off-by: Rander Wang <rander.wang@intel.com>
@lgirdwood lgirdwood merged commit 773a05a into thesofproject:main Jun 29, 2022
@XiaoyunWu6666
Copy link
Contributor

Hi @RanderWang , this PR seem to cause some error in cavs-mixin-mixout-hda.tplg and cause multiple IPC4 HDA platforms failed to load the tplg correctly.
Do you have any idea? Thanks

@bardliao
Copy link
Collaborator

bardliao commented Jul 1, 2022

Hi @RanderWang , this PR seem to cause some error in cavs-mixin-mixout-hda.tplg and cause multiple IPC4 HDA platforms failed to load the tplg correctly. Do you have any idea? Thanks

@XiaoyunWu6666 Please try #5971

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.

7 participants