Uh oh!
There was an error while loading. Please reload this page.
src: audio: module_adapter: Do the params config right after init - #10094
Conversation
ranj063
commented
Jul 3, 2025
SOFCI TEST |
kv2019i
left a comment
There was a problem hiding this comment.
A nice improvement, although I'd elaborate what is happening and why more in the code comment. After all, the documentation for "params()" op is:
» * Sets component audio stream parameters. » * @param dev Component device. » * @param params Audio (PCM) stream parameters to be set. What module_adapter does here when built for IPC4, is quite a different thing.
| #if CONFIG_IPC_MAJOR_4 | ||
| struct sof_ipc_stream_params params = {{ 0 }}; | ||
| /* set the stream params based on the module base cfg */ |
There was a problem hiding this comment.
This is quite whacky looking code to pass a NULL params struct. I would add even more explanation to explain that in IPC3, params is used, but in IPC4 is not used, but instead it will be filled from basecfg.
There was a problem hiding this comment.
@kv2019i@ranj063 well, not sure if it's important or intentional, but it isn't the same as what is done now. Now these parameters are initialised to 0 only once for the entire pipeline. So when traversing the pipeline in ipc4_comp_params() if the first component sets some values in it, the next component will get those values. Let me "request changes" for this PR for now to make sure we think this through
There was a problem hiding this comment.
@lyakh I thought about this as well but even if it is initialized only once, we should be overwriting the params based on the current module's base_cfg. So in theory this should be do the same thing as before. But of course some of the alsabat tests as failing so I am not entirely sure if we're missing something
There was a problem hiding this comment.
but looking more closely at module_adapter_params(), what I may be missing is the fact that the buffer parameters are updated in comp_verify_params() and this will not happen with my PR because the components may not be connected at this point. I'll look into it
There was a problem hiding this comment.
@lyakh have a look at the updated PR now. I think Ive fixed the issue with missing comp_verify_params(). I've got almost all platforms passing except for LNL HDA(which doesnt seem like an issue with my PR)
There was a problem hiding this comment.
of course the QB tests as failing. @lgirdwood who can help me with that? I cant even access the link
| #if CONFIG_IPC_MAJOR_4 | ||
| struct sof_ipc_stream_params params = {{ 0 }}; | ||
| /* set the stream params based on the module base cfg */ |
There was a problem hiding this comment.
@kv2019i@ranj063 well, not sure if it's important or intentional, but it isn't the same as what is done now. Now these parameters are initialised to 0 only once for the entire pipeline. So when traversing the pipeline in ipc4_comp_params() if the first component sets some values in it, the next component will get those values. Let me "request changes" for this PR for now to make sure we think this through
ranj063
commented
Jul 7, 2025
SOFCI TEST |
ad23a94 to
90f94b7CompareUh oh!
There was an error while loading. Please reload this page.
e6e7b1e to
a658cc1Compare| kpb_set_params(dev, ¶ms); | ||
| ret = kbp_verify_params(dev, ¶ms); |
There was a problem hiding this comment.
the naming of both of these functions isn't very... intuitive. AFAICS kpb_set_params() actually doesn't set parameters but rather gets them instead. I.e. it retrieves current KPB parameters into a user-provided structure. Then it isn't very clear why kbp_verify_params() is called - if you've just obtained parameters from a device, they should be valid, right? But also instead of just verifying parameters, which sounds like a read-only operation, kbp_verify_params() and the underlying comp_verify_params() can update parameters and also use them to configure audio buffers... Maybe we need at least some comments here and eventually also in the implementation.
| struct sof_ipc_stream_params params; | ||
| /* | ||
| * set the stream params based on the module base cfg. There's no need to initialize |
There was a problem hiding this comment.
I think usually when we say, that a function "sets parameters," we mean, that we pass parameters to a function which are then used internally by that function for some configuration. While here as well as in kpb_set_params() above we retrieve parameters.
| ret = kbp_verify_params(dev, ¶ms); | ||
| if (ret < 0) { | ||
| comp_err(dev, "kpb_prepare: pcm params verification failed"); |
There was a problem hiding this comment.
I'd propose not to use function names at least in new logging prints - even if they're otherwise used throughout the code. But in fact see comp_cl_err() call 6 lines down - it has no function name in it. Zephyr adds function names by itself. I'd also not use function names in added prints below - in module_adapter.c etc., even if so far they're used there.
| comp_dbg(dev, "module_adapter_prepare() start"); | ||
| #if CONFIG_IPC_MAJOR_4 | ||
| /* verify params */ |
There was a problem hiding this comment.
I think comments should add information, not obvious from the code, and a comment like this above a call to comp_verify_params() doesn't seem to add a lot of information. Instead maybe clarify that that function not only verifies parameters, but does more as discussed above
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
lyakh
commented
Jul 14, 2025
@ranj063 also, if you update this PR - the subject "src: audio:..." confused me at first - I thought it was related to the SRC component :-) I think in SOF we don't quote the full path to the affected sources in the patch subject line, at least I don't think we usually put the "src" part there. Beginning with "audio:..." should be enough? |
ranj063
commented
Jul 15, 2025
SOFCI TEST |
1c604fa to
5715effCompareranj063
commented
Jul 16, 2025
@lyakh Ive addressed your comments now. Let me know how it looks. I do not like the naming of the function comp_veryify_params() or kpb_verify_params. I am going to do a follow up PR to remove this function anyway to do the params update during binding. |
ranj063
commented
Jul 16, 2025
SOFCI TEST |
lyakh
commented
Jul 16, 2025
ouch - IPC timeout on PTL https://sof-ci.01.org/sofpr/PR10094/build13984/devicetest/index.html?model=PTLH_RVP_NOCODEC&testcase=multiple-pause-resume-50 - that isn't good. Now it isn't obvious that it's this PR that does that, we have observed "somewhat similar" problems recently #10116 but no IPC timeouts on PTL until now... So it might or might not be this PR. Let's put a DNM here for a bit. |
lgirdwood
commented
Jul 16, 2025
I think this is probably unrelated since this change will impact the initial stream start state transitions, but lets run another round of tests. |
lgirdwood
commented
Jul 16, 2025
SOFCI TEST |
ranj063
commented
Jul 16, 2025
Yeah, I doubt this PR can cause any impact on pause/release. Testing again now |
ranj063
commented
Jul 16, 2025
SOFCI TEST |
The module_adapter_params() functions set the stream params based on the base config for each module which is available right after module init. So configure the params for IPC4 during module_new() and remove the call to ipc4_pipeline_params(). In order to update the buffer params, add a call to comp_verify_params() during module_adapter_prepare in order to update the intermediate buffers. This should help reduce the time to trigger pipelines during start. Add the params handling for the KPB and detect_test modules explicitly because they don't use the module adapter. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
ranj063
commented
Jul 17, 2025
@wszypelt looks like the MTL drive was skipped in the QB tests. Would it be possible to trigger it again? |
lyakh
commented
Jul 17, 2025
@lgirdwood@ranj063 looks like since yesterday this PR ran through the CI up to 4 times: twice triggered by a git push and twice by the "magic keyword" comment. There are no multiple-pause-resume failures in the last round, but the one before the last again had IPC timeout on PTL in the same test. We currently have failures in that test on multiple platforms #10116 but none of those had IPC timeouts. I also can easily reproduce those failures without IPC timeouts on a test MTL system. I'll try to dig some more into this today and possibly tomorrow, let's decide then. |
ranj063
commented
Jul 17, 2025
|
ranj063
commented
Jul 17, 2025
SOFCI TEST |
lyakh
commented
Jul 18, 2025
update: I cannot really reproduce them, those were a different kind of failure |
| * retrieve the params from the basecfg, allocate stream_params and then update the | ||
| * sink/source buffer params. | ||
| */ | ||
| if (!mod->stream_params) { |
There was a problem hiding this comment.
this doesn't seem possible any more? It's now allocated in .new()
There was a problem hiding this comment.
No it is possible when you restart a stream after a pipeline reset without freeing it
There was a problem hiding this comment.
@ranj063 interesting. Could you explain a bit more just for my understanding - "restart" a stream - you don't mean stop -> start, just a reset, right? But when do such "resets" happen apart from when stopping streams?
There was a problem hiding this comment.
@lyakh it never happens in our tests. But there's a QB test that does this sequence (it called randomDMAtest or something like that). I added this specifically to make that test pass:
set up pipelines -> start pipelines -> stop pipelines - >reset pipelines -> Put the DSP in D3 -> exit D3 -> prepare & restart pipelines -> stop pipelines -> reset pipelines -> free pipelines
kv2019i
commented
Jul 28, 2025
@lyakh Are we good to go? Tests seems on par with other PRs now. |
Uh oh!
There was an error while loading. Please reload this page.
The module_adapter_params() functions set the stream params based on the base config for each module which is available right after module init. So configure the params for IPC4 during module_new() and remove the call to ipc4_pipeline_params(). This should help with reducing the time to trigger pipelines during start.