Repository navigation
[RFC] ASoC: SOF: add XRUN info delivering to ALSA #479
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -556,10 +556,9 @@ static void ipc_xrun(struct snd_sof_dev *sdev, u32 msg_id) | |
| dev_dbg(sdev->dev, "posn XRUN: host %llx comp %d size %d\n", | ||
| posn.host_posn, posn.xrun_comp_id, posn.xrun_size); | ||
|
|
||
| #if defined(CONFIG_SND_SOC_SOF_DEBUG_XRUN_STOP) | ||
| /* stop PCM on XRUN - used for pipeline debug */ | ||
| #if defined(CONFIG_SND_SOC_SOF_DEBUG_XRUN_REPORT) | ||
| /* save XRUN info and send to ALSA in .pointer later */ | ||
| memcpy(&spcm->stream[direction].posn, &posn, sizeof(posn)); | ||
| snd_pcm_stop_xrun(spcm->stream[direction].substream); | ||
|
Member
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. Not sure I get what the meaning of this Kconfig is now, if we don't actually stop? Why wouldn't the Xrun info be passed in ALL cases?
Author
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. I know your point here, Pierre. I planed to change the Kconfig in the coming PR(e.g. from CONFIG_SND_SOC_SOF_DEBUG_XRUN_STOP to CONFIG_SND_SOC_SOF_DEBUG_XRUN_REPORT). So my intention here is:
Member
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. Sorry, I don't get any of the explanations. I thought we agreed that the firmware does not try to be smart and does not try to recover on its own?
Author
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. I think we are not aligned on that yet, the smart recovery inside FW are still running on today's SOF FW. |
||
| #endif | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -338,6 +338,13 @@ static snd_pcm_uframes_t sof_pcm_pointer(struct snd_pcm_substream *substream) | |
| if (rtd->dai_link->no_pcm) | ||
| return 0; | ||
|
|
||
| /* return Xrun to ALSA for further handling */ | ||
| if (spcm->stream[substream->stream].posn.xrun_size) { | ||
| /* only report once for each XRUN IPC */ | ||
| spcm->stream[substream->stream].posn.xrun_size = 0; | ||
| return SNDRV_PCM_POS_XRUN; | ||
|
Member
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. Not sure why this is done here, before pcm_pointer callback? Shouldn't this be done once all the information is reported, i.e. below line 350 (with the return removed).
Author
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. We have only one return value(position) with .pointer() callback, I aimed to report/return SNDRV_PCM_POS_XRUN once XRUN happened, which will let ALSA trigger stop->prepare->start later.
Member
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. To be clear, I was talking about the second part of the code below /* return Xrun to ALSA for further handling */
if (spcm->stream[substream->stream].posn.xrun_size) {
/* only report once for each XRUN IPC */
spcm->stream[substream->stream].posn.xrun_size = 0;
return SNDRV_PCM_POS_XRUN;
}
/* if have dsp ops pointer callback, use that directly */
if (sdev->ops->pcm_pointer)
return sdev->ops->pcm_pointer(sdev, substream);You return before calling pcm_pointer, is this desired/intentional or a bug? |
||
| } | ||
|
|
||
| /* if have dsp ops pointer callback, use that directly */ | ||
| if (sdev->ops->pcm_pointer) | ||
| return sdev->ops->pcm_pointer(sdev, substream); | ||
|
|
||
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 also don't get the intent here. Why just not always stop on an underrun? What are we trying to do with the deferred report?
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 believe the the snd_pcm_stop_xrun() don't really stop the pipeline thoroughly for us, so the config item CONFIG_SND_SOC_SOF_DEBUG_XRUN_STOP here looks confusing.
What I am doing here is try to remove that and add a new config item for Xrun report.