Repository navigation
Xrun recover fixes and refactoring -- for both with and without FW internal Xrun recovery. #851
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -433,6 +433,7 @@ static void pipeline_comp_trigger_sched_comp(struct pipeline *p, | |
| switch (cmd) { | ||
| case COMP_TRIGGER_PAUSE: | ||
| case COMP_TRIGGER_STOP: | ||
| case COMP_TRIGGER_XRUN: | ||
| pipeline_schedule_cancel(p); | ||
| p->status = COMP_STATE_PAUSED; | ||
| break; | ||
|
|
@@ -453,7 +454,6 @@ static void pipeline_comp_trigger_sched_comp(struct pipeline *p, | |
| break; | ||
| case COMP_TRIGGER_SUSPEND: | ||
| case COMP_TRIGGER_RESUME: | ||
| case COMP_TRIGGER_XRUN: | ||
| default: | ||
| break; | ||
| } | ||
|
|
@@ -530,6 +530,49 @@ static int pipeline_trigger_on_core(struct pipeline *p, struct comp_dev *host, | |
| return ret; | ||
| } | ||
|
|
||
| /* | ||
|
keyonjie marked this conversation as resolved.
Resolved
|
||
| * trigger handler for pipelines in xrun, used for recovery from host only. | ||
| * return values: | ||
| * 0 -- success, further trigger in caller needed. | ||
| * PPL_STATUS_PATH_STOP -- done, no more further trigger needed. | ||
| * minus -- failed, caller should return failure. | ||
| */ | ||
| static int pipeline_xrun_handle_trigger(struct pipeline *p, int cmd) | ||
| { | ||
| int ret = 0; | ||
|
|
||
| /* it is expected in paused status for xrun pipeline */ | ||
| if (!p->xrun_bytes || p->status != COMP_STATE_PAUSED) | ||
| return 0; | ||
|
|
||
| /* in xrun, handle start/stop trigger */ | ||
| switch (cmd) { | ||
| case COMP_TRIGGER_START: | ||
| /* in xrun, prepare before trigger start needed */ | ||
| trace_pipe_with_ids(p, "in xrun, prepare it first"); | ||
| /* prepare the pipeline */ | ||
| ret = pipeline_prepare(p, p->source_comp); | ||
| if (ret < 0) { | ||
| trace_pipe_error_with_ids(p, "prepare error: ret = %d", | ||
| ret); | ||
| return ret; | ||
| } | ||
| /* now ready for start, clear xrun_bytes */ | ||
| p->xrun_bytes = 0; | ||
| break; | ||
| case COMP_TRIGGER_STOP: | ||
| /* in xrun, suppose pipeline is already stopped, ignore it */ | ||
| trace_pipe_with_ids(p, "already stopped in xrun"); | ||
| /* no more further trigger stop needed */ | ||
| ret = PPL_STATUS_PATH_STOP; | ||
| break; | ||
| default: | ||
| break; | ||
| } | ||
|
|
||
| return ret; | ||
| } | ||
|
|
||
| /* trigger pipeline */ | ||
| int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd) | ||
| { | ||
|
|
@@ -539,6 +582,18 @@ int pipeline_trigger(struct pipeline *p, struct comp_dev *host, int cmd) | |
|
|
||
| trace_pipe_with_ids(p, "pipeline_trigger()"); | ||
|
|
||
| /* handle pipeline global checks before going into each components */ | ||
| if (p->xrun_bytes) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Already checked inside the function |
||
| ret = pipeline_xrun_handle_trigger(p, cmd); | ||
| if (ret < 0) { | ||
| trace_pipe_error_with_ids(p, "xrun handle error: ret = %d", | ||
| ret); | ||
| return ret; | ||
| } else if (ret == PPL_STATUS_PATH_STOP) | ||
| /* no further action needed*/ | ||
| return 0; | ||
| } | ||
|
|
||
| /* if current core is different than requested */ | ||
| if (p->ipc_pipe.core != cpu_get_id()) | ||
| return pipeline_trigger_on_core(p, host, cmd); | ||
|
|
@@ -854,7 +909,7 @@ static uint64_t pipeline_task(void *arg) | |
| /* try to recover */ | ||
| err = pipeline_xrun_recover(p); | ||
| if (err < 0) | ||
| goto sched;/* skip copy if still in xrun */ | ||
| return 0;/* skip copy if still in xrun */ | ||
| } | ||
|
|
||
| err = pipeline_copy(p); | ||
|
|
@@ -863,11 +918,10 @@ static uint64_t pipeline_task(void *arg) | |
| err = pipeline_xrun_recover(p); | ||
| if (err < 0) { | ||
| trace_pipe_error_with_ids(p, "pipeline_task(): xrun recover failed! pipeline will be stopped!"); | ||
| goto sched; /* failed - host will stop this pipeline */ | ||
| return 0; /* failed - host will stop this pipeline */ | ||
| } | ||
| } | ||
|
|
||
| sched: | ||
| tracev_pipe("pipeline_task() sched"); | ||
| return p->ipc_pipe.period; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
@keyonjie does the state transition diagram need updated in the component header ?
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.
correct, let me update it.