-
Notifications
You must be signed in to change notification settings - Fork 349
src: audio: module_adapter: Do the params config right after init #10094
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
Conversation
|
SOFCI TEST |
kv2019i
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
|
SOFCI TEST |
ad23a94 to
90f94b7
Compare
e6e7b1e to
a658cc1
Compare
src/audio/kpb.c
Outdated
|
|
||
| kpb_set_params(dev, ¶ms); | ||
|
|
||
| ret = kbp_verify_params(dev, ¶ms); |
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.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/audio/kpb.c
Outdated
|
|
||
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
|
@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? |
|
SOFCI TEST |
1c604fa to
5715eff
Compare
|
@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. |
|
SOFCI TEST |
|
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. |
I think this is probably unrelated since this change will impact the initial stream start state transitions, but lets run another round of tests. |
|
SOFCI TEST |
Yeah, I doubt this PR can cause any impact on pause/release. Testing again now |
|
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>
|
@wszypelt looks like the MTL drive was skipped in the QB tests. Would it be possible to trigger it again? |
|
@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. |
|
|
SOFCI TEST |
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this doesn't seem possible any more? It's now allocated in .new()
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.
No it is possible when you restart a stream after a pipeline reset without freeing it
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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
|
@lyakh Are we good to go? Tests seems on par with other PRs now. |
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.