[Development report #17] Audio Stack Improvements

From: Christos Margiolis <christos_at_freebsd.org>
Date: Wed, 10 Jul 2024 17:43:50 UTC
Finalized and committed all of previous weeks' open patches and MFC’d
them to stable/14.:

sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are
disabled:
https://cgit.freebsd.org/src/commit/?id=f30af1f037a68947edbabebc7ab495cd1b7a4ec8

sound: Get rid of snd_sb16 workaround in vchan_create():
https://cgit.freebsd.org/src/commit/?id=d6d4586b0b7e3b01812e6c26818af78bf9b680a3

[*] sound: Fix lock order reversals in mseq_open():
https://cgit.freebsd.org/src/commit/?id=fc76e24e583d45a3a59fd7ad4e603c0679eaf572

[*] Peter Holm email me saying he's experienced problems with with commit
when testing it with stress2. The issue was that I forgot to drop the
lock in the error path. I wrote a fix but then saw that rew@ had already
pushed the same fix:
https://cgit.freebsd.org/src/commit/?id=3114d55866b86ca1132923211936aa23881b0057

snd_uaudio: Remove unused sc_sndstat sbuf:
https://cgit.freebsd.org/src/commit/?id=3402d474ceb8541d07689bad6960f90739129997

sound: Remove MIDI_TYPE:
https://cgit.freebsd.org/src/commit/?id=526bd1d87ec997e1c090262da6f2d9b6da0e8f89

sound: Remove *MINOR from midi/:
https://cgit.freebsd.org/src/commit/?id=8b9e1b628064daba3650d04fa83cf79808877981

sound: Simplify getchns():
https://cgit.freebsd.org/src/commit/?id=46e92a41cb539e327dd059d571fa381d0fbe779c

sound: Improve simplex handling in dsp_open():
https://cgit.freebsd.org/src/commit/?id=be04a9d9387f6b5d4e83fc4976d8d83bb03fe5af

sound: Make DSP_FIXUP_ERROR() regular code:
https://cgit.freebsd.org/src/commit/?id=adc1713fb13f89a6eb33f5de840c981d0e17e4b7

sound: Remove dead code in pcm_register():
https://cgit.freebsd.org/src/commit/?id=a9f08df3e9004f431e98f67afc1ac2b2f773ec14

sound: Handle midistat_lock through function interface:
https://cgit.freebsd.org/src/commit/?id=2d6fc24673ccc97020c94094f97ee015f1db9702

sound: Fix min/max rate for SNDCTL_AUDIOINFO and SNDCTL_ENGINEINFO:
https://cgit.freebsd.org/src/commit/?id=86585210fd5657542884b22eb52b21e960b7be6c

sound: Refactor sndstat_get_caps():
https://cgit.freebsd.org/src/commit/?id=9d8b93bc9ccea82b648ffa9354200c9e4d3f211b

sound: Add min_rate and min_channels safety check in SNDCTL_AUDIOINFO:
https://cgit.freebsd.org/src/commit/?id=1a768ea9db3d66941b0dc5340ac028ef548808b8

sound: Add missing CHN_[UN]LOCKs in sndstat:
https://cgit.freebsd.org/src/commit/?id=e850bd36dfda98608432d2459800627d16119fec

---

audio(3):

Sent an email Alexandre Ratchov, who is an active OpenBSD audio
contributor and author of sndio, about audio(3) and sndio(3), after he
replied to my latest development report on freebsd-multimedia@.

Testing and fixing audio and MIDI read() and write() functions.
Memory-mapped IO still doesn’t work properly, still fighting with it.

---

Implementing mididump(1), a MIDI reading/writing program, similar to
OpenBSD’s midicat(1). Uses audio(3).

---

sound tests: Add sndstat nvlist ATF test:
https://reviews.freebsd.org/D45901

Writing a dummy sound driver to use it for testing.

---

Started working on a bluetooth device management utility, for now named
btctl(8). Unfortunately hccontrol(8) is totally unreliable, works not
even half the time, and this makes testing the tool really hard… I might
have to contact the author of hccontrol(8) to see if we can address this
issue.

This work is sponsored by the FreeBSD Foundation.