[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <05263a45-5faf-47c7-9a32-eb8e5114e286@linaro.org>
Date: Mon, 3 Feb 2025 17:04:54 +0000
From: Srinivas Kandagatla <srinivas.kandagatla@...aro.org>
To: Mark Brown <broonie@...nel.org>
Cc: lgirdwood@...il.com, perex@...ex.cz, tiwai@...e.com,
krzysztof.kozlowski@...aro.org, pierre-louis.bossart@...ux.dev,
linux-sound@...r.kernel.org, linux-arm-msm@...r.kernel.org,
linux-kernel@...r.kernel.org, dmitry.baryshkov@...aro.org
Subject: Re: [PATCH] ASoC: q6apm-dai: schedule all the periods before we start
streaming
On 03/02/2025 15:07, Mark Brown wrote:
> On Mon, Feb 03, 2025 at 02:30:26PM +0000, Srinivas Kandagatla wrote:
>> On 03/02/2025 14:17, Mark Brown wrote:
>>> On Mon, Feb 03, 2025 at 12:49:45PM +0000, srinivas.kandagatla@...aro.org wrote:
>
>>>> Fix this by scheduling all the periods, this will ensure that the dsp
>>>> has enough buffer feed and ultimatley fixing the underruns and audio
>>>> distortion.
>
>>> Should we be writing all periods or just the minimum number of periods
>>> that's configured? Userspace might not have filled the whole buffer
>>> yet.
>
>> Just minimum number of periods or 1 period. We are queuing up all the
>> periods to the DSP, so that we do not have to wait for period interrupt to
>> queue the next one. This significantly reduces the latency in queuing the
>> periods to dsp.
>
> What guarantee do you have that the data isn't garbage?
Yes, its possible that some of the last periods might be not be written
yet by userspace.
We can always add some checks on the available periods to queue to dsp
something like:
----------------->cut<----------------
avail_periods = (runtime->buffer_size -
snd_pcm_playback_avail(runtime))/runtime->period_size;
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
for (i = 0; i < avail_periods; i++)
ret = q6apm_write_async(prtd->graph, prtd->pcm_count, 0, 0, 0);
if (ret)
break;
}
----------------->cut<----------------
--srini
Powered by blists - more mailing lists