[Development report #31] Audio Stack Improvements

From: Christos Margiolis <christos_at_freebsd.org>
Date: Tue, 11 Mar 2025 14:19:33 UTC
MFC'd some recently committed patches to stable/14.

sound: Refactor the format conversion framework:
https://cgit.freebsd.org/src/commit/?id=433e270f341cf660b2fe125c2e0f733073829188

sound: Turn clamp macros into a function:
https://cgit.freebsd.org/src/commit/?id=4918fc2e238b581aaf1f63e20003d5fa957f0b09

sound: Remove macro magic from pcm/feeder_eq.c:
https://cgit.freebsd.org/src/commit/?id=e18d66d9c515abc729f5c4740b9b999d28abc333

sound: Remove macro magic from pcm/feeder_matrix.c:
https://cgit.freebsd.org/src/commit/?id=ac24c9da8bb7af731646dd7924841a28e2ad7ad7

sound: Remove feed_matrix_apply_generic():
https://cgit.freebsd.org/src/commit/?id=b73b5f70e9f6be951e66531f6f57249eea4ba4dc

sound: Simplify pcm/feeder_mixer.c:
https://cgit.freebsd.org/src/commit/?id=4021fa32d92d656d3d43186cc231695c7ad53d33

sound: Take dsp_cdevsw out of header file:
https://cgit.freebsd.org/src/commit/?id=2fda8597116e760c32f07af43d260041f975b650

sound: Retire SD_F_AUTOVCHAN:
https://cgit.freebsd.org/src/commit/?id=b768f2c7773b6e306fb43687657414f9f42a27d4

sound: Make dev.pcm.X.mode dynamic:
https://cgit.freebsd.org/src/commit/?id=ab95710f30f7255d3a6be22a1a2c375ee0f96868

sound: Update COPYRIGHT notices:
https://cgit.freebsd.org/src/commit/?id=c824383b269d8abe175ea4751194660716d5600e

sound: Make feed_mixer_apply() __always_inline:
https://cgit.freebsd.org/src/commit/?id=717adecbbb5293d8386caa866c21421ef9eeb22c

sound: Implement AFMT_FLOAT support:
https://reviews.freebsd.org/D47638

	Received useful feedback about a rounding error improvement,
	although roundf() cannot be used in the kernel.

Laptop project

	sound: Implement /dev/dsp as a router device:
	https://reviews.freebsd.org/D49216

		- Addressed ziaee@'s man page comment.
		- Restored hw.snd.basename_clone and dsp_clone(), but
		  instead of cloning /dev/dsp${hw.snd.default_unit}, we
		  are cloning vdsp_cdev, which is defined as /dev/vdsp.
		  This way we preserve backwards compatibility with
		  virtual_oss, since it can override /dev/dsp with its
		  own. Update man page accordingly.
		- Check whether the channels are not NULL, as opposed to
		  checking priv->flags and assuming the channels will be
		  non-NULL.
		- Check for !DSP_REGISTERED() after acquiring the new
		  cdevpriv in vdsp_getdev(), as well as in vdsp_open().

	Working on a follow-up patch to D49216 to split the default unit
	into playback and recording units.

	Port SOF (Sound Open Firmware) to FreeBSD

		I spent a good amount of time studying the (limited)
		documentation, as well as the Linux sources, and also
		had an email exchange with Liam Girdwood from Intel (one
		of the main authors of SOF) to clear up some questions I
		had, but eventually I realized that this project is not
		a very wise allocation of resources, considering its
		complexity and the tech debt it'll introduce, for
		seemingly little benefit. I discussed this in-depth with
		emaste@ in a private exchange and detailed all the
		reasons why I think this project is not worth pursuing,
		at least for now, and we are thinking about dropping it.

	Reviewed:
	https://reviews.freebsd.org/D49002

	PR 253900:
	https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=253900

	Attended Foundation's monthly iteration call.

Sent an email to multimedia@ regarding a potential removal of the -T
option from virtual_oss I'm considering:
https://lists.freebsd.org/archives/freebsd-multimedia/2025-March/002887.html

Attended srcmgr bug busting call.

This work is sponsored by the FreeBSD Foundation.

Christos