[pulseaudio-discuss] [RFC PATCH] alsa-sink: Reduce hardware pointer update syscalls
Raymond Yau
superquad.vortex2 at gmail.com
Thu Oct 2 00:54:11 PDT 2014
>
> > Calling snd_pcm_avail/delay causes a syscall to the kernel, which
> > communicates with the audio hardware, and can therefore be expensive
> > on some cards.
>
> here is my benchmarking, I'm not super-confident in the results
>
> similar to Alexander, I am seeing an assertion immediately:
> pulseaudio[2071]: Assertion 'frames > 0' failed at
modules/alsa/alsa-sink.c:651, function mmap_write(). Aborting.
>
> not loading the suspend-on-idle module didn't help, instead I patched
> - if (!after_avail && frames == 0)
> + if (frames == 0)
> break;
> immediately before the assert(); not sure if this is correct
>
> snd_pcm_mmap_begin() which is called by pa_alsa_safe_mmap_begin()
> explicitly states that frames may be set to 0 if no buffer is full -- so I
> think 0 should NOT lead to an assertion
>
> I don't understand the meaning of after_avail; in
> if (!after_avail && (int) sframes == -EAGAIN)
> down a few lines, after_avail is always false!?
>
> anyway, above patch might have fixed the issue and I was able to do some
> measurements on a beagleboard (ARMv7, OMAP3, TPS65950 PMIC audio),
> Linux kernel 3.7 and PA shortly before the srbchannel patches...
Even the driver use SNDRV_PCM_INFO_NO_PERIOD_WAKEUP which is necessary but
no sufficient
For timer schedulling, the driver need to report dma residue
and it look like some omap cannot report DMA residue granularity
Can your hardware report dma residue granularity?
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/sound/soc/omap/omap-pcm.c
static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream
*substream)
{
snd_pcm_uframes_t offset;
if (pcm_omap1510())
offset = snd_dmaengine_pcm_pointer_no_residue(substream);
else
offset = snd_dmaengine_pcm_pointer(substream);
return offset;
}
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/soc/soc-generic-dmaengine-pcm.c?id=93b943edfc5e439f7b843535e0bb0f7d2371f67f
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/soc/soc-generic-dmaengine-pcm.c?id=478028e088d6a94666d8a776be2cd2291faf3bbd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20141002/a0bd3a46/attachment.html>
More information about the pulseaudio-discuss
mailing list