Hi there,
I want to get your comments on the attached patch, which makes sound
driver resizing its DMA buffer according to the currently selected
audio speed/format. This is necessary because most audio hardware
supports wide range of speeds/formats, which makes it hard to define
one buffer size that will satisfy all supported formats and providing
minimal latency for the formats with low datarates, while good skip
protection for formats with high datarates. For example 4096 bytes used
now in most drivers doesn't protect data playing on 44kHz from skipping
when there is some kernel activity going on (for example output on
console or switching between consoles), while at the same time this
size means 0.5s latency for games that use 8kHz/8 bit audio formats,
which is a quite noticeable delay.
Attached patch fixes some maximal buffer size, which is necessary
for proper registering with the DMA subsystem, while scales this
buffer down when format with lower datarate is selected. I'm running
this patch for a month on my -current system with OPL3-SA hardware
and so far it works like a charm - mpg123 no longer skips when I'm
scrolling in the editor running on console, while audio delay in
digger (22kHz, 8 bit, mono) is absolutely unnoticeable.
This patch only improves mss driver, but it should be relatively
easy to modify other drivers as well (I do not have a hardware to
test changes on).
Thank you in advance!
-Maxim
pcm.diff