-
Notifications
You must be signed in to change notification settings - Fork 349
Tools: Tplg_parser: Fix handling of tokens found count #9538
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
Tools: Tplg_parser: Fix handling of tokens found count #9538
Conversation
This change fixes for testbench support for topologies where widgets have more than one format. Without this change if not all e.g. count = 8 tokens are found but e.g. count = 7 the tokens are applied to the format array but the index (offset) to next format (of num_sets) is not advanced. So the first entry will be written again for all found formats. The found tokens count can be less than 8 if the optional SOF_TKN_CAVS_AUDIO_FORMAT_INPUT_PIN_INDEX or SOF_TKN_CAVS_AUDIO_FORMAT_OUTPUT_PIN_INDEX are not set. As fix the offset should be advanced when one or more of tokens is found from topology. The total is incremented by count for the loop end condition check. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
lgirdwood
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 pls review.
|
|
||
| if (found >= count) { | ||
| total += found; | ||
| if (found > 0) { |
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.
@singalsu why should we care about found at all then? We should just get rid of it altogether no?
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.
Then none of the parsed tokens would be applied (or like now apply them to 1st format entry only). Please try topologies with multiple format PCMs with SOF plugin to see if you have this issue. I'm running topologies sof-hda-benchmark-comp/wordlength.tplg:
Without this I could not load 16 bit topology versions, since the PCM formats are introduced in order s16/s24/s32, so I get only s32 to the formats array. And same with components like SRC with multiple formats, where array of 42 has only 1st set with last format (192 kHz). If I would have pin index tokens set for them then the parsing would work, but they are optional for simple one sink one source components.
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.
Note: I don't use those HDMI pipelines but there's no simple way to get rid of them in these test toplogies based on hda-generic. I can run these in both a real HDA device and with testbench to run both capture and playback (use -p 1,2,3,4 or - p 1,2 for playback or -p 3,4 for capture as currently there is no automatic discovery for pipelines to enable).

This change fixes for testbench support for topologies where widgets have more than one format. Without this change if not all e.g. count = 8 tokens are found but e.g. count = 7 the tokens are applied to the format array but the index (offset) to next format (of num_sets) is not advanced. So the first entry will be written again for all found formats. The found tokens count can be less than 8 if the optional
SOF_TKN_CAVS_AUDIO_FORMAT_INPUT_PIN_INDEX or
SOF_TKN_CAVS_AUDIO_FORMAT_OUTPUT_PIN_INDEX are not set.
As fix the offset should be advanced when one or more of tokens is found from topology. The total is incremented by count for the loop end condition check.