Skip to content

Conversation

@ranj063
Copy link
Collaborator

@ranj063 ranj063 commented Jan 28, 2023

This PR is a replacement for #4121.

Copy link
Collaborator

@ujfalusi ujfalusi left a 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?

Copy link
Collaborator

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?

Copy link
Collaborator Author

@ranj063 ranj063 Jan 30, 2023

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.

Copy link
Collaborator

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.

Copy link
Collaborator Author

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

Copy link
Member

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.

@ranj063
Copy link
Collaborator Author

ranj063 commented Jan 30, 2023

@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?

Thats right @ujfalusi. I'll leave the fixes for the blob with the ipc4 abi header to you.

@ranj063 ranj063 force-pushed the fix/module_base_cfg_xtn branch from bdb4ab0 to 04d0658 Compare January 30, 2023 17:02
Copy link
Member

@plbossart plbossart left a 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.

Copy link
Member

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?

Copy link
Member

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

Copy link
Member

Choose a reason for hiding this comment

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

sampling rate? Unit?

Copy link
Collaborator Author

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 {}

Copy link
Member

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.

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

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?

Copy link
Collaborator Author

@ranj063 ranj063 Jan 30, 2023

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

Copy link
Member

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.

Copy link
Member

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.

@ranj063
Copy link
Collaborator Author

ranj063 commented Jan 30, 2023

@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.

@ranj063 ranj063 marked this pull request as draft January 30, 2023 20:52
@aiChaoSONG
Copy link

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.

@ranj063 ranj063 force-pushed the fix/module_base_cfg_xtn branch from 04d0658 to 29d9108 Compare February 3, 2023 06:05
@ranj063 ranj063 changed the title Extend processing module init payload options Add Base config extension support for processing modules in IPC4 Feb 3, 2023
@ranj063 ranj063 force-pushed the fix/module_base_cfg_xtn branch 2 times, most recently from 8ff4ae8 to ff073ca Compare February 8, 2023 01:56
@lgirdwood lgirdwood added the P2 Critical bugs or normal features label Feb 8, 2023
@ranj063 ranj063 marked this pull request as ready for review February 8, 2023 15:45
@ranj063 ranj063 force-pushed the fix/module_base_cfg_xtn branch from ff073ca to c889238 Compare February 8, 2023 15:45
Copy link
Member

@plbossart plbossart left a 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

@ranj063 ranj063 force-pushed the fix/module_base_cfg_xtn branch from 36c264f to 771524d Compare February 8, 2023 19:51
plbossart
plbossart previously approved these changes Feb 8, 2023
Copy link
Member

@plbossart plbossart left a 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.

@greg-intel
Copy link

SOFCI TEST

bardliao
bardliao previously approved these changes Feb 9, 2023
plbossart
plbossart previously approved these changes Feb 9, 2023
aiChaoSONG
aiChaoSONG previously approved these changes Feb 9, 2023
ranj063 and others added 2 commits February 9, 2023 01:11
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>
@ranj063 ranj063 dismissed stale reviews from aiChaoSONG, plbossart, and bardliao via 5f62e81 February 9, 2023 09:11
@ranj063 ranj063 force-pushed the fix/module_base_cfg_xtn branch from 19bb952 to 5f62e81 Compare February 9, 2023 09:11
Copy link
Collaborator

@ujfalusi ujfalusi left a 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)
Copy link
Collaborator

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.

@plbossart plbossart merged commit eadc01d into thesofproject:topic/sof-dev Feb 9, 2023
@ranj063 ranj063 deleted the fix/module_base_cfg_xtn branch February 9, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P1 Blocker bugs or important features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants