#
331722 |
|
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re)
|
#
330897 |
|
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
280442 |
|
24-Mar-2015 |
hselasky |
Make all PCM core sysctls tunable and remove redundant TUNABLE() statements. This allows for setting all PCM core parameters in the kernel environment through loader.conf(5) or kenv(1) which is useful for pluggable PCM devices like USB audio devices which might be plugged after that sysctl.conf(5) is executed.
|
#
267992 |
|
28-Jun-2014 |
hselasky |
Pull in r267961 and r267973 again. Fix for issues reported will follow.
|
#
267985 |
|
27-Jun-2014 |
gjb |
Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output, such as:
1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
|
#
267961 |
|
27-Jun-2014 |
hselasky |
Extend the meaning of the CTLFLAG_TUN flag to automatically check if there is an environment variable which shall initialize the SYSCTL during early boot. This works for all SYSCTL types both statically and dynamically created ones, except for the SYSCTL NODE type and SYSCTLs which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to be used in the case a tunable sysctl has a custom initialisation function allowing the sysctl to still be marked as a tunable. The kernel SYSCTL API is mostly the same, with a few exceptions for some special operations like iterating childrens of a static/extern SYSCTL node. This operation should probably be made into a factored out common macro, hence some device drivers use this. The reason for changing the SYSCTL API was the need for a SYSCTL parent OID pointer and not only the SYSCTL parent OID list pointer in order to quickly generate the sysctl path. The motivation behind this patch is to avoid parameter loading cludges inside the OFED driver subsystem. Instead of adding special code to the OFED driver subsystem to post-load tunables into dynamically created sysctls, we generalize this in the kernel.
Other changes: - Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask" to "hw.pcic.intr_mask". - Removed redundant TUNABLE statements throughout the kernel. - Some minor code rewrites in connection to removing not needed TUNABLE statements. - Added a missing SYSCTL_DECL(). - Wrapped two very long lines. - Avoid malloc()/free() inside sysctl string handling, in case it is called to initialize a sysctl from a tunable, hence malloc()/free() is not ready when sysctls from the sysctl dataset are registered. - Bumped FreeBSD version to indicate SYSCTL API change.
MFC after: 2 weeks Sponsored by: Mellanox Technologies
|
#
209193 |
|
15-Jun-2010 |
avg |
sound/pcm: use non-const string as a value with SYSCTL_STRING
Although the sysctls are marked with CTLFLAG_RD and the values will stay immutable, current sysctl implementation stores value pointer in void* type, which means that const qualifier is discarded anyway and some newer compilers complaint about that. We can't use de-const trick in sysctl implementation, because in that case we could miss an opposite situation where a const value is used with CTLFLAG_RW sysctl.
Complaint from: gcc 4.4, clang MFC after: 2 weeks
|
#
195689 |
|
14-Jul-2009 |
ariff |
- Do aggresive saturation on various polynomial interpolators. This dramatically pushing 99.9% interpolations and quantizations error _below_ -180dB on 32bit dynamic range, resulting extremely high quality conversion. - Use BSPLINE interpolator for filter oversampling factor greater or equal than 64 (log2 6).
Approved by: re (kib)
|
#
195519 |
|
09-Jul-2009 |
ariff |
Rearrange shift operation to increase interpolation accuracy, further reducing conversion artifacts and better worst case SNR.
Approved by: re (kib)
|
#
195378 |
|
05-Jul-2009 |
ariff |
- Increase dynamic range of filter coefficients from 28bit to 30bit. This cause dramatic effect in overall precision and conversion quality by pushing down most aliasing artifacts around -180 dB.
Spectrogram analysis/comparison:
http://people.freebsd.org/~ariff/z_comparison/z_28vs30/
- Guard against possible 64bit overflow during accumulation process by slightly normalize and saturate sample and coefficient multiplication, possible during extreme 32bit downsampling (eg. 380KHz -> 8KHz) with custom preset that require more than ~7000 taps filter (which is overkill).
- Add knobs through FEEDER_RATE_PRESETS to set dynamic range of filter coefficients/accumulator and prefered polynomial interpolator:
COEFFICIENT_BIT:X (where 1 <= X <= 30, default: 30)
ACCUMULATOR_BIT:X (where 32 <= X <=64, default: 58)
INTERPOLATOR:I (where I = ZOH, LINEAR, QUADRATIC, HERMITE, BSPLINE, OPT32X, OPT16X, OPT8X, OPT4X, OPT2X)
Approved by: re (kib)
|
#
194805 |
|
24-Jun-2009 |
ariff |
Slight comment fix.
|
#
194232 |
|
15-Jun-2009 |
ariff |
Remap type of polynomial interpolators for better polyphase coefficients quality: - Linear interpolator for oversampling factor larger and equal than 4096 (log2 = 12). - Quadratic interpolator for oversampling factor larger and equal than 256 (log2 = 8).
Default oversampling factor (128 ~ log2 = 7) will use OPT32X, which provides better accuracy.
|
#
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.
|
#
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...
|
#
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.
|
#
170206 |
|
02-Jun-2007 |
joel |
Separate license from comments.
Approved by: ariff
|
#
167646 |
|
16-Mar-2007 |
ariff |
[stage: 6/9]
- Disable stray buffer management, since sample size aligned buffering are pretty much guaranteed through out the entire feeder_* chain processes. - Few style(9) cleanups.
|
#
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.
|
#
159732 |
|
18-Jun-2006 |
netchild |
- Rename hw.snd.unit to hw.snd.default_unit to make the purpose more obvious. - Enable 4 automatic vchan's by default. - Add some comments which provide ides/questions for improvement. - Prefix some temporary sysctl's with an underscore to denote that it is not an official API but a workaround until the real solution is implemented.
|
#
154826 |
|
25-Jan-2006 |
joel |
Fix typos and clean up some comments.
Approved by: ariff
|
#
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
|
#
152427 |
|
14-Nov-2005 |
ariff |
Update my email address, so people know where the exact / proper / correct place to bug me.
Approved by: netchild (mentor)
|
#
151455 |
|
18-Oct-2005 |
ariff |
Added missing comma. This fixes compilation if we need to enable RATE_ASSERT debug macro.
Approved by: netchild (mentor)
|
#
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@
|
#
139749 |
|
05-Jan-2005 |
imp |
Start each of the license/copyright comments with /*-, minor shuffle of lines
|
#
113752 |
|
20-Apr-2003 |
orion |
Additional malloc failure checks.
|
#
111909 |
|
05-Mar-2003 |
orion |
Back out last commit, which is fine in theory, but ignores the fact that a lock is held whilst the allocations are made (M_WAITOK -> M_NOWAIT).
|
#
111354 |
|
23-Feb-2003 |
green |
It seems that sound(4)'s feeder routines don't need to allocate memory without waiting, since they are called from a system-call context only. This appears to fix all sorts of problems with open("/dev/dsp", O_WRONLY) randomly returning ENXIO.
Found by: cognet
|
#
110466 |
|
06-Feb-2003 |
orion |
Fix comment typo.
Sync with userland test framework which now deals better with pcm feeder kobj emulation.
Reduce max rate from 96kHz to 48kHz as userland tests found a few bad points about 90kHz and we don't care about operating up there for now.
|
#
110108 |
|
30-Jan-2003 |
orion |
o Constrain inputs to 25Hz granularity so interpolator can operate between any pair of values in range 4-96kHz. Thanks to Ken Marks for discovering there were problems with the previous version.
o Use a non-recursive gcd routine.
|
#
109547 |
|
19-Jan-2003 |
orion |
Re-implemention of the interpolation code used for sample rate conversion. The new version has improved interpolation accuracy and maintains the timing relationship between the input and output signals exactly.
Approved by: cg
|
#
107237 |
|
25-Nov-2002 |
cg |
various fixes to eliminate locking warnings
Approved by: re Reviewed by: orion
|
#
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.
|
#
77266 |
|
27-May-2001 |
cg |
add a new method for retrieving feeder parameters
|
#
75320 |
|
08-Apr-2001 |
cg |
add a software sample rate conversion feeder. this uses linear interpolation for reasonable quality whilst not using too much cpu time.
|