dev/sound patches to reduce latency

Anish Mistry mistry.7 at
Fri Apr 22 18:09:50 PDT 2005

On Friday 22 April 2005 06:46 pm, Luigi Rizzo wrote:
> attached are some patches for the sound driver to reduce latency
> in the playback channel.
> Background - by design, the driver tries to keep the "hard" buffer
> (the one used by the hardware to play samples out) always full
> even if userland supplied a small amount of data. While there is
> an ioctl() to set the size of the buffer in terms of a blocksize
> and number of blocks, the existing code failed in some cases to
> push down the info to the hardware, and had the tendency to
> use max-sized buffers in many cases. At 8khz, the 16k default
> buffers could cause very large delays in the playback of audio.
> With this patches, we try to pass the user-specified blocksize down
> to the hardware, and furthermore, use a small number of blocks in
> the "hard" buffer to minimize latency.
> I'd appreciate if people could test this code and report any good
> or bad news. I think it significantly improves what we have now.
> It could still benefit from an additional improvement:
>   - make the choice of the number of buffers adaptive on the irq
> rate. which is not a very complex thing to do, but should be done
> in all individual drivers, so it takes a bit more testing.
> ---- detailed description ---
> This patch touches the following files:
>     pci/ich.c
> 	comments and fixes the block allocation algorithm
>     pcm/channel.c
> 	comment in detail the buffer sizing algorithm, and implement it.
> 	The resulting code is, i believe, a lot simpler and more
> 	readable than the previous one.
>     pcm/dsp.c
> 	mostly comments to the existing code.
> Also partly related:
>     pcm/ac97.c
> 	enables the "igain" mixer to drive the 20dB boost for the mic.
What version is the diff against?  It doesn't seem to apply cleanly to 

Anish Mistry
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url :

More information about the freebsd-multimedia mailing list