Repository navigation
Conversation
plbossart
left a comment
There was a problem hiding this comment.
I didn't fully understand the intent of this patch, see comments below.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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:
- if SOF_DEBUG_XRUN_REPORT is unselected (by default), we don't report this Xrun reported from FW to ALSA, just report the normal position info. If the Xrun is not recovered successfully by FW itself, this Xrun will be accumulated and then ALSA will find actually Xrun and trigger stop->prepare->start at that time.
- if SOF_DEBUG_XRUN_REPORT is selected, we will trust Xrun reported from FW(we think/align on that FW report this to us and request driver to do something on that) to ALSA immediately, and ALSA will start triggering stop->prepare->start soon. According to when FW will report XRUN, it is implemented in and controlled by FW side totally.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I think we are not aligned on that yet, the smart recovery inside FW are still running on today's SOF FW.
|
@plbossart PR updated with Kconfig item naming changed. |
If we get XRUN IPC from firmware, let's deliver it to ALSA and ALSA may be able to trigger stop->prepare->start later. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
We are not really stop PCM on XRUN event, but we can select to report XRUN event from FW to ALSA, and let ALSA possible to trigger stop->prepare->start earlier, here change the kconfig item naming from CONFIG_SND_SOC_SOF_DEBUG_XRUN_STOP to CONFIG_SND_SOC_SOF_DEBUG_XRUN_REPORT to reflect the real XRUN handling. Signed-off-by: Keyon Jie <yang.jie@linux.intel.com>
plbossart
left a comment
There was a problem hiding this comment.
Sorry, this patch is not aligned with my understanding of how the firmware and drivers should behave. I don't see the point of deferring the reaction on an x-run.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
| If we don't report this XRUN event, ALSA will still observe XRUN | ||
| later when .pointer() callback has no update for some time, usually | ||
| that may lead to later and lower frequecy ALSA XRUN response. | ||
| Say Y if you are debugging SOF FW pipeline XRUNs handling. |
There was a problem hiding this comment.
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.
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.
|
@plbossart sorry, please hold on merging this, I might need more experiment on it before finalize it, and we need finalize the FW behavior before that also. |
|
I have figured out fixes for driver recover FW initiated Xrun issue and verified they work fine. |
If we get XRUN IPC from firmware, let's deliver it to ALSA and ALSA
may be able to trigger stop->prepare->start later.
Signed-off-by: Keyon Jie yang.jie@linux.intel.com