summaryrefslogtreecommitdiffstats
path: root/sys/dev/sound/pcm/vchan.c
Commit message (Collapse)AuthorAgeFilesLines
* Change KASSERT() in feed_vchan16() into an explicit test and call totruckman2004-01-281-4/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+5
| | | | | | 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-1/+1
| | | | | | | | | | | 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@
* update my email address.cg2003-09-071-1/+1
|
* Back out M_* changes, per decision of the TRB.imp2003-02-191-2/+2
| | | | Approved by: trb
* Remove mono encodings from vchan format and mixer description. Fixesorion2003-02-031-2/+0
| | | | | mono formats at 44.1kHz playing at double speed when vchans are enabled.
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-2/+2
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* various fixes to eliminate locking warningscg2002-11-251-9/+7
| | | | | Approved by: re Reviewed by: orion
* Use semicolons at the end of function-like macros for the sake ofmarkm2002-07-151-1/+1
| | | | consistency, style and future cleanliness.
* make mmapped vchans workcg2001-12-231-0/+2
|
* many changes:cg2001-08-231-89/+8
| | | | | | | | | | | | | | | * 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.
* don't flag the playback hardchan as busy on devices with only one of them.cg2001-06-271-8/+10
| | | | | | | | 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-0/+5
| | | | | n > 0, n vchans will be assigned to any devices that subsequently register with a single playback channel.
* various locking fixes, rework open logic and channel registrationcg2001-06-141-1/+4
| | | | PR: kern/28084
* lock sound device when adding/removing channelscg2001-06-071-10/+42
| | | | | | 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-0/+383
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.
OpenPOWER on IntegriCloud