pipeline: don't skip a copying scheduling tick

When processing a PAUSE or a STOP trigger in the pipeline task, if
the pipeline aborts processing of the trigger, it has to proceed
executing the copy() flow instead of skipping the tick.

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
This commit is contained in:
Guennadi Liakhovetski 2021-11-18 12:17:57 +01:00 committed by Liam Girdwood
parent b1f8ea84c6
commit e74e1b3f04
1 changed files with 26 additions and 6 deletions

View File

@ -45,8 +45,15 @@ static enum task_state pipeline_task_cmd(struct pipeline *p,
if (!p->trigger.host) { if (!p->trigger.host) {
p->trigger.cmd = COMP_TRIGGER_NO_ACTION; p->trigger.cmd = COMP_TRIGGER_NO_ACTION;
return p->status == COMP_STATE_PAUSED ? SOF_TASK_STATE_COMPLETED :
SOF_TASK_STATE_RESCHEDULE; switch (cmd) {
case COMP_TRIGGER_STOP:
case COMP_TRIGGER_PAUSE:
return p->trigger.aborted ? SOF_TASK_STATE_RUNNING :
SOF_TASK_STATE_COMPLETED;
}
return SOF_TASK_STATE_RESCHEDULE;
} }
err = pipeline_trigger_run(p, p->trigger.host, cmd); err = pipeline_trigger_run(p, p->trigger.host, cmd);
@ -77,8 +84,18 @@ static enum task_state pipeline_task_cmd(struct pipeline *p,
if (p->trigger.delay) if (p->trigger.delay)
return SOF_TASK_STATE_RESCHEDULE; return SOF_TASK_STATE_RESCHEDULE;
/* No delay: the final stage has already run too */ /* No delay: the final stage has already run too */
} else if (p->status == COMP_STATE_PAUSED && !p->trigger.aborted) { err = SOF_TASK_STATE_RESCHEDULE;
err = SOF_TASK_STATE_COMPLETED; } else if (p->status == COMP_STATE_PAUSED) {
if (p->trigger.aborted) {
p->status = COMP_STATE_ACTIVE;
/*
* the pipeline aborted a STOP or a PAUSE
* command, proceed with copying
*/
err = SOF_TASK_STATE_RUNNING;
} else {
err = SOF_TASK_STATE_COMPLETED;
}
} else { } else {
p->status = COMP_STATE_ACTIVE; p->status = COMP_STATE_ACTIVE;
err = SOF_TASK_STATE_RESCHEDULE; err = SOF_TASK_STATE_RESCHEDULE;
@ -136,9 +153,12 @@ static enum task_state pipeline_task(void *arg)
return SOF_TASK_STATE_RESCHEDULE; return SOF_TASK_STATE_RESCHEDULE;
} }
if (p->trigger.cmd != COMP_TRIGGER_NO_ACTION) if (p->trigger.cmd != COMP_TRIGGER_NO_ACTION) {
/* Process an offloaded command */ /* Process an offloaded command */
return pipeline_task_cmd(p, &reply); err = pipeline_task_cmd(p, &reply);
if (err != SOF_TASK_STATE_RUNNING)
return err;
}
if (p->status == COMP_STATE_PAUSED) if (p->status == COMP_STATE_PAUSED)
/* /*