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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>
> 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>


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux