Hi all, I'd like to propose a new audio framework (which I call AUDIO2).
http://www.netbsd.org/~isaki/audio2-20190401.diff.gz Audio driver since 8.0 has in-kernel mixing feature and it's really exciting. But also has so many problems. * unstable including locking issues. * bad playback quality and high load (especially on slow machines). * high latency. * does not support drivers with uncommon characteristics. For example, vs(4) hardware frequency is 15625Hz but audio.c can not attach such devices (as it is). * interface was silently changed so several hardware drivers have no longer worked. * There is a lot of unmaintained(no longer used) code. So I've reimplemented whole audio framework to fix them. It is mostly worked fine for me. * stable. * good playback quality and lightweight even on 68030. The average of system load ("sy" column by vmstat) on playing single 1ch/8000Hz mulaw on x68k (68030/30MHz/12MB real machine) is: about 50% on -current, about 10% on AUDIO2. (FYI, it's about 4% on NetBSD7.) * better latency. current latency is normally about 3*50=150msec in default, AUDIO2 latency is normally about 2*40=80msec in default. * smaller textsize (and probably memory usage). For example, amiga/GENERIC kernel has three old-style audio drivers and AUDIO2 modifies two of these already. At this moment it reduces kernel size about 35KB. In the end we will be able to reduce it more. * well support for non-PCM hardware. * well consideration about half duplex hardware. * provide many tests. * introduce sysctl hw.wsbellN.mute to be able to mute individually. AUDIO2 requires explicit few interface changes, so all hardware drivers must be catched up. Current status is: * works: arcofi(4), auich(4), bba(4), eap(4), hdafg(4), uaudio(4), vs(4), vsaudio(4) * compiled but not tested: audioamd(4), aucc(4), melody(4), repulse(4) * works but more works are required: sb(4), pad(4), spkr_audio Other drivers not listed here are not supported yet. There is one thing I'm worried about. AUDIO2 requires more strict blocksize and buffersize for hardware drivers. It will be a hard work if there are any hardware that does not satisfy the requirements. # Although I believe there are no such hardware... Some of TODOs: * remove all ifdef AUDIO2. It was needed to confirm non-AUDIO2 kernel build. * support all hardware drivers. (need your help!) * support NetBSD8-like multiuser mode? * mmap is not well tested. * translate or cleanup Japanese comments which is left in source code. * convert my local tests (which is not included in the patch) into ATF. Any comments? --- Tetsuya Isaki <[email protected] / [email protected]>
