summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/sound.c
Commit message (Collapse)AuthorAgeFilesLines
* Nuke a cryptic and useless diagnostic printf().truckman2004-06-071-1/+0
|
* Create a new mutex type for virtual channels. This allows us to gettruckman2004-02-281-20/+6
| | | | | | | | 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
* Change KASSERT() in feed_vchan16() into an explicit test and call totruckman2004-01-281-19/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Fix a panic when kldloading a sound driver. Do this by replacing thematk2004-01-201-96/+48
| | | | | | link-list of dev_t's with named variables. Remove used code. Approved by: tanimura (mentor)
* As previously announced: discontinue use of makedev() call in soundcode.phk2004-01-171-25/+87
| | | | | | | | | | | This takes us a lot closer to refcounting dev_t. This patch originally by cg@ with a few minor changes by me. It is largely untested, but has been HEADSUP'ed twice, so presumably people have not found any issues with it. Submitted by: cg@
* The last argument to mtx_init() should be MTX_DEF, not 0. This is not atruckman2003-12-081-1/+1
| | | | functional change since MTX_DEF happens to be defined as 0.
* update my email address.cg2003-09-071-1/+1
|
* handle locking when creating or destroying vchans bettercg2003-08-181-29/+66
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-4/+4
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-4/+4
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Don't call destroy_dev it a channel has children.cognet2003-01-141-1/+1
| | | | | | | | | | vchan creation doesn't lead to /dev entry creation if the new vchan is the first child of a channel, This fix a panic that happens when loading a sound driver module, creating vchans and unloading the driver. Approved by: cg MFC after: 3 days
* (hopefully) fix build breakage some people are seeingcg2002-11-261-1/+1
| | | | Approved by: re
* various fixes to eliminate locking warningscg2002-11-251-19/+23
| | | | | Approved by: re Reviewed by: orion
* Call pcm_chn_destroy() in pcm_killchan() so that channel mutexes are ↵cognet2002-11-041-1/+7
| | | | | | | destroyed and struct pcm_channel freed. Reviewed by: cg MFC after: 3 days
* Be sure to unregister from sndstat on unregister. Gets rid of phantomnsayer2002-08-241-0/+1
| | | | sndstat output after removing uaudio.
* Fix some of the places where sound(4) can sleep with a lock held. (Helpgreen2002-07-251-2/+13
| | | | courtesy of fenner).
* Fix the sound driver vchan support to work when hw.snd.maxautovchanskan2002-07-231-1/+2
| | | | | | | | | | has been specified through /boot/loader.conf as opposed to setting it in /etc/sysctl.conf. Only PCMDIR_PLAY channel can be used as a parent of virtual channel. Do not initialize a new vchan for a given physical channel if other physical channel already has one created. PR: 31597 Approved by: obrien (mentor)
* Move lock in pcm_chn_add() to after malloc.orion2002-07-221-3/+2
| | | | | PR: kern/40157 Submitted by: Dan Lukes <dan@obluda.cz>
* Try and solve some cases of labels at end of compound statements that gccpeter2002-05-191-7/+5
| | | | now objects to (as it should, it is not legal C).
* add a missing \n to an unregister failure messagecg2002-04-281-1/+1
|
* Change snd_mtxcreate() to accept a lock type as an extra argument that isjhb2002-04-041-3/+3
| | | | passed to mtx_init().
* * improve error handlingcg2002-01-261-0/+8
| | | | | | | | | | * 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
* Fix code that had rotted behind debugging macros.scottl2002-01-251-0/+1
| | | | | Approved by: cg (in principle) MFC after: 2 weeks
* improve sndstat output of feederchains so it can be understood withoutcg2002-01-231-11/+20
| | | | reading the feeder sourcecode
* print warnings if a pcm*.buffersize hint is out of range or a non-power-of-2cg2002-01-231-3/+17
|
* change tracking of channel counts.cg2001-09-181-23/+51
| | | | | add method for retrieving "buffersize" hints for pcm devices, adjusted for specified minimum, maximum and default values.
* - Correctly increment the channel refcount in dsp_open() such that it isgreid2001-09-141-3/+8
| | | | | | | | | | | no longer possible to unload the driver module while sound is playing (which resulted in a panic). - Fix a similar problem with the sndstat device that I found while looking at the above. - Append a newline character to error messages in pcm_unregister() Reviewed by: cg MFC after: 10 days
* add a method for recording of specific channels for devices with more thancg2001-09-051-8/+24
| | | | | one hardware record channel. new devices, /dev/dsprX.Y where X is unit number and Y is channel index.
* tweaks to reduce latency/pauses in outputcg2001-08-291-5/+5
|
* add some extra diagnostic info to sndstat output.cg2001-08-291-7/+21
|
* many changes:cg2001-08-231-51/+301
| | | | | | | | | | | | | | | * 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.
* remove obsolete typedefs.cg2001-07-031-0/+1
| | | | only define INTR_TYPE_AV if it is not already defined.
* Correct obviously wrong mistakes.green2001-07-021-1/+1
|
* make it compile again in -currentmjacob2001-07-021-1/+1
|
* Make all this compile on 4.3, modulus sbuf.green2001-07-021-1/+6
|
* don't flag the playback hardchan as busy on devices with only one of them.cg2001-06-271-8/+55
| | | | | | | | if a device has vchans already but they are all busy, allocate another one at open() time, up to a maximum of hw.snd.maxvchans. when creating/destroying vchans, don't make/remove a devnode for the first/last one as it replaces a hardchan.
* add a tunable/sysctl, hw.snd.autovchans. if this is set to a value n wherecg2001-06-261-4/+45
| | | | | n > 0, n vchans will be assigned to any devices that subsequently register with a single playback channel.
* add defines and ifdefs so this code will compile on 4.xcg2001-06-231-0/+2
| | | | add spls so this code will work on 4.x
* use devclass_get_maxunit() correctlycg2001-06-181-1/+1
|
* revise dsp_clone() to return the first nonbusy channel instead of simplycg2001-06-171-3/+2
| | | | | | cycling channel numbers. remove unused fields from struct snddev_info.
* Use INTR_TYPE_AV for the interrupt handlers because:peter2001-06-161-2/+2
| | | | | | | | | 1: most drivers are sensitive to timing, and 2: the handlers are MPSAFE and need a chance to get into the kernel before some other non-mpsafe handler blocks the ithread on Giant in shared irq cases. Reviewed by: cg (in principle)
* use a global devclass for all drivers - i'm not entirely sure why thiscg2001-06-161-586/+16
| | | | | | | | | | | | | | | 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.
* various locking fixes, rework open logic and channel registrationcg2001-06-141-52/+129
| | | | PR: kern/28084
* sbuf_new(9) now returns a struct sbuf * instead of an int. If the callerdes2001-06-101-1/+1
| | | | | does not provide a struct sbuf, sbuf_new(9) will allocate one and return a pointer to it.
* "Fix" the previous initial attempt at fixing TUNABLE_INT(). This timepeter2001-06-081-1/+1
| | | | | | | around, use a common function for looking up and extracting the tunables from the kernel environment. This saves duplicating the same function over and over again. This way typically has an overhead of 8 bytes + the path string, versus about 26 bytes + the path string.
* lock sound device when adding/removing channelscg2001-06-071-2/+42
| | | | | | implement setblocksize for vchans don't panic when doing certain ioctls or aborting on a vchan xmms now works with vchans
* Back out part of my previous commit. This was a last minute changepeter2001-06-071-1/+1
| | | | | and I botched testing. This is a perfect example of how NOT to do this sort of thing. :-(
* Make the TUNABLE_*() macros look and behave more consistantly like thepeter2001-06-061-2/+2
| | | | | SYSCTL_*() macros. TUNABLE_INT_DECL() was an odd name because it didn't actually declare the int, which is what the name suggests it would do.
* beginnings of virtual playback channel supportcg2001-05-271-145/+293
| | | | | | | | | | | | | | | | | 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.
* Send the remains (such as I have located) of "block major numbers" tophk2001-03-261-1/+0
| | | | the bit-bucket.
OpenPOWER on IntegriCloud