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
[FEATURE] Improve parameter refinement within pipelines. #1280
Is your feature request related to a problem? Please describe.
Host drivers and userspace will pass PCM rates, formats and channels to the DSP when opening a stream. This currently require topology to match the DAI configuration to the userspace configuration and does not give much scope for refinement within the pipeline.
Describe the solution you'd like
We currently define pipelines that can accept a range of runtime params (like rate, channels, format) via the host component (as this component has the 1:1 driver connection). We do need to pass these params and any modifications (that components make) downstream from source to sink. i.e. this can be done by walking the graph in 3 passes
check the connected DAI for multiple configs and match to any hw_params.
Walk from DAI to all other endpoints setting component params to match hard coded DAI params.
At this point each component has a copy of the DAI params locally for each of it sources and sinks.
Walk from host to all other endpoints and refine the params from the host sink/source to the DAI params.
Additional context - Examples
host (44.1kHz) -> volume -> DAI (48kHz)
Passes 1& 2 for the above pipeline would populate all the components (except host) with 48kHz rate.
Pass 3 would try and see where this rate could be converted from 44.1kHz to 48 kHz. i.e it would set volume to 44.1kHz but would ultimately fail as there would be no way to change the DAI to 44.1kHz.
host (16bit) -> volume -> DAI (24bit)
The same pipeline, but this time refining the format. Passes 1 & 2 sets all formats to 24 bit (except host).
Pass 3 Sets volume to 24 bit (which succeeds as volume can convert 16 -> 24bit).
The same algorithm would also be applicable to larger pipelines with multiple differences between host and DAI. They key thing is that topology permits the different params to allow the refinement within the pipeline.
@michalgrodzicki@wenqingfu Fyi, this needs to be implemented soon as it's the basis for many complex use cases. I'm not seeing any movement on this, but do see developers raising issues that can be fixed by this.
@lgirdwood@akloniex@keyonjie@juimonen
I don't see how it handles the logic of choosing if we should propagate the params to the connected pipelines or not. Let's take mux topology with the loopback capture pipeline connected to the playback pipe. We don't want to pass playback stream params to the capture pipeline, because directions are different. Now let's take mixer topology. We want to pass params to the mixer pipeline, because otherwise it will stay unconfigured. I know that we could probably insert additional logic into these components, but for me it doesn't look flexible enough.
playback loopback PCM to capture PCM example is first user sets the pipe params. i.e. if capture params come first then they are immutable in the pipeline until capture is closed. i.e. params can be locked based on pipe usage count.
mixer does not change any params. Rules are same as 1. If two PCMs are connected to a mixer, then params are immutable after the first PCM has configured them. The second PCM has to use the same params (unless there is a conversion component) otherwise it params will fail.
The key thing here is to keep a set of simple and consistent rules that can be easily applied to any use case and provide immediate feedback to userspace. I'm going to review the pipeline rules next week, I want to avoid adding numerous rules that apply to only certain components. I will detail them in a PR.
@tlauda I might be understanding it wrong, but as I see it, the propagation of parameters to connected pipelines is not our problem. Problem is when to schedule those pipelines. Now with mixer we have "overlapping" scheduling, so depending on pcm we might need to schedule whole pipeline or parts of 2 pipelines. Now despite how we define or chop our pipelines, someone still needs to decide which parts or which pipelines to run?
@juimonen Currently scheduling is the least of our worries. Current logic will work correctly as long as there won't be any complicated cases. Mixer pipeline will be the one driving the scheduling of connected host pipelines, so it should be started along with the first started connected host stream. The problem is who should decide when to run mixer pipeline:
Host by explicitly sending ipc along with the first host ppl (granted that it will be separated from host ppl).
Host by explicitly sending ipc right after creation (granted that mixer will be producing zeroes if no source is connected).
FW by propagating trigger start when first host ppl is started (current implementation).
@lgirdwood@singalsu This is a complex item that AFAIK is solve for most part (at least the original problem). Now with IPC4 work, we are covering these same cases as well. I'll bump this to v2.6 milestone, but potentially this could be closed.
Activity
lgirdwood commentedon Apr 18, 2019
@mengdonglin @michalgrodzicki this is P1 for SOF v1.4. @tlauda fyi, this should make sure all params will be set correctly or fail gracefully.
lgirdwood commentedon Apr 18, 2019
@singalsu @keyonjie fyi.
lgirdwood commentedon Apr 18, 2019
Changes required at buffer/component level are
lgirdwood commentedon May 9, 2019
@michalgrodzicki @wenqingfu Fyi, this needs to be implemented soon as it's the basis for many complex use cases. I'm not seeing any movement on this, but do see developers raising issues that can be fixed by this.
tlauda commentedon May 9, 2019
@lgirdwood @akloniex @keyonjie @juimonen
I don't see how it handles the logic of choosing if we should propagate the params to the connected pipelines or not. Let's take mux topology with the loopback capture pipeline connected to the playback pipe. We don't want to pass playback stream params to the capture pipeline, because directions are different. Now let's take mixer topology. We want to pass params to the mixer pipeline, because otherwise it will stay unconfigured. I know that we could probably insert additional logic into these components, but for me it doesn't look flexible enough.
lgirdwood commentedon May 9, 2019
@tlauda
The key thing here is to keep a set of simple and consistent rules that can be easily applied to any use case and provide immediate feedback to userspace. I'm going to review the pipeline rules next week, I want to avoid adding numerous rules that apply to only certain components. I will detail them in a PR.
juimonen commentedon May 13, 2019
@tlauda I might be understanding it wrong, but as I see it, the propagation of parameters to connected pipelines is not our problem. Problem is when to schedule those pipelines. Now with mixer we have "overlapping" scheduling, so depending on pcm we might need to schedule whole pipeline or parts of 2 pipelines. Now despite how we define or chop our pipelines, someone still needs to decide which parts or which pipelines to run?
tlauda commentedon May 13, 2019
@juimonen Currently scheduling is the least of our worries. Current logic will work correctly as long as there won't be any complicated cases. Mixer pipeline will be the one driving the scheduling of connected host pipelines, so it should be started along with the first started connected host stream. The problem is who should decide when to run mixer pipeline:
lgirdwood commentedon May 14, 2019
@tlauda @juimonen host will not directly schedule pipelines, but will indirectly schedule via
lgirdwood commentedon Jun 7, 2019
@juimonen this is probably in your area since you have worked through the 50kHz stuff. This is P1 for v1.4
9 remaining items
lgirdwood commentedon Jan 12, 2021
Move to v1.8
kv2019i commentedon Feb 15, 2023
@lgirdwood @singalsu This is a complex item that AFAIK is solve for most part (at least the original problem). Now with IPC4 work, we are covering these same cases as well. I'll bump this to v2.6 milestone, but potentially this could be closed.
lgirdwood commentedon May 10, 2023
Pipeline 2.0 now direction.