START / RELEASE from task#4559
Conversation
lgirdwood
left a comment
There was a problem hiding this comment.
Have you managed to test the xrun logic yet by injecting xruns ?
src/audio/pipeline/pipeline-stream.c
Outdated
There was a problem hiding this comment.
This looks like it should be a separate function ?
There was a problem hiding this comment.
sorry, missed this one, let me do that
There was a problem hiding this comment.
{ should be on the line above.
There was a problem hiding this comment.
can you alos comment on what we are doing here when we iterate the list.
@lgirdwood I just tried that - the test passes but I see no xruns in firmware trace. The way I came across and debugged this is with Zephyr, where I was regularly getting xruns. I can re-try that. Also note, that that part of this PR has been moved over to #4562 |
|
This is an experimental push: only for testing of preparatory patches, because even they are rather intrusive. Note, that I expect topologies with mux/demux pipelines to fail at least pause-resume tests. |
|
Can these CI kernel errors on CML_RVP_SDW be related? |
|
@lyakh I'm seeing lots og GH action internal errors trying to run your tests. Will try again later. |
src/include/sof/audio/component.h
Outdated
There was a problem hiding this comment.
STANDBY probably not best naming PRE_ACTIVE is better (also means we can have POST_ACTIVE if needed).
There was a problem hiding this comment.
STANDBY is definitely not the best :-)
src/ipc/ipc3/handler.c
Outdated
There was a problem hiding this comment.
We should call this PRE_START aligns with PRE_ACTIVE
There was a problem hiding this comment.
yeah, I thought the names weren't perfect. And I thought about "pre_start" too, but there's already ssp_pre_start() at least which I now call from ssp_early_start(). I could rename both eventually of course, it's just a static function
d3f7d5e to
8d9eac1
Compare
|
@kkarask we are struggling to figure out the failures in internal CI around muxdemux tests. Could you post the topology used in both failing tests. This will help us work out the issue. Thanks ! |
|
I see internal Intel MUX and DEMUX CI tests failing. The reason is a non-trivial mux state machine in |
|
@lgirdwood Topology for 14_04 demux synchronized capture: |
|
SOFCI TEST |
src/audio/pipeline/pipeline-stream.c
Outdated
There was a problem hiding this comment.
we're adding an intermediate "PRE" trigger command to the "START" and "RELEASE" IPCs.
src/drivers/intel/ssp/ssp.c
Outdated
There was a problem hiding this comment.
well, if we are going to fix things: does it make sense to use a spin_lock around a wait_delay?
There was a problem hiding this comment.
of course, this is done when the delay is removed from the SSP driver into the scheduler
There was a problem hiding this comment.
The test should be that 2 consecutive stream wont extend the delay or cancel the delay. i.e. opening playback then capture on SSP0 codec.
There was a problem hiding this comment.
bingo, this is actually a fun one! I confess - I didn't think about it, and I didn't know what happens in such a case. So, I ran playback and simultaneously capture on the same SSP. And I see with the current tip of the tree, that in such a case ssp_start() is called for both streams and therefore, if .bclk_delay != 0 the driver will wait twice. The same would happen after my patches. This probably doesn't make sense. This isn't a bug introduced by this PR but I guess I need to fix this...
There was a problem hiding this comment.
ok, lets track this with a feature
src/include/sof/lib/dai.h
Outdated
There was a problem hiding this comment.
I don't understand if this represents a measured delay or a specified delay. If this is measured, why was it needed?
There was a problem hiding this comment.
me neither. It's there before this PR and IIRC removing it breaks SSP on some platforms
There was a problem hiding this comment.
well in the initial code it is a specified delay. The topology asks the firmware, using the kernel driver as a proxy, to keep a delay between the SSP start and DMA start.
Now it's unclear to me what you want to do with the delay. Is this just about moving the wait outside of the driver? Or is this to compensate for the delay somehow, in which case you'd want the measured and actual wait.
There was a problem hiding this comment.
This is the spin_for_many_miliseconds_and_block_other_work delay. It's being folded into the higher level synchronised LL work. i.e. the LL pipeline will schedule the BCLK before the rest of the DAI and the pipeline start (and unblock all other work on the core).
There was a problem hiding this comment.
early_start_length_ms should also be a uint32_t too.
There was a problem hiding this comment.
length doesn't seem like a good name for this. early_start_delay_ms?
src/drivers/intel/ssp/ssp.c
Outdated
There was a problem hiding this comment.
what are you going to do with the information?
There was a problem hiding this comment.
see pipeline_comp_trigger() and pipeline_trigger_run() in https://github.com/thesofproject/sof/blob/8856f664e9511c410e530271328e08bc9764abe3/src/audio/pipeline/pipeline-stream.c specifically:
if (data.delay && pipeline_is_timer_driven(p)) {
/* The task will skip .delay periods before processing the next command */
p->trigger.delay = (data.delay * 1000 + p->period - 1) / p->period;
p->trigger.cmd = data.cmd;
return ret;
}
and pipeline_task() in https://github.com/thesofproject/sof/blob/8856f664e9511c410e530271328e08bc9764abe3/src/audio/pipeline/pipeline-schedule.c:
if (p->trigger.delay) {
p->trigger.delay--;
return SOF_TASK_STATE_RESCHEDULE;
}
@plbossart because that's what the SSP driver currently has - a delay in its initialisation path. The initial version of this PR didn't touch that delay, it only moved the START / RELEASE triggers into the pipeline task. But that delay then broke tests because the whole scheduler was blocked on it. To solve that we added a new "PRE_ACTIVE" state. Now there's no ad-hoc waiting in SSP any more, the SSP driver just tells the framework that it needs a delay between |
lgirdwood
left a comment
There was a problem hiding this comment.
CI looking good for internal CI now :)
src/include/sof/audio/component.h
Outdated
There was a problem hiding this comment.
We should have a big comment here describing the usage and have the POST conditions too (even if we dont use them today).
lgirdwood
left a comment
There was a problem hiding this comment.
Almost there, some opens though but mostly minor.
src/include/sof/audio/pipeline.h
Outdated
There was a problem hiding this comment.
what delay - can we have acomment.
src/include/sof/lib/dai.h
Outdated
There was a problem hiding this comment.
early_start_length_ms should also be a uint32_t too.
src/drivers/intel/ssp/ssp.c
Outdated
There was a problem hiding this comment.
The test should be that 2 consecutive stream wont extend the delay or cancel the delay. i.e. opening playback then capture on SSP0 codec.
We need to split the START trigger command into two commands because some components have a long delay inside their START handling. This patch introduces two new trigger commands: PRE_START and PRE_RELEASE and a new state PRE_ACTIVE to prepare for that split. For simmetry POST_STOP and POST_PAUSE are also added, however they aren't used yet. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Some DAI drivers have to perform additional preparatory operations before START and RELEASE triggers, pass PRE_* triggers down to them for that purpose. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The SSP trigger handler has a potentially long delay when processing START and RELEASE triggers. Split off an early start trigger to extract that delay out of the SSP driver into the trigger state machine. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Some DAI devices need a delay between their PRE_START and START trigger commands, and similarly between PRE_RELEASE and RELEASE. Add a DAI driver operation to get that delay time and use it between the two commands. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Implement BCLK initialisation delay using the .get_init_delay() operation. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
When the firmware receives a START or RELEASE IPC message, it immediately triggers all involved components, which starts DMA. Then it schedules the pipeline task, but since the scheduler can be already running at that time, the task might be scheduled when DMA data isn't available yet or has already overflowed. To fix this change the control flow to also trigger all components from the task during its first run. Actual data processing then begins with the next period. Note, that this is currently only possible with pipelines, using timer-based scheduling. Pipelines, using DMA interrupts for scheduling are unaffected. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
comp_set_state() always sets the component state to requested state, which is calculated at the top of the function. Re-use the variable instead of hard-coding each value again. Also return immediately in case of errors, which eliminates the need for the return code variable. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Trace prints often contain open-coded function names in them. When functions get renamed or trace prints are moved to other functions, those strings sometimes are forgotten. Fix two such cases. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
The initialisation delay in SSP start-up sequence is only needed when the first stream initialises the SSP. If an SSP port is used for both playback and capture, the second stream doesn't need to delay start up again. Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
|
One CML DUT not booting but other CML passing. |
move START and RELEASE triggers to the pipeline task