Tools: Tplg_parser: Fix handling of tokens found count#9538
Tools: Tplg_parser: Fix handling of tokens found count#9538lgirdwood merged 1 commit intothesofproject:mainfrom
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>
|
|
||
| if (found >= count) { | ||
| total += found; | ||
| if (found > 0) { |
There was a problem hiding this comment.
@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.
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.
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.