[Development report #22] Audio Stack Improvements

From: Christos Margiolis <christos_at_freebsd.org>
Date: Tue, 22 Oct 2024 14:41:17 UTC
2024Q3 report:
https://cgit.freebsd.org/doc/commit/?id=e3e41e13bd98c9144a9cf20dbf29d7ccdf5c122c

sound: Remove KASSERT from vchan_setnew():
https://cgit.freebsd.org/src/commit/?id=998de46c51452b046ecd9ba8ed592dd7c4f79f51

sound: Get rid of pnum and max variables in chn_init():
https://cgit.freebsd.org/src/commit/?id=de8ee333388bf5e551e697b08823b3a6c262f609

sound: Simplify pcm_chnalloc() and fix infinite loop bug:
https://cgit.freebsd.org/src/commit/?id=b973a14d354f332a3428cbab8e9d4b72cb3e2d6e

sound: Sort channels by unit number as well:
https://cgit.freebsd.org/src/commit/?id=142aca25b07c9a7067d8040ea98812c54b253bbf

sound: Use unr(9) to produce unique channel unit numbers:
https://cgit.freebsd.org/src/commit/?id=ad4c8671bddaa30bf0413089c74dde6a618d9021

sound: Fix indendation in sound_modevent() switch statement:
https://cgit.freebsd.org/src/commit/?id=41ff4177614562923a30e2541e2a15883a4ce32c

sound: Move global variable initialization to sound_modevent():
https://cgit.freebsd.org/src/commit/?id=0a0301deb5b6a9c66829dd20cff9d40c5ba9ad92

sound: Move root feeder initialization to separate function:
https://cgit.freebsd.org/src/commit/?id=97570db05ced435f4fb1c6a67bdb16966ce5e4d9

snd_dummy: Drain callout during detach:
https://cgit.freebsd.org/src/commit/?id=e42c8267821952407d4f4064026058aeaaa741ac

sound: Retire SND_MAXHWCHAN:
https://cgit.freebsd.org/src/commit/?id=248aced26eee6f569717618d097bc2205a93c800

sound: Simplify vchan_create() error paths:
https://cgit.freebsd.org/src/commit/?id=3cab66d12d439357b948093756ca1af87967c8cc

sound: Remove useless newspd check in sysctl_dev_pcm_vchanrate():
https://cgit.freebsd.org/src/commit/?id=f3092614bcae949332a8f21f7b78ba68b3ee5899

sound: Simplify channel creation and deletion process:
https://cgit.freebsd.org/src/commit/?id=9263f854e9a63cc326a3d5f6331b933c4a010abf

sound: Shorten channel names:
https://cgit.freebsd.org/src/commit/?id=c30f531ddb629ab51359fb540c8ef6068bab288b

sound: Do not cast return value of malloc(9):
https://cgit.freebsd.org/src/commit/?id=3cc01caa26e4bf0798d219b2d40429a2cc1a642a

sound: Use M_WAITOK where possible:
https://cgit.freebsd.org/src/commit/?id=5e33eca8e8f359d4d48f4c50334a03748420a7da

sound: Do not check for NULL if sbuf is allocated with SBUF_AUTOEXTEND:
https://cgit.freebsd.org/src/commit/?id=aaf84d0e96831cd886b8e1e4ae102b3ba703b90a

sound: Improve /dev/sndstat channel info readability:
https://cgit.freebsd.org/src/commit/?id=0ff0a8234f83e6b25e9a2f1b64623baaf723d6dc

snd_hda: Remove duplicate HDA_INTEL_CMLK* entries:
https://cgit.freebsd.org/src/commit/?id=de009cf68ba68aa5823be3d6afeebb49a15b1251

snd_hda: Identify NVIDIA GM204:
https://cgit.freebsd.org/src/commit/?id=d643e82356d46a20a8f3f2f3c42573a6827d568a

onyx: Remove unreachable if condition:
https://cgit.freebsd.org/src/commit/?id=6f96ef84b359137a51dc1e717887ca7d31ba7bad

vmm.4: Add ppt device detach example:
https://cgit.freebsd.org/src/commit/?id=9ad2891558729b1c1ad4ba02377b157e404a3da2

mididump(1): Initial revision:
https://cgit.freebsd.org/src/commit/?id=f57efe95cc25ae527c632d4ffcf064799f922216

mididump(1): Use LIBADD instead of LDFLAGS:
https://cgit.freebsd.org/src/commit/?id=feb9ba2993cf6aefa49b7b17ca49c52210c26035

mididump(1): Use nitems():
https://cgit.freebsd.org/src/commit/?id=53314e34d5e8e7f781ab990805b22f7a56bc0580

RELNOTES: Add mididump(1):
https://cgit.freebsd.org/src/commit/?id=6e24259590a3c3b7784c5c656f6be1bee72d0bfe

audio/sound-juicer: Update to 3.40.0:
https://cgit.freebsd.org/ports/commit/?id=033cb8d33abb1cc37eace7d50c05ad43cdd62d36

sound: Introduce global driver lock:
https://reviews.freebsd.org/D46700

sound: Call DSP_REGISTERED before PCM_DETACHING:
https://reviews.freebsd.org/D47195

sound: Use DSP_REGISTERED in dsp_clone():
https://reviews.freebsd.org/D47196

sound: Change PCMDIR_* numbering:
https://reviews.freebsd.org/D47198

sound: Untangle dsp_cdevs[] and dsp_unit2name() confusion:
https://reviews.freebsd.org/D47199

Reviewed:
https://reviews.freebsd.org/D46837
https://reviews.freebsd.org/D46098

Lots of bug triaging.

Helped people with various problems/questions on freebsd-multimedia@.

Both me and Florian keep hitting some panics when hot-unloading
sound(4), despite https://reviews.freebsd.org/D46847, which seems to
make the code more robust at least. The panics seem to be caused
somewhere else. The issue has to be resolved before I can submit the
VCHAN allocation patch. This has been quite time-consuming.

Working on fixing a WITNESS warning (unrelated to the patch) in sndstat:
https://reviews.freebsd.org/D45982#1075314

Having some problems with AFMT_FLOAT support in sound(4)'s processing
pipeline, but I’m hoping to have them solved ASAP.

Started co-mentoring Mateusz Piotrowski (0mp@) with bnovkov@ and markj@.

This work is sponsored by the FreeBSD Foundation.

Christos