#
7e857dd1 |
| 12-Jun-2009 |
Oleksandr Tymoshenko <gonzo@FreeBSD.org> |
- Merge from HEAD
|
#
90da2b28 |
| 07-Jun-2009 |
Ariff Abdullah <ariff@FreeBSD.org> |
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 includ
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.
show more ...
|
Revision tags: release/7.2.0_cvs, release/7.2.0 |
|
#
609c69b7 |
| 10-Jan-2009 |
Alexander Motin <mav@FreeBSD.org> |
Make devnode include full device path. This makes OSSv4 osstest tool work.
|
#
ccaaa745 |
| 10-Jan-2009 |
Alexander Motin <mav@FreeBSD.org> |
Remove debug slipped with the previous commit.
|
#
52f6e09e |
| 10-Jan-2009 |
Alexander Motin <mav@FreeBSD.org> |
Import some new constants and structures fields from OSSv4. Implement some OSSv4 ioctls to make ossinfo tool work and print something reasonable.
|
Revision tags: release/7.1.0_cvs, release/7.1.0, release/6.4.0_cvs, release/6.4.0 |
|
#
d3ce8327 |
| 26-Sep-2008 |
Ed Schouten <ed@FreeBSD.org> |
Remove unit2minor() use from kernel code.
When I changed kern_conf.c three months ago I made device unit numbers equal to (unneeded) device minor numbers. We used to require bitshifting, because the
Remove unit2minor() use from kernel code.
When I changed kern_conf.c three months ago I made device unit numbers equal to (unneeded) device minor numbers. We used to require bitshifting, because there were eight bits in the middle that were reserved for a device major number. Not very long after I turned dev2unit(), minor(), unit2minor() and minor2unit() into macro's. The unit2minor() and minor2unit() macro's were no-ops.
We'd better not remove these four macro's from the kernel, because there is a lot of (external) code that may still depend on them. For now it's harmless to remove all invocations of unit2minor() and minor2unit().
Reviewed by: kib
show more ...
|
#
2bc59982 |
| 27-May-2008 |
Ariff Abdullah <ariff@FreeBSD.org> |
Release pcm mutex before calling snd_clone_unref(), which in turns might calling destroy_dev() with sleepable malloc(9). The entire opetation is being serialized through pcm cv from top down, so drop
Release pcm mutex before calling snd_clone_unref(), which in turns might calling destroy_dev() with sleepable malloc(9). The entire opetation is being serialized through pcm cv from top down, so dropping mutex is rather safe.
Reported by: delphij
show more ...
|
#
429cc100 |
| 11-Apr-2008 |
Ariff Abdullah <ariff@FreeBSD.org> |
Don't mess up with CHN_F_TRIGGERED, since it should exclusively be handled by chn_abort() and chn_start() alone. This should fix few issues with single duplex hardware (mostly) or pre virtual record
Don't mess up with CHN_F_TRIGGERED, since it should exclusively be handled by chn_abort() and chn_start() alone. This should fix few issues with single duplex hardware (mostly) or pre virtual record (RELENG 6) under WINE emulation and possibly others that using SNDCTL_DSP_SETTRIGGER.
MFC after: 3 days
show more ...
|
Revision tags: release/7.0.0_cvs, release/7.0.0, release/6.3.0_cvs, release/6.3.0 |
|
#
a5b0e312 |
| 04-Jul-2007 |
Ariff Abdullah <ariff@FreeBSD.org> |
Be much more forgiving towards applications that requesting ioctls that should be a no-op (for example, requesting SYNC on record path). The standards does not indicate that such requests are illegal
Be much more forgiving towards applications that requesting ioctls that should be a no-op (for example, requesting SYNC on record path). The standards does not indicate that such requests are illegal, so just return it as success instead of EINVAL.
Approved by: re (mux)
show more ...
|
#
e4e61333 |
| 16-Jun-2007 |
Ariff Abdullah <ariff@FreeBSD.org> |
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 condva
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...
show more ...
|
#
adb0d36d |
| 10-Jun-2007 |
Matt Jacob <mjacob@FreeBSD.org> |
Cast len to be a uintmax_t and make format in KASSERT match so as to avoid different sizes on different platforms types of complaints.
Reviewed by: Ariff
|
#
9c271f79 |
| 03-Jun-2007 |
Ariff Abdullah <ariff@FreeBSD.org> |
Insert NULL pointer checking around devclass_get_maxunit(pcm_devclass, ..) . Things can get ugly without it due to uninitialized class. RELENG_6 need a simmilar, but different treatment as well.
err
Insert NULL pointer checking around devclass_get_maxunit(pcm_devclass, ..) . Things can get ugly without it due to uninitialized class. RELENG_6 need a simmilar, but different treatment as well.
err.. perhaps we should teach devclass_get_maxunit() to return -1 ?
MFC after: 1 day
show more ...
|
#
bba4862c |
| 31-May-2007 |
Ariff Abdullah <ariff@FreeBSD.org> |
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
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.
show more ...
|
#
7d9022b4 |
| 16-Mar-2007 |
Ariff Abdullah <ariff@FreeBSD.org> |
[stage: 7/9]
EWOULDBLOCK -> EAGAIN.
|
Revision tags: release/6.2.0_cvs, release/6.2.0 |
|
#
b45d0ec8 |
| 07-Dec-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
Remove comment that is no longer relevant since previous buffering fix.
|
#
a580b31a |
| 26-Nov-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
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
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.
show more ...
|
#
394ebd35 |
| 28-Oct-2006 |
Alexander Leidinger <netchild@FreeBSD.org> |
MFP4: Rename MAX_SAMPLE_RATES macro to OSS_MAX_SAMPLE_RATES. The old macro clashed with those used in other applications and libaries (ex: RtAudio). 4Front responded by updating their spec, so w
MFP4: Rename MAX_SAMPLE_RATES macro to OSS_MAX_SAMPLE_RATES. The old macro clashed with those used in other applications and libaries (ex: RtAudio). 4Front responded by updating their spec, so we will follow suit.
Submitted by: ryanb Noticed by: pointyhat/kris
show more ...
|
#
0f85b689 |
| 08-Oct-2006 |
Alexander Leidinger <netchild@FreeBSD.org> |
Remove unnecessary test case. (As written, that branch will never be followed.)
Submitted by: ryanb Found with: Coverity Prevent CID: 239860
|
#
f77472e6 |
| 29-Sep-2006 |
Ruslan Ermilov <ru@FreeBSD.org> |
The SNDCTL_DSP_NONBLOCK ioctl doesn't take an argument, from what I can tell by browsing the Internet (Linux, OSS, etc.).
|
#
b611c801 |
| 23-Sep-2006 |
Alexander Leidinger <netchild@FreeBSD.org> |
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 th
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.
show more ...
|
Revision tags: release/5.5.0_cvs, release/5.5.0, release/6.1.0_cvs, release/6.1.0 |
|
#
844f9220 |
| 30-Mar-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
Remove paranoid thread hijacking check. It cause wierd behaviour (dangling channel - process association) especially in threaded or fork()ed apps.
|
#
3fdb3676 |
| 21-Mar-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
Apply more thorough fixes while dealing with device opening and closing:
- Determine open direction using 'flags', not 'mode'. This bug exist since past 4 years. - Don't allow opening the same dev
Apply more thorough fixes while dealing with device opening and closing:
- Determine open direction using 'flags', not 'mode'. This bug exist since past 4 years. - Don't allow opening the same device twice, be it in a same or different direction. - O_RDWR is allowed, provided that it is done by a single open (for example by mixer(8)) and the underlying hardware support true full-duplex operation. - Do various paranoid checking in case other process/thread trying to hijack the same device twice (or more).
MFC after: 5 days
show more ...
|
#
c8c4c87d |
| 29-Jan-2006 |
Alexander Leidinger <netchild@FreeBSD.org> |
Fix some potential NULL pointer dereferences.
This is supposed to fix some Coverity Prevent errors (Ariff didn't looked at the CID's (ENOTIME), I just told him that there are some problems in functi
Fix some potential NULL pointer dereferences.
This is supposed to fix some Coverity Prevent errors (Ariff didn't looked at the CID's (ENOTIME), I just told him that there are some problems in function dsp_ioctl()).
CID: 215-218 Found with: Coverity Prevent(tm) Submitted by: ariff MFC after: 5 days
show more ...
|
#
da8623ec |
| 25-Jan-2006 |
Joel Dahl <joel@FreeBSD.org> |
Fix typos and clean up some comments.
Approved by: ariff
|
#
2fd8d3d8 |
| 16-Jan-2006 |
Ariff Abdullah <ariff@FreeBSD.org> |
Restore old compatibility of feeding directly into /dev/dsp at 8000 hz while preserving the New World Order.
Discussed with: [1] Michael W. Oliver <michael at gargantuan.com> MFC after: 1 week
[1]
Restore old compatibility of feeding directly into /dev/dsp at 8000 hz while preserving the New World Order.
Discussed with: [1] Michael W. Oliver <michael at gargantuan.com> MFC after: 1 week
[1] http://lists.freebsd.org/pipermail/freebsd-multimedia/2006-January/003562.html
show more ...
|