[pulseaudio-discuss] [RFC PATCH] alsa-sink: Reduce hardware pointer update syscalls

Raymond Yau superquad.vortex2 at gmail.com
Wed Sep 24 22:33:21 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.

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/soc/soc-generic-dmaengine-pcm.c?id=478028e088d6a94666d8a776be2cd2291faf3bbd

If  dmaengine_pcm_can_report_residue() is true, it won't take too long as
sound card just read the value from hardware register , the uncertainity of
this position is just DMA brust size, otherwise the uncertainity is one
period size.

You can simulate those sound card without this capability by forcing your
hda driver to report hwptr in period size granularity

static snd_pcm_uframes_t azx_pcm_pointer(struct snd_pcm_substream
*substream)
{
struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
struct azx *chip = apcm->chip;
struct azx_dev *azx_dev = get_azx_dev(substream);
- return bytes_to_frames(substream->runtime,
       azx_get_position(chip, azx_dev));
+  return bytes_to_frames(substream->runtime,
       azx_get_position(chip, azx_dev)) / substream->runtime->period_size *
substream->runtime->period_size ;
}

Pulseaudio should not enable timer scheduling when
dmaengine_pcm_can_report_residue() is false
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/pulseaudio-discuss/attachments/20140925/6bbec7c2/attachment.html>


More information about the pulseaudio-discuss mailing list