You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG] [TGL] [tgl-012-drop-stable] Wrong source/sink settings during ALSA conformance test #3966
Brief: When doing ALSA test for SOF built sound-open-firmware-private branch, codec_adapter receives wrong source/sink parameters.
Environment:
TGL + tgl-012-drop-stable + WAVES
Detailed:
Usual way of doing alsa conformance test is running python script: ./alsa_conformance_test.py -D hw:0,0 --rate-err-criteria 100 --log-file alsa_test_log.txt
Output of this command is attached: alsa_test_output_.txt.
From alsa_test_log.txt is is clear what sequence of executions of alsa_conformance_test performs python script.
Also it is clear that test snd_pcm_hw_params fails when setting sample format S24_LE and S32_LE, but is passing on S16_LE.
if executing same sequence of calls that python script does, but with 5 seconds time gap between them, there is no smd-pcm-hw-params error.
So this means when they are executed rapidly one after anothe, something changes.
building debug SOF with logs shows exactly the issue, sink and source buffers that arrive to codec_adapter have different format which is not expected.
alsa_conformance_test -P hw:0,0 -d 0.1 -r 48000 -c 2 -f S16_LE -p 240
source and sink are 16 bit
alsa_conformance_test -P hw:0,0 -d 0.1 -r 48000 -c 2 -f S24_LE -p 240
source is 16 bit and sink is 24 bit
alsa_conformance_test -P hw:0,0 -d 0.1 -r 48000 -c 2 -f S32_LE -p 240
source is 16 bit and sink is 32 bit
this looks like a bug, no matter the time difference between alsa_conformance_tests execution, result should be the same, as do the stream parameters that comes to codec_adapter. alsa_test_log.txt alsa_test_output.txt
Hi @RDharageswari do you know where do the source and sink format come from?
Since it works if start test with waiting more than 5 seconds, it looks to me the the previous playback doesn't stop/reset correctly and the subsequent playback in different format failed at .hw_params().
@RDharageswari can you share the FW SOF log at the failed case?
Following is the update from waves:
This issue is not 100% reproduction rate.
Got sometimes same sink and source format when running alsa test.
Adding logs to volume component didn`t help much because volume is below stream with respect to codec adapter, and after codec adapter failed no logs from Volume
After codec-adapter is removed from topology volume component receives both sink and source buffers with the same format sof-log.txt dmesg-log.txt
so this topology is defining a format range for the pcm like from 16 bit LE to 32 bit LE. So alsa conformance test is testing that it supports all these formats. If there is no any other component before the codec adapter that will do the conversion, the codec adapter needs to accept different formats.
@stolx usually the input format come from the ALSA PCM param while the output format could inherit from the BE DAI so they can be different, you need to check if you have made the BE DAI in your tplg file fixed, if so, you might need to add a format converter (e.g. volume) around your codec component.
I dont think so since this fails before we get to playback stage. But I think I have an idea what might be happening here. I have two possible theories. Unfortunately the author of the idc module is no longer around to answer.
my theories
Caches not being invalidated when handling params. Looking through the code I don't see any cache coherency when running params callbacks. Given it looks like params are inferred from buffers this seems like a possible problem.
idc sync on params order. I have to run more tests on this one, but if idc is not blocking downstream components from running their callback till upstream components on separate cores are done then they will pull bad params from the buffer.
From what I have seen, changing a whole pipeline removes the above issues which would align with the nature of the bugs. Still need to do more testing on the whole pipeline change though.
In my testing so far this has been good, i think its safe to close unless we see it pop up again, but i think it might be worth adding single core components into the testing pipeline to detect this in CI in the future
Activity
keyonjie commentedon Mar 29, 2021
Hi @RDharageswari do you know where do the source and sink format come from?
Since it works if start test with waiting more than 5 seconds, it looks to me the the previous playback doesn't stop/reset correctly and the subsequent playback in different format failed at .hw_params().
@RDharageswari can you share the FW SOF log at the failed case?
RDharageswari commentedon Mar 29, 2021
Following is the update from waves:
This issue is not 100% reproduction rate.
Got sometimes same sink and source format when running alsa test.
Adding logs to volume component didn`t help much because volume is below stream with respect to codec adapter, and after codec adapter failed no logs from Volume
After codec-adapter is removed from topology volume component receives both sink and source buffers with the same format
sof-log.txt
dmesg-log.txt
RDharageswari commentedon Mar 29, 2021
0001-WIP-Log-volume-source-and-sink-format.patch.txt
RDharageswari commentedon Mar 30, 2021
Feedback from waves is that the issue is still reproducible with the above patch
keyonjie commentedon Mar 30, 2021
Hi @RDharageswari someone should be able to debug this as the error is already in the FW logs:
slawblauciak commentedon Mar 30, 2021
@stolx hi, could you please help to figure this one out if it's an issue with the Waves module?
juimonen commentedon Mar 30, 2021
so this topology is defining a format range for the pcm like from 16 bit LE to 32 bit LE. So alsa conformance test is testing that it supports all these formats. If there is no any other component before the codec adapter that will do the conversion, the codec adapter needs to accept different formats.
stolx commentedon Mar 30, 2021
@slawblauciak @juimonen
Waves codec implementation supports all sample formats of SOF 16, 24_4LE and 32.
But we expect the source and sink to have the same format.
The issue is that sometimes during ALSA test we get sink and source of different format and check in our codec_adapter API implementation fails.
The exact place of the check:
https://github.com/thesofproject/sof/blob/main/src/audio/codec_adapter/codec/waves.c#L239
So this bug is actually two independent questions:
keyonjie commentedon Mar 30, 2021
@stolx usually the input format come from the ALSA PCM param while the output format could inherit from the BE DAI so they can be different, you need to check if you have made the BE DAI in your tplg file fixed, if so, you might need to add a format converter (e.g. volume) around your codec component.
11 remaining items
lgirdwood commentedon May 10, 2021
Could this also be linked to #4104
cujomalainey commentedon May 12, 2021
I dont think so since this fails before we get to playback stage. But I think I have an idea what might be happening here. I have two possible theories. Unfortunately the author of the
idcmodule is no longer around to answer.my theories
From what I have seen, changing a whole pipeline removes the above issues which would align with the nature of the bugs. Still need to do more testing on the whole pipeline change though.
lgirdwood commentedon May 20, 2021
@slawblauciak @mwasko fyi - lets get in for rc3 and TGL13 once @mrajwa is back from vacation.
lgirdwood commentedon May 27, 2021
@dbaluta @mrajwa @mwasko @RDharageswari any update here ? Have we solved this in TGL13 or in main ?
keyonjie commentedon Jun 2, 2021
@dbaluta can you re-test this with tgl-013-drop-stable branch?
cujomalainey commentedon Jun 2, 2021
@stolx FYI
keyonjie commentedon Jun 4, 2021
@stolx @RDharageswari please hep to re-try as we don't have a way to reproduce it.
cujomalainey commentedon Jun 4, 2021
I can try either today or monday hopefully
cujomalainey commentedon Jun 8, 2021
forgot to write here as well my results, initial tests look promising
keyonjie commentedon Jun 8, 2021
Thanks for the feedback, waiting for your final result.
keyonjie commentedon Jun 11, 2021
@cujomalainey please help to close it if it doesn't reproduce with tgl-013-drop-stable.
cujomalainey commentedon Jun 11, 2021
In my testing so far this has been good, i think its safe to close unless we see it pop up again, but i think it might be worth adding single core components into the testing pipeline to detect this in CI in the future
keyonjie commentedon Jun 11, 2021
Thanks @cujomalainey , yes component level multi-core will be next declared support, maybe delivered with Zephyr together.