Skip to content

tplgtool2.py: show PCM names on graph output - #1054

Merged
marc-hb merged 3 commits into
thesofproject:mainfrom
marc-hb:PCM-names
Jul 7, 2023
Merged

marc-hb merged 3 commits into
thesofproject:mainfrom
marc-hb:PCM-names

Conversation

@marc-hb

@marc-hb marc-hb commented Jun 9, 2023

Copy link
Copy Markdown
Collaborator

No description provided.

Fixed a quadruple """" that broke the parser in some editors.  Minor
rewording.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb

marc-hb commented Jun 9, 2023 •

Copy link
Copy Markdown
Collaborator Author

Seems to work great... for topology1. There's no "PCMxP" in topology2. EDIT: hopefully fixed now, parsing host-copier.N

https://sof-ci.01.org/softestpr/PR1054/build417/devicetest/index.html

topo1 with PCM name

@marc-hb
marc-hb marked this pull request as ready for review June 10, 2023 00:23
@marc-hb
marc-hb requested a review from a team as a code owner June 10, 2023 00:23
@marc-hb

marc-hb commented Jun 10, 2023 •

Copy link
Copy Markdown
Collaborator Author

Besides host.copier.7.capture having no corresponding PCM in https://sof-ci.01.org/softestpr/PR1054/build420/devicetest/index.html?model=TGLU_RVP_NOCODEC_IPC4ZPH&testcase=verify-sof-firmware-load and in some MTL devices, the graphs looks much better with PCM names.

In any case it seems a bit weird to have to parse the widget name... is there no simpler widget->pcm connection in the topology?

EDIT: not really, see https://github.com/thesofproject/linux/blob/2776754a4cd984a390a17a0c96635beb2ad408d8/sound/soc/sof/topology.c#L1148

@marc-hb
marc-hb requested review from kv2019i and plbossart June 10, 2023 04:38
RanderWang
RanderWang previously approved these changes Jun 12, 2023

@RanderWang RanderWang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

Comment thread tools/tplgtool2.py
assert n_l <= 1, f"Unexpected number of PCMs matching pcm_id={pcm_id}: {n_l} ({pcm_names})"

return pcm_names[0] if n_l == 1 else f"No PCM with ID={pcm_id}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

IIRC @ranj063 already did some changes in the topology2 naming, not sure if these changes are based on top of the topology2 changes?

In addition, while the name of the PCM device is nice, the PCM device number is the most useful for testing. How difficult would it be to add the hw: ID?

@marc-hb marc-hb Jun 12, 2023 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

IIRC @ranj063 already did some changes in the topology2 naming, not sure if these changes are based on top of the topology2 changes?

Are these changes merged yet? In which git repo?

This is sof-test: it's a different git repo so the tests are running with the latest of everything that was merged. I think. EDIT: as a sheer coincidence just discovered sof-test is tested with yesterday's SOF.

How difficult would it be to add the hw: ID?

Isn't that the pcm_id I'm matching against? If not then what is it? @ranj063 can you help explain? I'm a total topology noob sorry, just trying stuff and marvelling at how lucky I am to make the graphs look so much better with so little Python code.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

IIRC @ranj063 already did some changes in the topology2 naming, not sure if these changes are based on top of the topology2 changes?

In addition, while the name of the PCM device is nice, the PCM device number is the most useful for testing. How difficult would it be to add the hw: ID?

@plbossart I think this is a good change on top of what I did with the naming. With a name like host-copier.1.playback you've already got the PCM ID i.e. 1 and this adds the name of the PCM next to it

@marc-hb
marc-hb marked this pull request as draft June 12, 2023 19:15
@marc-hb
marc-hb requested a review from juimonen June 12, 2023 20:48
@marc-hb
marc-hb marked this pull request as ready for review June 13, 2023 17:22
@ranj063

ranj063 commented Jun 15, 2023

Copy link
Copy Markdown
Contributor

Besides host.copier.7.capture having no corresponding PCM in https://sof-ci.01.org/softestpr/PR1054/build420/devicetest/index.html?model=TGLU_RVP_NOCODEC_IPC4ZPH&testcase=verify-sof-firmware-load and in some MTL devices, the graphs looks much better with PCM names.

In any case it seems a bit weird to have to parse the widget name... is there no simpler widget->pcm connection in the topology?

fixed now with thesofproject/sof#7747

ranj063
ranj063 previously approved these changes Jun 15, 2023
@marc-hb
marc-hb marked this pull request as draft June 15, 2023 21:52
Comment thread tools/tplgtool2.py Outdated
if match is None:
# Don't crash the entire program when passed a wrong input;
# put an error message in the graph instead.
return f'No PCM or host-copier number found in "{wname}"'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

From @ranj063 : this is a topology error, make it a hard fail.

plbossart
plbossart previously approved these changes Jun 16, 2023
@marc-hb

marc-hb commented Jul 6, 2023 •

Copy link
Copy Markdown
Collaborator Author

I started running the new version manually on all .tplg files and I'm finding new errors:

topology/topology1/production/sof-tgl-nocodec.tplg
topology/topology1/production/sof-adl-nocodec.tplg
etc.

pcm=Port0;id=0;type=duplex;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=Port1;id=1;type=duplex;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=Port2;id=2;type=duplex;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=DMIC;id=10;type=capture;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;
pcm=DMIC16kHz;id=11;type=capture;fmt=S16_LE;rate_min=16000;rate_max=16000;ch_min=4;ch_max=4;

AssertionError: Zero PCM with ID=3 found for widget=PCM3P

Also affects apl-nocodec in
https://sof-ci.01.org/softestpr/PR1054/build565/devicetest/index.html?model=APL_UP2_NOCODEC&testcase=verify-tplg-binary

pcm=DMIC;id=10;type=capture;cap_name=Highpass Capture 10;eq=EQIIR20.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;rate=48000;channel=4;dev=hw:0,10;snd=/dev/snd/pcmC0D10c;
pcm=DMIC16kHz;id=11;type=capture;cap_name=Highpass Capture 11;eq=EQIIR21.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=16000;rate_max=16000;ch_min=4;ch_max=4;rate=16000;channel=4;dev=hw:0,11;snd=/dev/snd/pcmC0D11c;
pcm=Port5;id=2;type=playback;cap_name=Playback 2;pga=PGA9.0 PGA5.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;rate=48000;channel=2;dev=hw:0,2;snd=/dev/snd/pcmC0D2p;
pcm=Port5;id=2;type=capture;cap_name=Passthrough Capture 2;pga=PGA6.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;rate=48000;channel=2;dev=hw:0,2;snd=/dev/snd/pcmC0D2c;
pcm=Port5 Deep Buffer;id=3;type=playback;cap_name=Playback 3;pga=PGA11.0 PGA5.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;rate=48000;channel=2;dev=hw:0,3;snd=/dev/snd/pcmC0D3p;


topology/topology1/production/sof-ehl-rt5660-nohdmi.tplg --- 

pcm=Headset;id=0;type=duplex;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=DMIC;id=1;type=capture;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;
pcm=DMIC16kHz;id=2;type=capture;fmt=S16_LE;rate_min=16000;rate_max=16000;ch_min=2;ch_max=2;

AssertionError: Zero PCM with ID=3 found for widget=PCM3C

EDIT: the assert interruption was the most likely reason why the graph below was incomplete. Ignore this graph!

sof-adl-nocodec

Weird: without interruption: https://sof-ci.01.org/softestpr/PR1075/build549/devicetest/index.html?model=APL_UP2_NOCODEC&testcase=verify-tplg-binary

pcm=DMIC;id=10;type=capture;cap_name=Highpass Capture 10;eq=EQIIR20.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;rate=48000;channel=4;dev=hw:0,10;snd=/dev/snd/pcmC0D10c;
pcm=DMIC16kHz;id=11;type=capture;cap_name=Highpass Capture 11;eq=EQIIR21.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=16000;rate_max=16000;ch_min=4;ch_max=4;rate=16000;channel=4;dev=hw:0,11;snd=/dev/snd/pcmC0D11c;
pcm=Port5;id=2;type=playback;cap_name=Playback 2;pga=PGA9.0 PGA5.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;rate=48000;channel=2;dev=hw:0,2;snd=/dev/snd/pcmC0D2p;
pcm=Port5;id=2;type=capture;cap_name=Passthrough Capture 2;pga=PGA6.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;rate=48000;channel=2;dev=hw:0,2;snd=/dev/snd/pcmC0D2c;
pcm=Port5 Deep Buffer;id=3;type=playback;cap_name=Playback 3;pga=PGA11.0 PGA5.0;fmts=S16_LE S24_LE S32_LE;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;rate=48000;channel=2;dev=hw:0,3;snd=/dev/snd/pcmC0D3p;
Screenshot 2023-07-06 at 10 25 37

@marc-hb

marc-hb commented Jul 6, 2023

Copy link
Copy Markdown
Collaborator Author
topology/topology2/sof-ace-tplg/sof-mtl-max98357a-rt5682.tplg

pcm=EchoRef;id=27;type=capture;fmt=S16_LE;rate_min=48000;rate_max=48000;ch_min=2;ch_max=2;
pcm=DMIC0 RTC AEC;id=27;type=capture;fmt=S32_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;
pcm=DMIC0 RTC AEC NS;id=28;type=capture;fmt=S32_LE;rate_min=48000;rate_max=48000;ch_min=4;ch_max=4;


AssertionError: More than one PCM has pcm_id=27: 2 (['EchoRef', 'DMIC0 RTC AEC'])

@marc-hb
marc-hb marked this pull request as ready for review July 6, 2023 02:45
RanderWang
RanderWang previously approved these changes Jul 6, 2023

@RanderWang RanderWang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

marc-hb added 2 commits July 6, 2023 18:29
The guessing can stop.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
The graph is still produced but now there's something that can be used
for testing.

Signed-off-by: Marc Herbert <marc.herbert@intel.com>
@marc-hb

marc-hb commented Jul 6, 2023 •

Copy link
Copy Markdown
Collaborator Author

graph still missing in https://sof-ci.01.org/softestpr/PR1054/build568/devicetest/index.html?model=APL_UP2_NOCODEC&testcase=verify-tplg-binary, DUT-env.py in the CI framework assumes there's no output in case of error. Working on that.

@marc-hb

This comment was marked as outdated.

@marc-hb

This comment was marked as outdated.

@marc-hb

marc-hb commented Jul 6, 2023 •

Copy link
Copy Markdown
Collaborator Author

SOFCI TEST

EDIT: https://sof-ci.01.org/softestpr/PR1054/build576/devicetest/index.html shows the APL_UP_NOCODEC graph with the missing pcm_id

@marc-hb

marc-hb commented Jul 7, 2023 •

Copy link
Copy Markdown
Collaborator Author

For a while I naively thought I could quickly fix the problematic topologies above - and then merge this. I have neither enough time nor knowledge for that. So the most recent and... perfect-at-last revision does a "soft fail": it still produces the graph even when a PCM id is not found. That's what it used to do before this PR and graph is probably useful for troubleshooting anyway so I think it's the best design after all. An error message is printed on stdout and placed in the graph too, see example in https://sof-ci.01.org/softestpr/PR1054/build576/devicetest/index.html?model=APL_UP2_NOCODEC&testcase=verify-tplg-binary

There's also a non-zero exit status.

MTL https://sof-ci.01.org/softestpr/PR1054/build577/devicetest/index.html and stable-v2.2 have the small and usual amount of suspend/resume failures; nothing else

https://sof-ci.01.org/softestpr/PR1054/build575/devicetest/index.html?model=TGLU_RVP_SDW_IPC4ZPH&testcase=multiple-pause-resume-5 is known. Everything else green there.

@RanderWang RanderWang left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@marc-hb

marc-hb commented Jul 7, 2023

Copy link
Copy Markdown
Collaborator Author

thanks @RanderWang for your patience through the error-handling back and forth!

@marc-hb
marc-hb merged commit eb9755e into thesofproject:main Jul 7, 2023
@marc-hb
marc-hb deleted the PCM-names branch July 7, 2023 14:40
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.

4 participants