summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/channel.c
Commit message (Collapse)AuthorAgeFilesLines
* Wrap the calls to the ISA DMA specific sndbuf_dma*() functions ofmarius2005-06-101-0/+10
| | | | | | | 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
* Start each of the license/copyright comments with /*-, minor shuffle of linesimp2005-01-061-1/+1
|
* Create a new mutex type for virtual channels. This allows us to gettruckman2004-02-281-7/+17
| | | | | | | | 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
* Fix a glitch in my last commit and revert to using selwakeupprimatk2004-02-201-1/+1
| | | | | Noticed by: tanimura Noticed by: truckman
* Fix a long-standing bug where select on vchans doesn't workmatk2004-02-191-3/+13
| | | | | | (never wake up) by iterating over them when they exist. Approved by: tanimura (mentor)
* Change KASSERT() in feed_vchan16() into an explicit test and call totruckman2004-01-281-23/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 some locking violations by creating seperate mutex classesmatk2003-12-051-3/+6
| | | | | | | for play and record channels. Approved by: seigo (mentor) Approved by: scottl (re)
* Fix a panic due to holding a lock over calls to uiomove.matk2003-11-271-2/+39
| | | | | | | Pointed out by: Artur Poplawski Explained by: Don Lewis (truckman) Approved by: tanimura (mentor) Approved by: scottl (re)
* - Implement selwakeuppri() which allows raising the priority of atanimura2003-11-091-1/+1
| | | | | | | | | | | | | 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
* update my email address.cg2003-09-071-1/+1
|
* try to make really sshort sounds actually playcg2003-08-181-16/+43
|
* Replicate OSS behaviour when rate settings fails.orion2003-02-261-1/+1
| | | | PR: kern/26563
* - Clean up ISA DMA supports.nyan2003-02-071-4/+4
| | | | | | | - Rename all sndbuf_isadma* functions to sndbuf_dma* and move them into sys/dev/sound/isa/sndbuf_dma.c. No response from: sound
* remove MIN now that it's a standard kernel definealfred2003-02-021-1/+0
|
* various fixes to eliminate locking warningscg2002-11-251-7/+11
| | | | | Approved by: re Reviewed by: orion
* Replace (ab)uses of "NULL" where "0" is really meant.archie2002-08-221-1/+1
|
* Add lock type arguments to callers of snd_mtxcreate().jhb2002-04-041-1/+1
|
* Fixes to make select/poll mpsafe.alfred2002-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Add a sysctl, sysctl hw.snd.report_soft_formats, that controls whether thedes2002-02-241-1/+9
| | | | | | | | | | | 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
* * improve error handlingcg2002-01-261-24/+30
| | | | | | | | | | * 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-3/+3
| | | | | Approved by: cg (in principle) MFC after: 2 weeks
* cosmetic change, free b instead of c->bufhard for consistency withincg2002-01-251-1/+1
| | | | chn_kill()
* fix some comments accidentally hit by search/replace several revisions agocg2002-01-231-3/+3
|
* set the speeds the right way round for recording using the rate feedercg2002-01-231-4/+7
|
* add more error checking in chn_init() and chn_reset()cg2002-01-231-30/+61
|
* make the feederchain builder work for recording. this has not been testedcg2002-01-231-6/+14
| | | | | | | 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.
* fix mmapped playbackcg2001-12-211-7/+6
| | | | remove dead debugging code
* Update to C99, s/__FUNCTION__/__func__/,obrien2001-12-101-5/+5
| | | | also don't use ANSI string concatenation.
* improve recording behaviourcg2001-10-241-5/+10
|
* Use the passed in thread to selrecord() instead of curthread.jhb2001-09-211-1/+1
|
* add a tunable/sysctl, hw.snd.targetirqrate, to modify the default targetcg2001-09-181-2/+22
| | | | irq rate for apps that do not set a blocksize.
* KSE Milestone 2julian2001-09-121-2/+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
* add a method for recording of specific channels for devices with more thancg2001-09-051-2/+2
| | | | | one hardware record channel. new devices, /dev/dsprX.Y where X is unit number and Y is channel index.
* don't try to dump nonexistent data when recordingcg2001-09-051-1/+1
|
* tweaks to reduce latency/pauses in outputcg2001-08-291-3/+6
|
* add some extra diagnostic info to sndstat output.cg2001-08-291-11/+19
|
* now we have the rate feeder, we don't need to constrain the default channelcg2001-08-271-1/+3
| | | | | speed. however, continue to do so for record channels until the feederchain builder is fixed.
* MFS: make SNDCTL_DSP_SETTRIGGER workcg2001-08-231-1/+1
|
* many changes:cg2001-08-231-4/+4
| | | | | | | | | | | | | | | * 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.
* add defines and ifdefs so this code will compile on 4.xcg2001-06-231-0/+4
| | | | add spls so this code will work on 4.x
* use a global devclass for all drivers - i'm not entirely sure why thiscg2001-06-161-10/+1
| | | | | | | | | | | | | | | 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-2/+1
| | | | PR: kern/28084
* lock sound device when adding/removing channelscg2001-06-071-7/+17
| | | | | | implement setblocksize for vchans don't panic when doing certain ioctls or aborting on a vchan xmms now works with vchans
* beginnings of virtual playback channel supportcg2001-05-271-22/+113
| | | | | | | | | | | | | | | | | 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.
* don't unlock the channel in chn_read, msleep will do it for us.cg2001-04-291-2/+0
| | | | PR: kern/26430
* minor tweaks in speed and format setting routines.cg2001-04-081-35/+42
| | | | don't stop exploring the feeders if a feeder fails to initialise.
* fix whitespace bogonscg2001-03-251-33/+33
|
* mega-commit.cg2001-03-241-848/+464
| | | | | | | | | | | | | | | 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.
* make attempts to set unsupported speeds or formats non-sticky. this shouldcg2001-02-131-3/+30
| | | | | | fix problems with apps that probe for a variety of settings. Submitted by: Orion Hodson <O.Hodson@cs.ucl.ac.uk>
* back out rev 1.49, looks like i committed it from the wrong tree.cg2001-02-071-424/+803
| | | | | | include the changes 1.49 was supposed to have. Noticed by: peter
OpenPOWER on IntegriCloud