History log of /freebsd-10.1-release/sys/dev/sound/pcm/channel.c
Revision Date Author Comments
(<<< Hide modified files)
(Show modified files >>>)
# 272461 02-Oct-2014 gjb

Copy stable/10@r272459 to releng/10.1 as part of
the 10.1-RELEASE process.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation

# 256281 10-Oct-2013 gjb

Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.

Approved by: re (implicit)
Sponsored by: The FreeBSD Foundation


# 243138 16-Nov-2012 mav

For some more completeness add matrixes for 3.1 and 7.0 channel setups.


# 230845 31-Jan-2012 mav

Make sound(4) more flexible in setting soft buffer and block sizes when
hardware imposes strict limitations on hard buffer and block sizes.

Previous code set soft buffer to be no smaller then hard buffer. On some
cards with fixed 64K physical buffer that caused up to 800ms play latency.
New code allows to set soft buffer size down to just two blocks of the hard
buffer and to not write more then that size ahead to the hardware buffer.
As result of that change I was able to reduce full practically measured
record-playback loop delay in those conditions down to only about 115ms
with theoretical playback latency of only about 50ms.

New code works fine for both vchans and direct cases. In both cases sound(4)
tries to follow hw.snd.latency_profile and hw.snd.latency values and
application-requested buffer and block sizes as much as limitation of two
hardware blocks allows.

Reviewed by: silence on multimedia@


# 230537 25-Jan-2012 mav

Allow PASSTHROUGH (AC3) to have more then 2 channels.
8 channels can be used to get more then 6.144Mbps bandwidth.


# 214332 25-Oct-2010 mav

Make hw.snd.vpc_0db to be also a loader tunable.


# 201145 28-Dec-2009 antoine

(S)LIST_HEAD_INITIALIZER takes a (S)LIST_HEAD as an argument.
Fix some wrong usages.
Note: this does not affect generated binaries as this argument is not used.

PR: 137213
Submitted by: Eygene Ryabinkin (initial version)
MFC after: 1 month


# 193640 07-Jun-2009 ariff

Sound Mega-commit. Expect further cleanup until code freeze.

For a slightly thorough explaination, please refer to
[1] http://people.freebsd.org/~ariff/SOUND_4.TXT.html .

Summary of changes includes:

1 Volume Per-Channel (vpc). Provides private / standalone volume control
unique per-stream pcm channel without touching master volume / pcm.
Applications can directly use SNDCTL_DSP_[GET|SET][PLAY|REC]VOL, or for
backwards compatibility, SOUND_MIXER_PCM through the opened dsp device
instead of /dev/mixer. Special "bypass" mode is enabled through
/dev/mixer which will automatically detect if the adjustment is made
through /dev/mixer and forward its request to this private volume
controller. Changes to this volume object will not interfere with
other channels.

Requirements:
- SNDCTL_DSP_[GET|SET][PLAY|REC]_VOL are newer ioctls (OSSv4) which
require specific application modifications (preferred).
- No modifications required for using bypass mode, so applications
like mplayer or xmms should work out of the box.

Kernel hints:
- hint.pcm.%d.vpc (0 = disable vpc).

Kernel sysctls:
- hw.snd.vpc_mixer_bypass (default: 1). Enable or disable /dev/mixer
bypass mode.
- hw.snd.vpc_autoreset (default: 1). By default, closing/opening
/dev/dsp will reset the volume back to 0 db gain/attenuation.
Setting this to 0 will preserve its settings across device
closing/opening.
- hw.snd.vpc_reset (default: 0). Panic/reset button to reset all
volume settings back to 0 db.
- hw.snd.vpc_0db (default: 45). 0 db relative to linear mixer value.

2 High quality fixed-point Bandlimited SINC sampling rate converter,
based on Julius O'Smith's Digital Audio Resampling -
http://ccrma.stanford.edu/~jos/resample/. It includes a filter design
script written in awk (the clumsiest joke I've ever written)
- 100% 32bit fixed-point, 64bit accumulator.
- Possibly among the fastest (if not fastest) of its kind.
- Resampling quality is tunable, either runtime or during kernel
compilation (FEEDER_RATE_PRESETS).
- Quality can be further customized during kernel compilation by
defining FEEDER_RATE_PRESETS in /etc/make.conf.

Kernel sysctls:
- hw.snd.feeder_rate_quality.
0 - Zero-order Hold (ZOH). Fastest, bad quality.
1 - Linear Interpolation (LINEAR). Slightly slower than ZOH,
better quality but still does not eliminate aliasing.
2 - (and above) - Sinc Interpolation(SINC). Best quality. SINC
quality always start from 2 and above.

Rough quality comparisons:
- http://people.freebsd.org/~ariff/z_comparison/

3 Bit-perfect mode. Bypasses all feeder/dsp effects. Pure sound will be
directly fed into the hardware.

4 Parametric (compile time) Software Equalizer (Bass/Treble mixer). Can
be customized by defining FEEDER_EQ_PRESETS in /etc/make.conf.

5 Transparent/Adaptive Virtual Channel. Now you don't have to disable
vchans in order to make digital format pass through. It also makes
vchans more dynamic by choosing a better format/rate among all the
concurrent streams, which means that dev.pcm.X.play.vchanformat/rate
becomes sort of optional.

6 Exclusive Stream, with special open() mode O_EXCL. This will "mute"
other concurrent vchan streams and only allow a single channel with
O_EXCL set to keep producing sound.

Other Changes:
* most feeder_* stuffs are compilable in userland. Let's not
speculate whether we should go all out for it (save that for
FreeBSD 16.0-RELEASE).
* kobj signature fixups, thanks to Andriy Gapon <avg@freebsd.org>
* pull out channel mixing logic out of vchan.c and create its own
feeder_mixer for world justice.
* various refactoring here and there, for good or bad.
* activation of few more OSSv4 ioctls() (see [1] above).
* opt_snd.h for possible compile time configuration:
(mostly for debugging purposes, don't try these at home)
SND_DEBUG
SND_DIAGNOSTIC
SND_FEEDER_MULTIFORMAT
SND_FEEDER_FULL_MULTIFORMAT
SND_FEEDER_RATE_HP
SND_PCM_64
SND_OLDSTEREO

Manual page updates are on the way.

Tested by: joel, Olivier SMEDTS <olivier at gid0 d org>, too many
unsung / unnamed heroes.


# 184610 04-Nov-2008 alfred

Bring in USB4BSD, Hans Petter Selasky rework of the USB stack
that includes significant features and SMP safety.

This commit includes a more or less complete rewrite of the *BSD USB
stack, including Host Controller and Device Controller drivers and
updating all existing USB drivers to use the new USB API:

1) A brief feature list:

- A new and mutex enabled USB API.

- Many USB drivers are now running Giant free.

- Linux USB kernel compatibility layer.

- New UGEN backend and libusb library, finally solves the "driver
unloading" problem. The new BSD licensed libusb20 library is fully
compatible with libusb-0.1.12 from sourceforge.

- New "usbconfig" utility, for easy configuration of USB.

- Full support for Split transactions, which means you can use your
full speed USB audio device on a high speed USB HUB.

- Full support for HS ISOC transactions, which makes writing drivers
for various HS webcams possible, for example.

- Full support for USB on embedded platforms, mostly cache flushing
and buffer invalidating stuff.

- Safer parsing of USB descriptors.

- Autodetect of annoying USB install disks.

- Support for USB device side mode, also called USB gadget mode,
using the same API like the USB host side. In other words the new
USB stack is symmetric with regard to host and device side.

- Support for USB transfers like I/O vectors, means more throughput
and less interrupts.

- ... see the FreeBSD quarterly status reports under "USB project"

2) To enable the driver in the default kernel build:

2.a) Remove all existing USB device options from your kernel config
file.

2.b) Add the following USB device options to your kernel configuration
file:

# USB core support
device usb2_core

# USB controller support
device usb2_controller
device usb2_controller_ehci
device usb2_controller_ohci
device usb2_controller_uhci

# USB mass storage support
device usb2_storage
device usb2_storage_mass

# USB ethernet support, requires miibus
device usb2_ethernet
device usb2_ethernet_aue
device usb2_ethernet_axe
device usb2_ethernet_cdce
device usb2_ethernet_cue
device usb2_ethernet_kue
device usb2_ethernet_rue
device usb2_ethernet_dav

# USB wireless LAN support
device usb2_wlan
device usb2_wlan_rum
device usb2_wlan_ral
device usb2_wlan_zyd

# USB serial device support
device usb2_serial
device usb2_serial_ark
device usb2_serial_bsa
device usb2_serial_bser
device usb2_serial_chcom
device usb2_serial_cycom
device usb2_serial_foma
device usb2_serial_ftdi
device usb2_serial_gensa
device usb2_serial_ipaq
device usb2_serial_lpt
device usb2_serial_mct
device usb2_serial_modem
device usb2_serial_moscom
device usb2_serial_plcom
device usb2_serial_visor
device usb2_serial_vscom

# USB bluetooth support
device usb2_bluetooth
device usb2_bluetooth_ng

# USB input device support
device usb2_input
device usb2_input_hid
device usb2_input_kbd
device usb2_input_ms

# USB sound and MIDI device support
device usb2_sound

2) To enable the driver at runtime:

2.a) Unload all existing USB modules. If USB is compiled into the
kernel then you might have to build a new kernel.

2.b) Load the "usb2_xxx.ko" modules under /boot/kernel having the same
base name like the kernel device option.

Submitted by: Hans Petter Selasky hselasky at c2i dot net
Reviewed by: imp, alfred


# 174220 03-Dec-2007 ariff

Fix audio playback aborted with SNDCTL_DSP_SETTRIGGER, affecting
PortAudio version 19.

PR: kern/118395
Submitted by: Henrik Gulbrandsen <henrik at gulbra dot net>
MFC after: 3 days


# 170815 16-Jun-2007 ariff

Last (again ?!?) major commit for RELENG_7, featuring total Giant
eradication in/from userland path, countless locking fixes, etc.

- General sleep call through msleep(9) has been converted to condvar(9)
with better consistencies.
- Heavily guard every possible "slow path" entries (open(), close(),
few ioctl()s, sysctls), but once it entering "fast path" (io, interrupt
started), they are free to fly on their own.
- Rearrange locking sequences, resulting better concurrency and
serialization. Large part doesn't even need locking at all, and will be
removed in future. Less clutter, except in few places due to lock
ordering.
- Anonymous mixer object creation/deletion to simplify mixer handling
beyond typical mixer ioctls.
Submitted by: chibis (with modifications)
- Add few mix_[get|set|..] functions to avoid calling mixer_ioctl()
directly using cryptic arguments.
- Locking fixes to avoid possible deadlock with (still under Giant) USB.
- Better simplex/duplex device handling.
- Recover mmap() functionality for recording, which has been lost
since 2.2.x - 3.x (the introduction of newpcm). Full-duplex mmap still
doesn't work (due to VM/page design), but people still can mmap
both by opening each direction separately. mmaped playback is guarantee
to work either way.
- New sysctl: "hw.snd.compat_linux_mmap" to allow PROT_EXEC page
mapping, due to recent changes in linux compatibility layer which
require it. All linux applications that using sound + mmap() (mostly games)
require this to be enabled. Disabled by default.
- Other goodies.. too many, that will increase releng7 shareholder value
and make users of releng6 (and below) cry ;)

* This commit should be atomic. If anything goes wrong (not counting problem
originated from elsewhere), I will not hesitate to revert everything back
within 12 hours. This substantial changes itself not a rocket science
and the process has begun for almost 2 years, and lots of incremental
changes are already in place during that period of time.
* Some issues does occur in snd_emu10kx (note the 'x') due to various
internal locking issues and it is currently being worked on by chibis.

Tested by: chibis (Yuriy Tsibizov), joel, Alexandre Vieira,
many innocent souls...


# 170521 10-Jun-2007 ariff

Filter/compress the amount of channel trigger. This should reduce
much of lock/unlock contentions within the interrupt handler. Most
of these drivers only need PCMTRIG_START or STOP (ABORT).

Discussed with: scottl


# 170289 04-Jun-2007 dwmalone

Despite several examples in the kernel, the third argument of
sysctl_handle_int is not sizeof the int type you want to export.
The type must always be an int or an unsigned int.

Remove the instances where a sizeof(variable) is passed to stop
people accidently cut and pasting these examples.

In a few places this was sysctl_handle_int was being used on 64 bit
types, which would truncate the value to be exported. In these
cases use sysctl_handle_quad to export them and change the format
to Q so that sysctl(1) can still print them.


# 170161 31-May-2007 ariff

Last major commit and updates for RELENG_7:

- Rework the entire pcm_channel structure:
* Remove rarely used link placeholder, instead, make each pcm_channel
as head/link of each own/each other. Unlock - Lock sequence due to
sleep malloc has been reduced.
* Implement "busy" queue which will contain list of busy/active
channels. This greatly reduce locking contention for example while
servicing interrupt for hardware with many channels or when virtual
channels reach its 256 peak channels.

- So I heard you like v chan ... O RLY?
Welcome to Virtual **Record** Channels (vrec, rec vchans, vchans for
recording, Rec-Chan, you decide), the ultimate solutions for your
nagging O_RDWR full-duplex wannabe (note: flash plugins) monopolizing
single record channel causing EBUSY. Vrec works exactly like Vchans
(or, should I rename it to "Vplay" :) , except that it operates on the
opposite direction (recording). Up to 256 vrecs (like vchans) are
possible.

Notes:
* Relocate dev.pcm.%d.{vchans,vchanformat,vchanrate} to each of its
respective node/direction:
dev.pcm.%d.play.* for "play" (cdev = dsp%d.vp%d)
dev.pcm.%d.rec.* for "record" (cdev = dsp%d.vr%d)
* Don't expect that it will magically give you ability to split
"recording source" (eg: 1 channel for cdrom, 1 channel for mic,
etc). Just admit that you only have a *single* recording source /
channel. Please bug your hardware vendor instead :)

- Bump maxautovchans from 4 to 16. For a full-fledged multimedia
desktop/workstation with too many soundservers installed (esound,
artsd, jackd, pulse/polypaudio, ding-dong pling plong mudkip fuh fuh,
etc), 4 seems inadequate. There will be no memory penalty here, since
virtual channels are allocate only by demand.

- Nuke/Rework the entire statically created cdev entries. Everything is
clonable through snd own clone manager which designed to withstand many
kind of abusive devfs droids such as:
* while : ; do /bin/test -e /dev/dsp ; done
* jot 16777216 0 | while read x ; do ls /dev/dsp0.$x ; done
* hundreds (could be thousands) concurrent threads/process opening
"/dev/dsp" (previously, this might result EBUSY even with just
3 contesting threads/procs).
o Reusable clone objects (instead of creating new one like there's no
tomorrow) after certain expiration deadline. The clone allocator will
decide whether to reuse, share, or creating new clone.
o Automatic garbage collector.

- Dynamic unit magic allocator. Maximum attached soundcards can be tuned
using tunable "hw.snd.maxunit" (Default to 512). Minimum is 16, and
maximum is 2048.

- ..other fixes, mostly related to concurrency issues.

joel@ will do the manpage updates on sound(4).

Have fun.


# 168243 02-Apr-2007 ariff

- Don't wakeup() unnecessarily, so the behavior of dead interrupt or
stalled DMA engine can be observed and predicted.
- Minor sysctl/tunable cleanup.


# 167663 17-Mar-2007 ariff

Fix long delay closing/syncing issues on mmaped buffer.


# 167645 16-Mar-2007 ariff

[stage: 5/9]

channel.c/channel_if.m:
- Macros cleanups, prefer inlined min() over MIN().
- Rework chn_read()/chn_write() for better dead interrupt detection
policy. Reduce scheduling overhead by doing pure 5 seconds sleep
before giving up, instead of several cycle of brute micro sleeping.
- Avoid calling wakeup_one() for non-sleeping channel (for example,
vchan parent channel).
- EWOULDBLOCK -> EAGAIN.
- Fix possible divide-by-zero panic on chn_sync().
- Re-enforce ^2 blocksize policy, since there are too many broken
userland apps that blindly assume it without even trying to do
serious calculations.
- New channel method - CHANNEL_SETFRAGMENTS(), a refined version of
CHANNEL_SETBLOCKSIZE(). It accept _both_ blocksize and blockcount
arguments, so the driver internals will have better hints for
buffering and timing calculations.
- Hook FEEDER_SWAPLR into feederchain building process.

feeder_fmt.c:
- Unified version of various filters, avoiding duplications.
- malloc()less feeder_fmt. Informations can be retrieved dynamically
by doing table lookup on static data. For cases such as converting
from stereo to mono or reducing bit depth where input data is larger
than output, cycle remaining available free space until it has been
exhausted and start kicking 8 bytes reservoir space from there to
complete the remaining requested count.
- Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several
extremely cheap uaudio stick, possibly others) mistakenly wired left
and right channels wrongly, screwing output or input.


# 167644 16-Mar-2007 ariff

[stage: 4/9]

- Rearrange FEEDER_* constants starting from 0 to 31, so the future
additions will be much easier and consistent.
- Introduce FEEDER_SWAPLR. Few super broken hardwares (found on several
extremely cheap uaudio stick, possibly others) mistakenly wired left
and right channels wrongly, screwing output or input.


# 164980 07-Dec-2006 ariff

Don't try to workaround broken apps (if any). If this still the case,
lets fix the broken apps instead.


# 164614 26-Nov-2006 ariff

Welcome to Once-a-year Sound Mega-Commit. Enjoy numerous updates and fixes
in every sense.

General
-------

- Multichannel safe, endian safe, format safe
* Large part of critical pcm filters such as vchan.c, feeder_rate.c,
feeder_volume.c, feeder_fmt.c and feeder.c has been rewritten so that
using them does not cause the pcm data to be converted to 16bit little
endian.
* Macrosses for accessing pcm data safely are defined within sound.h in
the form of PCM_READ_* / PCM_WRITE_*
* Currently, most of them are probably limited for mono/stereo handling,
but the future addition of true multichannel will be much easier.

- Low latency operation
* Well, this require lot more works to do not just within sound driver,
but we're heading towards right direction. Buffer/block sizing within
channel.c is rewritten to calculate precise allocation for various
combination of sample/data/rate size. As a result, applying correct
SNDCTL_DSP_POLICY value will achive expected latency behaviour simmilar
to what commercial 4front driver do.
* Signal handling fix. ctrl+c of "cat /dev/zero > /dev/dsp" does not
result long delay.
* Eliminate sound truncation if the sound data is too small.
DIY:
1) Download / extract
http://people.freebsd.org/~ariff/lowlatency/shortfiles.tar.gz
2) Do a comparison between "cat state*.au > /dev/dsp" and
"for x in state*.au ; do cat $x > /dev/dsp ; done"
- there should be no "perceivable" differences.
Double close for PR kern/31445.

CAVEAT: Low latency come with (unbearable) price especially for poorly
written applications. Applications that trying to act smarter
by requesting (wrong) blocksize/blockcount will suffer the most.
Fixup samples/patches can be found at:
http://people.freebsd.org/~ariff/ports/

- Switch minimum/maximum sampling rate limit to "1" and "2016000" (48k * 42)
due to closer compatibility with 4front driver.
Discussed with: marcus@ (long time ago?)

- All driver specific sysctls in the form of "hw.snd.pcm%d.*" have been
moved to their own dev sysctl nodes, notably:
hw.snd.pcm%d.vchans -> dev.pcm.%d.vchans
Bump __FreeBSD_version.

Driver specific
---------------

- Ditto for sysctls.

- snd_atiixp, snd_es137x, snd_via8233, snd_hda
* Numerous cleanups and fixes.
* _EXPERIMENTAL_ polling mode support using simple callout_* mechanisme.
This was intended for pure debugging and latency measurement, but proven
good enough in few unexpected and rare cases (such as problematic shared
IRQ with GIANT devices - USB). Polling can be enabled/disabled through
dev.pcm.0.polling. Disabled by default.

- snd_ich
* Fix possible overflow during speed calibration. Delay final
initialization (pcm_setstatus) after calibration finished.
PR: kern/100169
Tested by: Kevin Overman <oberman@es.net>
* Inverted EAPD for few Nec VersaPro.
PR: kern/104715
Submitted by: KAWATA Masahiko <kawata@mta.biglobe.ne.jp>

Thanks to various people, notably Joel Dahl, Yuriy Tsibizov, Kevin Oberman,
those at #freebsd-azalia @ freenode and others for testing.

Joel Dahl will do the manpage update.


# 162738 28-Sep-2006 ariff

Various fixups, especially for the upcomming High Definition Audio
commit.

1) sys/dev/sound/pcm/sound.h
sys/dev/sound/pcm/channel.c
* Be more specific: SD_F_SOFTVOL -> SD_F_SOFTPCMVOL
2) sys/dev/sound/pcm/mixer.[ch]
* Implement
mix_setparentchild()
mix_setrealdev()
mix_getparent()
mix_getchild()
The purpose of these functions is implement relative volume
adjustment, such as to tie two or more mixer device into a
single logical device. Usefull for the upcoming HDA driver
and few AC97 codec (such as AD1981B) where the master volume
"vol" need to be implemented using this logical manner.
3) sys/dev/sound/pcm/ac97_patch.[ch]
* Patch for AD1981B codec to enable (automuting) headphone jack sense.
4) sys/dev/sound/pcm/ac97.c
* Implement proper logical master volume for AD9181B codec
through various mix_set{parentchild,realdev}(). Tie both
"ogain" (headphone volume) and "phone" (speaker/lineout) to
a logical "vol".
5) sys/dev/sound/pcm/usb/uaudio_pcm.c
* ditto, for "vol" -> { "pcm" }.

MFC after: 1 month


# 162588 23-Sep-2006 netchild

MFp4 the sound Google Summer of Code project:

The goal was to sync with the OSSv4 API 4Front Technologies uses in their
proprietary OSS driver. This was successful as far as possible. The part
of the API which is stable is implemented, for the rest there are some
stubs already.

New system ioctls:
- SNDCTL_SYSINFO - obtain audio system info (version, # of audio/midi/
mixer devices, etc.)
- SNDCTL_AUDIOINFO - fetch details about a specific audio device
- SNDCTL_MIXERINFO - fetch details about a specific mixer device

New audio ioctls:
- Sync groups (SNDCTL_DSP_SYNCGROUP/SNDCTL_DSP_SYNCSTART) which allow
triggered playback/recording on multiple devices (even across processes
simultaneously).
- Peak meters (SNDCTL_DSP_GETIPEAKS/SNDCTL_DSP_GETOPEAKS) - can query
audio drivers for peak levels (needs driver support, disabled for now).
- Per channel playback/recording levels -
SNDCTL_DSP_{GET,SET}{PLAY,REC}VOL. Note that these are still in name
only, just wrapping around the AC97-style mixer at the moment. The next
step is to push them down to the drivers.

Audio ioctls still under development by 4Front (for which stubs may exist
in this commit):
- SNDCTL_GETNAME, SNDCTL_{GET,SET}{SONG,LABEL}
- SNDCTL_DSP_{GET,SET}_CHNORDER
- SNDCTL_MIX_ENUMINFO, SNDCTL_MIX_EXTINFO - (might be documented enough in
the OSS releases to work on this. These ioctls cover the cool "twiddle
any knob on your card" features.)

Missing:
- SNDCTL_DSP_COOKEDMODE -- this ioctl is used to give applications direct
access to a card's buffers, bypassing the feeder architecture. It's
a toughy -- "someone" needs to decide :
(a) if this is desireable, and (b) if it's reasonably feasible.

Updates for driver writers:
So far, only two routines to the channel class (in channel_if.m) are added.
One is for fetching a list of discrete supported playback/recording rates
of a channel, and the other is for fetching peak level info (useful for
drawing peak meters). Interested parties may want to help pushing down
SNDCTL_DSP_{GET,SET}{PLAY,REC}VOL into the drivers.

To use the new stuff you need to rebuild the sound drivers or your kernel
(depending on if you use modules or not) and to install soundcard.h (a
buildworld/installworld handles this).

Sponsored by: Google SoC 2006
Submitted by: ryanb
Many thanks to: 4Front Technologies for their cooperation, explanations
and the nice license of their soundcard.h.


# 156979 21-Mar-2006 ariff

Pointer align should be generic enough to handle awkward byte size
especially for true 24bit format.


# 154741 23-Jan-2006 ariff

channel.c:
(1) Fix DMA alignment, based on bytes per sample.

feeder_rate.c:
Handle strayed bytes (mostly caused by #1) better.

This DMA alignment issues are extremely hard to reproduce unless
the user happen to have a 32bit capable soundcards (ATI IXP) and
knowledgeable enough to force it to operate under pure 32bit
operations on both record and play directions.


# 154684 22-Jan-2006 ariff

Various fixups:

feeder.h:
feeder.c:
- Implement scoring mechanisme to select best format for conversion.
This is actually part of newer format chaining procedures which
will be commited someday. Confusion during chaining process solved
by this scoring since it will try to reduce list of from/to formats
to a single, best format.
Related PR: kern/91683
channel.c:
- Simplify feeder building process since we have smarter format
chaining.

feeder_fmt.c:
- Add few more sign conversion feeders for 24 and 32 bit format.

feeder_rate.c:
- Force buffer / bytes allignment. Unaligned buffer may cause
panics during recording on pure 32bit sample format if it
involves feeder_rate as part of feeders chain.
Tested on: ATI IXP, force 32bit recording.

MFC after: 5 days


# 153952 01-Jan-2006 ariff

Fix another xruns counting logic, this time, for recording.


# 153868 30-Dec-2005 ariff

Underruns counting logic should be based on bufhard free space
and must be done after sndbuf_feed(), or any attempt to fill
up bufhard. This should fix false underruns counter.


# 152446 15-Nov-2005 kan

Unbreak kernel builds.

Submitted by: arr


# 152425 14-Nov-2005 ariff

From luigi:
This one simply tries to simplify the logic to select the
buffer sizes. I am not sure it is necessary but the code
seems a bit more readable to me. And at least i have tried
to document how the buffer sizes are computed.

Thanks to luigi for deciphering one of the most cryptic part of
sound driver.

Submitted by: luigi
Approved by: netchild (mentor)


# 150825 02-Oct-2005 netchild

sys/dev/sound/pcm/ac97.c:
* Added codec id for CMI9761.
* feeder_volume *whitelist* through ac97_fix_volume()

sys/dev/sound/pcm/ac97.h:
* Added AC97_F_SOFTVOL definition.

sys/dev/sound/pcm/channel.c:
* Slight changes for chn_setvolume() to conform with OSS.
* FEEDER_VOLUME is now part of feeder building process.

sys/dev/sound/pcm/mixer.c:
* General spl* cleanup. It doesn't serve any purpose anymore.
* Main hook for feeder_volume.

Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by: multimedia@


# 149953 10-Sep-2005 netchild

- channel.h
* New definition CHN_F_HAS_VCHAN.
- channel.c
* Use CHN_F_HAS_VCHAN to mark channel with vchan capability instead
of relying on SLIST_EMPTY(&channel->children) == true for better
clarification and future possible usages of children (like
'slave' channel).
* Various fixes, including blocksize / format bps allignment,
better 24bit seeking (mplayer, others).
* Improve format chain building, it's now possible to record something
to a format non-native to the soundcard through various feeder format
converters or to higher sampling rate. This also gains another feature,
like doing vchan mixing on non s16le soundcard such as sb8.
- sound.c
* Increase robustness within various function that handle vchan
creation / termination (these function need a total rewrite, but
that would cause other major rewrite within various places too!).
As far as its robustness can be guaranteed, leave it as is.
* Optimize channel ordering, prefer *real* hardware playback
channels over virtual channels. cat /dev/sndstat should look
better.
* Increase sndstat verbosity to include bufsoft/bufhard allocation.
- vchan.c
* Fix LOR 119.
- http://sources.zabbadoz.net/freebsd/lor.html#119
* Reorder / increase robustness of vchan_create() / destroy().
Enforce destroy_dev() during destroy operation, fix possible
panic / dangling character device.
- http://lists.freebsd.org/pipermail/freebsd-current/2005-May/050308.html
* Tolerate a little bit more during mixing process, this should help
non s16le soundcards.

Note: Recoring in a non-native rate/format may result in overruns. A friendly
application is wavrec from audio/wavplay. The problem is under
investigation.

Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my>


# 148606 31-Jul-2005 netchild

Whats New:
1. Support wide range sampling rate, as low as 1hz up to int32 max
(which is, insane) through new feeder_rate, multiple precisions
choice (32/64 bit converter). This is indeed, quite insane, but it
does give us more room and flexibility. Plenty sysctl options to
adjust resampling characteristics.
2. Support 24/32 bit pcm format conversion through new, much improved,
simplified and optimized feeder_fmt.

Changes:
1. buffer.c / dsp.c / sound.h
* Support for 24/32 AFMT.
2. feeder_rate.c
* New implementation of sampling rate conversion with 32/64 bit
precision, 1 - int32max hz (which is, ridiculous, yet very
addictive). Much improved / smarter buffer management to not
cause any missing samples at the end of conversion process
* Tunable sysctls for various aspect:
hw.snd.feeder_rate_ratemin - minimum allowable sampling rate
(default to 4000)
hw.snd.feeder_rate_ratemax - maximum allowable sampling rate
(default to 1102500)
hw.snd.feeder_rate_buffersize - conversion buffer size
(default to 8192)
hw.snd.feeder_rate_scaling - scaling / conversion method
(please refer to the source for explaination). Default to
previous implementation type.
3. feeder_fmt.c / sound.h
* New implementation, support for 24/32bit conversion, optimized,
and simplified. Few routines has been removed (8 to xlaw, 16 to
8). It just doesn't make sense.
4. channel.c
* Support for 24/32 AFMT
* Fix wrong xruns increment, causing incorrect underruns statistic
while using vchans.
5. vchan.c
* Support for 24/32 AFMT
* Proper speed / rate detection especially for fixed rate ac97.
User can override it using kernel hint:
hint.pcm.<unit>.vchanrate="xxxx".

Notes / Issues:
* Virtual Channels (vchans)
Enabling vchans can really, really help to solve overrun
issues. This is quite understandable, because it operates
entirely within its own buffering system without relying on
hardware interrupt / state. Even if you don't need vchan,
just enable single channel can help much. Few soundcards
(notably via8233x, sblive, possibly others) have their own
hardware multi channel, and this is unfortunately beyond
vchan reachability.
* The arrival of 24/32 also come with a price. Applications
that can do 24/32bit playback need to be recompiled (notably
mplayer). Use (recompiled) mplayer to experiment / test /
debug this various format using -af format=fmt. Note that
24bit seeking in mplayer is a little bit broken, sometimes
can cause silence or loud static noise. Pausing / seeking
few times can solve this problem.
You don't have to rebuild world entirely for this. Simply
copy /usr/src/sys/sys/soundcard.h to
/usr/include/sys/soundcard.h would suffice. Few drivers also
need recompilation, and this can be done via
/usr/src/sys/modules/sound/.
Support for 24bit hardware playback is beyond the scope of
this changes. That would require spessific hardware driver
changes.
* Don't expect playing 9999999999hz is a wise decision. Be
reasonable. The new feeder_rate implemention provide
flexibility, not insanity. You can easily chew up your CPU
with this kind of mind instability. Please use proper
mosquito repellent device for this obvious cracked brain
attempt. As for testing purposes, you can use (again)
mplayer to generate / play with different sampling rate. Use
something like "mplayer -af resample=192000:0:0 <files>".

Submitted by: Ariff Abdullah <skywizard@MyBSD.org.my>
Tested by: multimedia@


# 147274 10-Jun-2005 marius

Wrap the calls to the ISA DMA specific sndbuf_dma*() functions of
sys/dev/sound/isa/sndbuf_dma.c (compilation depending on device isa)
in #ifdef DEV_ISA so sound(4) can be compiled without isa(4).

MFC after: 1 month


# 139749 05-Jan-2005 imp

Start each of the license/copyright comments with /*-, minor shuffle of lines


# 126367 28-Feb-2004 truckman

Create a new mutex type for virtual channels. This allows us to get
rid of the MTX_DUPOK flag on channel mutexes, which allows witness to
do a better job of lock order checking. Nuke snd_chnmtxcreate() since
it is no longer needed.

Tested by: matk


# 126030 19-Feb-2004 matk

Fix a glitch in my last commit and revert to using selwakeuppri

Noticed by: tanimura
Noticed by: truckman


# 125982 18-Feb-2004 matk

Fix a long-standing bug where select on vchans doesn't work
(never wake up) by iterating over them when they exist.

Approved by: tanimura (mentor)


# 125136 28-Jan-2004 truckman

Change KASSERT() in feed_vchan16() into an explicit test and call to
panic() so that the buffer overflow just beyond this point is always
caught, even when the code is not compiled with INVARIANTS.

Change chn_setblocksize() buffer reallocation code to attempt to avoid
the feed_vchan16() buffer overflow by attempting to always keep the
bufsoft buffer at least as large as the bufhard buffer.

Print a diagnositic message
Danger! %s bufsoft size increasing from %d to %d after CHANNEL_SETBLOCKSIZE()
if our best attempts fail. If feed_vchan16() were to be called by
the interrupt handler while locks are dropped in chn_setblocksize()
to increase the size bufsoft to match the size of bufhard, the panic()
code in feed_vchan16() will be triggered. If the diagnostic message
is printed, it is a warning that a panic is possible if the system
were to see events in an "unlucky" order.

Change the locking code to avoid the need for MTX_RECURSIVE mutexes.

Add the MTX_DUPOK option to the channel mutexes and change the locking
sequence to always lock the parent channel before its children to avoid
the possibility of deadlock.

Actually implement locking assertions for the channel mutexes and fix
the problems found by the resulting assertion violations.

Clean up the locking code in dsp_ioctl().

Allocate the channel buffers using the malloc() M_WAITOK option instead
of M_NOWAIT so that buffer allocation won't fail. Drop locks across
the malloc() calls.

Add/modify KASSERTS() in attempt to detect problems early.

Abuse layering by adding a pointer to the snd_dbuf structure that points
back to the pcm_channel that owns it. This allows sndbuf_resize() to do
proper locking without having to change the its API, which is used by
the hardware drivers.

Don't dereference a NULL pointer when setting hw.snd.maxautovchans
if a hardware driver is not loaded. Noticed by Ryan Sommers
<ryans at gamersimpact.com>.

Tested by: Stefan Ehmann <shoesoft AT gmx.net>
Tested by: matk (Mathew Kanner)
Tested by: Gordon Bergling <gbergling AT 0xfce3.net>


# 123156 05-Dec-2003 matk

Fix some locking violations by creating seperate mutex classes
for play and record channels.

Approved by: seigo (mentor)
Approved by: scottl (re)


# 123013 27-Nov-2003 matk

Fix a panic due to holding a lock over calls to uiomove.

Pointed out by: Artur Poplawski
Explained by: Don Lewis (truckman)
Approved by: tanimura (mentor)
Approved by: scottl (re)


# 122352 09-Nov-2003 tanimura

- Implement selwakeuppri() which allows raising the priority of a
thread being waken up. The thread waken up can run at a priority as
high as after tsleep().

- Replace selwakeup()s with selwakeuppri()s and pass appropriate
priorities.

- Add cv_broadcastpri() which raises the priority of the broadcast
threads. Used by selwakeuppri() if collision occurs.

Not objected in: -arch, -current


# 119853 07-Sep-2003 cg

update my email address.


# 119095 18-Aug-2003 cg

try to make really sshort sounds actually play


# 111550 26-Feb-2003 orion

Replicate OSS behaviour when rate settings fails.

PR: kern/26563


# 110499 07-Feb-2003 nyan

- Clean up ISA DMA supports.
- Rename all sndbuf_isadma* functions to sndbuf_dma* and move them into
sys/dev/sound/isa/sndbuf_dma.c.

No response from: sound


# 110233 02-Feb-2003 alfred

remove MIN now that it's a standard kernel define


# 107237 25-Nov-2002 cg

various fixes to eliminate locking warnings

Approved by: re
Reviewed by: orion


# 102291 22-Aug-2002 archie

Replace (ab)uses of "NULL" where "0" is really meant.


# 93816 04-Apr-2002 jhb

Add lock type arguments to callers of snd_mtxcreate().


# 92252 13-Mar-2002 alfred

Fixes to make select/poll mpsafe.

Problem:
selwakeup required calling pfind which would cause lock order
reversals with the allproc_lock and the per-process filedesc lock.
Solution:
Instead of recording the pid of the select()'ing process into the
selinfo structure, actually record a pointer to the thread. To
avoid dereferencing a bad address all the selinfo structures that
are in use by a thread are kept in a list hung off the thread
(protected by sellock). When a selwakeup occurs the selinfo is
removed from that threads list, it is also removed on the way out
of select or poll where the thread will traverse its list removing
all the selinfos from its own list.

Problem:
Previously the PROC_LOCK was used to provide the mutual exclusion
needed to ensure proper locking, this couldn't work because there
was a single condvar used for select and poll and condvars can
only be used with a single mutex.
Solution:
Introduce a global mutex 'sellock' which is used to provide mutual
exclusion when recording events to wait on as well as performing
notification when an event occurs.

Interesting note:
schedlock is required to manipulate the per-thread TDF_SELECT
flag, however if given its own field it would not need schedlock,
also because TDF_SELECT is only manipulated under sellock one
doesn't actually use schedlock for syncronization, only to protect
against corruption.

Proc locks are no longer used in select/poll.

Portions contributed by: davidc


# 91186 23-Feb-2002 des

Add a sysctl, sysctl hw.snd.report_soft_formats, that controls whether the
AIOGCAP ioctl reports software-emulated formats. It defaults to on. People
who use performance-sensitive audio software and do not want it to pick a
software-emulated audio format instead of one supported by their hardware
should turn it off.

This unbreaks isdnphone(1) on systems with PCM-only sound cards.

Approved by: cg


# 89834 26-Jan-2002 cg

* improve error handling
* be more specific in verbose boot messages
* allow the feeder subsystem to veto pcm* attaching if there is an error
initialising the root feeder
* don't free/malloc a new tmpbuf when resizing a snd_dbuf to the same size as
it currently is
* store the feeder description in the feeder structure instead of mallocing
space for it


# 89774 25-Jan-2002 scottl

Fix code that had rotted behind debugging macros.

Approved by: cg (in principle)
MFC after: 2 weeks


# 89770 25-Jan-2002 cg

cosmetic change, free b instead of c->bufhard for consistency within
chn_kill()


# 89689 23-Jan-2002 cg

fix some comments accidentally hit by search/replace several revisions ago


# 89688 23-Jan-2002 cg

set the speeds the right way round for recording using the rate feeder


# 89687 23-Jan-2002 cg

add more error checking in chn_init() and chn_reset()


# 89686 23-Jan-2002 cg

make the feederchain builder work for recording. this has not been tested
extensively as none of my testboxes have speakers or an audio source at
present, but the chains built look correct and reading /dev/audio (ulaw,
translated from signed 16 bit little-endian) gives values within the
expected range for silence.


# 88382 21-Dec-2001 cg

fix mmapped playback
remove dead debugging code


# 87599 10-Dec-2001 obrien

Update to C99, s/__FUNCTION__/__func__/,
also don't use ANSI string concatenation.


# 85406 24-Oct-2001 cg

improve recording behaviour


# 83805 21-Sep-2001 jhb

Use the passed in thread to selrecord() instead of curthread.


# 83613 18-Sep-2001 cg

add a tunable/sysctl, hw.snd.targetirqrate, to modify the default target
irq rate for apps that do not set a blocksize.


# 83366 12-Sep-2001 julian

KSE Milestone 2
Note ALL MODULES MUST BE RECOMPILED
make the kernel aware that there are smaller units of scheduling than the
process. (but only allow one thread per process at this time).
This is functionally equivalent to teh previousl -current except
that there is a thread associated with each process.

Sorry john! (your next MFC will be a doosie!)

Reviewed by: peter@freebsd.org, dillon@freebsd.org

X-MFC after: ha ha ha ha


# 83089 05-Sep-2001 cg

add a method for recording of specific channels for devices with more than
one hardware record channel. new devices, /dev/dsprX.Y where X is unit
number and Y is channel index.


# 83081 05-Sep-2001 cg

don't try to dump nonexistent data when recording


# 82492 29-Aug-2001 cg

tweaks to reduce latency/pauses in output


# 82479 29-Aug-2001 cg

add some extra diagnostic info to sndstat output.


# 82381 26-Aug-2001 cg

now we have the rate feeder, we don't need to constrain the default channel
speed. however, continue to do so for record channels until the feederchain
builder is fixed.


# 82182 23-Aug-2001 cg

MFS: make SNDCTL_DSP_SETTRIGGER work


# 82180 23-Aug-2001 cg

many changes:

* add new channels to the end of the list so channels used in order of
addition

* de-globalise definition of struct snddev_info and provide accessor
functions where necessary.

* move the $FreeBSD$ tag in each .c file into a macro and allow the
/dev/sndstat handler to display these when set to maximum verbosity to aid
debugging.

* allow each device to register its own sndstat handler to reduce the amount
of groping sndstat must do in foreign structs.


# 78670 23-Jun-2001 cg

add defines and ifdefs so this code will compile on 4.x

add spls so this code will work on 4.x


# 78362 16-Jun-2001 cg

use a global devclass for all drivers - i'm not entirely sure why this
worked before.

mixer, dsp and sndstat are seperate devices - give them their own cdevsws
instead of demuxing requests sent to a single cdevsw.

use the si_drv1/si_drv2 fields in dev_t structures for holding information
specific to an open instance of mixer/dsp.

nuke /dev/{dsp,dspW,audio}[0-9]* links - this functionality is now provided
using cloning.

various locking fixes.


# 78214 14-Jun-2001 cg

various locking fixes, rework open logic and channel registration

PR: kern/28084


# 77882 07-Jun-2001 cg

lock sound device when adding/removing channels
implement setblocksize for vchans
don't panic when doing certain ioctls or aborting on a vchan
xmms now works with vchans


# 77269 27-May-2001 cg

beginnings of virtual playback channel support

instead of using two malloced arrays for storing channel lists, use an
slist. convert the sndstat device to use sbufs and optionally provide more
detail about channel state.

vchans are software mixed playback channels. they are not enabled by this
commit. they use the feeder infrastructure to emulate normal playback
channels in a manner transparent to applications, whilst providing as many
channels are desired, especially suitable for devices with only one hardware
playback channel. in the future they will provide additional features.

those wishing to test this functionality will need to add vchan.c to
sys/conf/files and use 'sysctl -w hw.snd.pcm0.vchans' to enable it.

blocksize and auto-rate selection are not yet supported.


# 76115 29-Apr-2001 cg

don't unlock the channel in chn_read, msleep will do it for us.

PR: kern/26430


# 75319 08-Apr-2001 cg

minor tweaks in speed and format setting routines.

don't stop exploring the feeders if a feeder fails to initialise.


# 74797 25-Mar-2001 cg

fix whitespace bogons


# 74763 24-Mar-2001 cg

mega-commit.

this introduces a new buffering mechanism which results in dramatic
simplification of the channel manager.

as several structures have changed, we take the opportunity to move their
definitions into the source files where they are used, make them private and
de-typedef them.

the sound drivers are updated to use snd_setup_intr instead of
bus_setup_intr, and to comply with the de-typedefed structures.

the ac97, mixer and channel layers have been updated with finegrained
locking, as have some drivers- not all though. the rest will follow soon.


# 72457 13-Feb-2001 cg

make attempts to set unsupported speeds or formats non-sticky. this should
fix problems with apps that probe for a variety of settings.

Submitted by: Orion Hodson <O.Hodson@cs.ucl.ac.uk>


# 72136 07-Feb-2001 cg

back out rev 1.49, looks like i committed it from the wrong tree.

include the changes 1.49 was supposed to have.

Noticed by: peter


# 72118 07-Feb-2001 cg

conditionalize "hwptr went backwards" messages

modify default buffer size heuristic to not max out at 4k. mpg123 should now
behave better under load.


# 71502 23-Jan-2001 cg

prevent excessively small buffer sizes resulting in hundreds of irqs per
second


# 70300 23-Dec-2000 cg

fix a panic if the requested blocksize was greater than the data rate,
resulting in a divide by 0.


# 70297 23-Dec-2000 cg

fix a typo


# 70291 23-Dec-2000 cg

update code dealing with snd_dbuf objects to do so using a functional interface

modify chn_setblocksize() to pick a default soft-blocksize appropriate to the
sample rate and format in use. it will aim for a power of two size small
enough to generate block sizes of at most 20ms. it will also set the
hard-blocksize taking into account rate/format conversions in use.

update drivers to implement setblocksize correctly:
updated, tested: sb16, emu10k1, maestro, solo
updated, untested: ad1816, ess, mss, sb8, csa
not updated: ds1, es137x, fm801, neomagic, t4dwave, via82c686

i lack hardware to test: ad1816, csa, fm801, neomagic
others will be updated/tested in the next few days.


# 70134 17-Dec-2000 cg

kobjify.

this gives us several benefits, including:

* easier extensibility- new optional methods can be added to
ac97/mixer/channel classes without having to fixup every driver.

* forward compatibility for drivers, provided no new mandatory methods are
added.


# 68872 18-Nov-2000 cg

do not blindly assume 8khz is supported on open(). try for 8khz but respect
minspeed/maxspeed specified by the hw driver.

Submitted by: Andrew Gordon <arg@arg1.demon.co.uk>


# 68413 06-Nov-2000 cg

slight mods to isa dma and channel flushing code


# 67652 26-Oct-2000 cg

add reinit functions to mixers
unstaticize chn_start()
add reset/resetdone functions to channels


# 66308 23-Sep-2000 cg

prepare for adding a rate conversion feeder.

move format conversion feeders to feeder_fmt.c - no pertinent history so no
repo-copy.


# 65644 09-Sep-2000 cg

detach support
remove un-needed setdir functions
add bus_teardown_intr calls where necessary
destroy our dma tags where necessary
destroy ac97 before releasing resources


# 65488 05-Sep-2000 cg

allow a null setdir implementation


# 65340 01-Sep-2000 cg

change mixer api slightly
change channel interface - kobj implementation coming soonish
make pcm_makelinks not panic if modular
add pcm_unregister()

these changes support newpcm kld unloading, but this is only implemented
by ds1.c


# 65209 29-Aug-2000 cg

make the test for hwptr going backwards more picky- now it only triggers if
15/16 of the buffer is skipped or we go backwards by < 1/16 of buffer size.


# 64881 20-Aug-2000 cg

rework feeder sytem to allow feeders in klds

modify driver capability reporting format to list every audio format
seperately- required for above and because we could not previously indicate
that mono was unsupported.

there should be no functional impact.


# 64438 08-Aug-2000 cg

warn if hwptr goes backwards


# 64030 30-Jul-2000 cg

fix a potential local DoS attack


# 61887 20-Jun-2000 cg

add record channel irq timeouts too


# 61886 20-Jun-2000 cg

fix a bug where opening for write would not fail if channel allocation failed

when playing, if we stall for 1s with no data advancing, abort and mark the
channel dead - fail all future operations


# 61753 17-Jun-2000 cg

replace a line erroneously removed in 1.28, should fix xmms
make buf_clear handle unaligned lengths


# 61642 13-Jun-2000 cg

handle closing differently - should fix the end-of-sample cutoff bug


# 61345 06-Jun-2000 cg

improve recording


# 60961 26-May-2000 cg

move various fields from pcm_channel to snd_dbuf

improve chn_read code- don't stop/restart on overrun, just dump data

more error checking on ioctls


# 59994 04-May-2000 cg

fix the 100% cpu in xmms issue


# 59577 23-Apr-2000 cg

implement settrigger according to spec

fixes for non-blocking mode


# 59324 17-Apr-2000 cg

more mmap fixes


# 59246 15-Apr-2000 cg

make mmap sort-of work. there seem to be interactions with certain hw
drivers, so still work in progress.

do various mmap-related ioctls right.

improve blocksize control.

bits of cleanup.


# 59030 05-Apr-2000 cg

make poll() dtrt, previously when playing it would trigger if there was less
than 1 byte ready to play instead of room for at least 1 byte to be written.
similarly for recording.


# 58117 15-Mar-2000 n_hibma

Spelling mistake


# 57973 13-Mar-2000 phk

Stop isadma from abusing the B_READ, B_RAW and B_WRITE flags.

Define ISADMA_{READ,WRITE,RAW} macros with the same numeric
values as the B_{READ,WRITE,RAW} and use them instead throughout.


# 56253 18-Jan-2000 cg

kludge to fix the end-of-sample repeating bug. i don't know why it happens;
none of my hw does it, but this should fix it for now.

Tested by: wpaul


# 55646 09-Jan-2000 cg

fix the premature termination of playback


# 55483 05-Jan-2000 cg

don't panic if channel init fails, report and fail gracefully


# 55428 05-Jan-2000 cg

argh, forgot the bus_dma_tag_creates.
also, panic if channel init fails instead of derefing null.


# 55204 29-Dec-1999 cg

- latest 2ndbuffer patch
- make chn_setdir work for rec on isa cards
- note: es1371 does not irq in smp

Submitted by: tanimura


# 54942 21-Dec-1999 cg

minor cleanup

Parts Submitted by: Ville-Pertti Keinonen <will@ztango.com>


# 54888 20-Dec-1999 cg

minor cosmetics


# 54849 19-Dec-1999 cg

stop playing if we underrun; if there is more data to come, the next write
will restart


# 54792 18-Dec-1999 cg

fix the buffer repetition on ^c problem


# 54535 13-Dec-1999 cg

more dma underrun fixes, using a per-channel 2nd buffer

Submitted by: tanimura


# 54155 05-Dec-1999 cg

fix dma underrun issues
mutate some panics to kasserts
add more spl protection

PR: kern/14990
Partially Submitted by: Vladimir N.Silyaev <vns@delta.odessa.ua>
Reviewed by: dfr


# 53603 22-Nov-1999 cg

fix panic for large writes in non-blocking mode


# 53512 21-Nov-1999 cg

fix for -fno-builtin

PR: kern/14278


# 53465 20-Nov-1999 cg

repo-copied to make way for newmidi, this commit updates include paths


# 53205 15-Nov-1999 cg

this is a full fix for writes not aligned to the sample size selected.
should be a no-op in most cases.


# 51769 28-Sep-1999 cg

* add a non-reset device- will not reset the channel on open. you
will have to mknod yourself for now.
* don't eat the first write()
* partial rvplayer fix- don't panic on unaligned writes unless our
feeder chain requires them for downconversion. a fuller fix is
on the way.


# 51095 08-Sep-1999 cg

fix a bug with cat >/dev/{dsp,dspW,audio} hanging


# 50733 01-Sep-1999 peter

$Id$ -> $FreeBSD$


# 50724 01-Sep-1999 cg

say hello to newpcm. it is not yet enabled, requiring new pnp code from dfr
to compile successfully. further details will be provided in the commit
enabling newpcm.