-
Notifications
You must be signed in to change notification settings - Fork 140
Add Base config extension support for processing modules in IPC4 #4160
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
Add Base config extension support for processing modules in IPC4 #4160
Conversation
aa6b856 to
bdb4ab0
Compare
ujfalusi
left a comment
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.
@ranj063, all in all, this looks nice, however I think the pin format in base_cfg_Ext might need a revisit.
Correct me if I'm wrong or blind, but this PR deals with the plain base_cfg_ext setup from topology and does not include the additional blob appending, right?
sound/soc/sof/ipc4-topology.c
Outdated
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 base_cfg_ext can be used to configure the pins of the module, yes. It can configure individual pins selectively.
If the module for example have 4 input and 2 output pins and only input pin 3 and output pin 0 is used, then the base_cfg_ext shall be:
u16 num_sink_pin_fmts = 1;
u16 num_source_pin_fmts = 1;
u8 reserved[12];
struct sof_ipc4_pin_format sink_pin_fmt[1];
struct sof_ipc4_pin_format source_pin_fmt[1];
Despite that the module have altogether 6 pins, the cfg_ext only have format for the two used pins.
By the current implementation, the sink_pin_fmt will contain the format from the base config (common for pin0s) and the format for the source pin would be coming as a individual section from tplg?
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.
@ujfalusi this implementation assumes that the token num_source_pins/num_sink_pins coming from topology is the number of pins that are actually used by the processing module. so if the module supports a max of 4 and 3 input/output pins but only 1 input/output pin is used, the tplg must set the num_source_pins/num_sink_pins to 1/1.
sound/soc/sof/ipc4-topology.c
Outdated
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.
Do we require that all pins must have format specified? If the module have only single src and sink pins then by definition the formats are derived from the common format and there will be no pin format in tplg.
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.
@ujfalusi requiring the parsing of swidget->num_sink_pins + swidget->num_source_pins doesnt mean that we require the tplg to have set all the pin formats. This function will try to find a max of that many pin formats but will not complain if there are less than that. So if a module doesnt use all its pins, the tplg need only have as many pin formats as needed
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.
Confused as well. no idea what the mapping between pins and formats is.
Thats right @ujfalusi. I'll leave the fixes for the blob with the ipc4 abi header to you. |
bdb4ab0 to
04d0658
Compare
plbossart
left a comment
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.
@ranj063 you wanted my review, here goes. I have absolutely zero understanding of all this. The definitions and commit messages are absolutely minimal and need to be revisited.
include/uapi/sound/sof/tokens.h
Outdated
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.
what's the difference between ch_map and ch_cfg?
include/uapi/sound/sof/tokens.h
Outdated
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.
does this mean container size? It's very poorly defined IMHO
include/uapi/sound/sof/tokens.h
Outdated
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.
sampling rate? Unit?
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.
@plbossart all definitions here follow the same format as the input/output audio format defined above. The only reason we need a new token set is because the audio format tokens are meant only for Pin 0. And historically we've never really had units or descriptions in this file. All units, definitions and permissble values are defined in the structure that these tokens are parsed into. For example, struct sof_ipc4_audio_format {}
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.
and what prevents us to add a bit more clarity moving forward? The reason why we didn't have explanations before is that the definitions were self-explanatory, but now they clearly aren't.
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.
in addition, why on earth would we redefine the terms used in the documentation. This is listed as SAMPLING_FREQUENCY.
include/uapi/sound/sof/tokens.h
Outdated
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.
what is a fmt_cfg, givent that we've already listed all possible options for the format?
sound/soc/sof/ipc4-topology.h
Outdated
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' audio format for the pin means there is only ONE format allowed, or that ONE format is required? Super confusing.
sound/soc/sof/ipc4-topology.c
Outdated
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.
I am confused, what would the initialization type from from the topology tokens? Is this not something hard-coded in the module code?
sound/soc/sof/ipc4-topology.h
Outdated
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.
why is this part for the topology definitions?
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.
because we dont have anything to indicate this in the manifest today, It might change tomorrow but until then this needs to come from topology
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.
that's completely broken, I can't sign-off on this. @lgirdwood @mwasko we need clearer definitions on what each module requires, and we need them reported to the kernel. We can't put module-related stuff in the topology, that's just wrong and error prone.
sound/soc/sof/ipc4-topology.c
Outdated
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.
how on earth does this work? there is an unused 'valid bit' definition, and we use this super-complicated macro instead.
This is beyond confusing.
|
@plbossart @ujfalusi We've got fundamental limitations with the way we've defined the audio formats in topology today. We need to reword that part to make it extensible for multiple pins. I am going to convert this PR to a draft until we've fixed that part. |
|
Finally able to verify this kernel patch and topology patch thesofproject/sof#6996 on both TGL and MTL. will re-do the verification after audio formats refining in topology. |
04d0658 to
29d9108
Compare
8ff4ae8 to
ff073ca
Compare
ff073ca to
c889238
Compare
plbossart
left a comment
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.
only 3 comments below, looks mostly good @ranj063
36c264f to
771524d
Compare
plbossart
left a comment
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.
LGTM @ranj063, nice work.
|
SOFCI TEST |
771524d to
19bb952
Compare
Some processing modules need the audio formats for all their input and output pins appended to the base config during module init. So add support for building the base config extension using the available pin formats from topology. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
The copier output pin 0 format is set with module instance initialization, format for additional copier output pin should be set before the pin is used. If a process module is connected to additional copier output pin, the copier output pin format should be set according to the corresponding input pin format of the process module. Signed-off-by: Chao Song <chao.song@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
5f62e81
19bb952 to
5f62e81
Compare
ujfalusi
left a comment
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.
@ranj063, only one question, this looks really good.
| for (i = 0; i < base_cfg_ext->num_input_pin_fmts; i++) { | ||
| struct sof_ipc4_pin_format *pin_format = &base_cfg_ext->pin_formats[i]; | ||
|
|
||
| if (pin_format->pin_index == pin_index) |
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.
I found it not so obvious how it is ensured this does not match output pins. But output pins are always stored after the input pins, so this check is ok.
This PR is a replacement for #4121.