[Development report #30] Audio Stack Improvements

From: Christos Margiolis <christos_at_freebsd.org>
Date: Tue, 25 Feb 2025 15:20:34 UTC
Worked on previous weeks' patches. Waiting for feedback on some of them
before I go ahead. I did however commit the patches I could commit so
far, to start decluttering my patch tree:

snd_hda: Fix typo (s/owerflow/overflow):
https://cgit.freebsd.org/src/commit/?id=d4176fdb1370f5dcf2c40c153e6bd1ad0c4a2f85

sound tests: Fix downshift calculation in pcm_read_write test:
https://cgit.freebsd.org/src/commit/?id=6672831bda883756d7f4598bb4b119f99eb1e7d2

snd_hda: Define ALC898:
https://cgit.freebsd.org/src/commit/?id=c23d53490eb3ac5568050ca9a58534ac04846281

sound: Bail out early if a format is not supported:
https://cgit.freebsd.org/src/commit/?id=18457e7e25c55b8834e886fd925ec3b11b79d1b6

sound: Do not return an error from chn_notify() if the children list is empty:
https://cgit.freebsd.org/src/commit/?id=164651f16c860049a4ad2098206def8ca7a39b4a

sound: Do not fail from vchan_destroy() if children list is empty:
https://cgit.freebsd.org/src/commit/?id=405b1e50926d4162fb9503644073c0184a8b37d9

sound: Call vchan_destroy() on vchan_create() failure:
https://cgit.freebsd.org/src/commit/?id=2546ab1b3632a9ebfe88d9d5dc55700e653bff5d

sound: Initialize channels with sane default rate and format:
https://cgit.freebsd.org/src/commit/?id=e89ee05b7cf1a54d0d6ed56e4d451fdd9a10db43

sound: Report actual vchanrate and vchanformat in sysctl:
https://cgit.freebsd.org/src/commit/?id=d39be38a353323d05744eeb3e08267108e55b9b1

sound: Allocate vchans on-demand:
https://cgit.freebsd.org/src/commit/?id=02d4eeabfd73e6a827f5d42601e99aad92060b04

sound: Cache vchanmode:
https://cgit.freebsd.org/src/commit/?id=b50f53cf872eca6b9a174a51fa183e8c2f88d97c

sound: Handle multiple primary channel cases in vchan sysctls:
https://cgit.freebsd.org/src/commit/?id=1cbafcd13796934a7896064cdb23fd4e37d58821

sound: Remove SNDBUF_LOCKASSERT():
https://cgit.freebsd.org/src/commit/?id=6524d2a5affd02623e6909fff0ca03ba21882a0c

sound: Get rid of redundant variables in chn_setspeed() and chn_setformat():
https://cgit.freebsd.org/src/commit/?id=4e1b75bebf41b6e446d72c755fa420836341ade2

sound: Return if the new speed/format is the same as the current one:
https://cgit.freebsd.org/src/commit/?id=40616b7e41ff96b6d7522445b00f27f26d593a85

snd_uaudio: Remove undefined functions:
https://cgit.freebsd.org/src/commit/?id=352aa9ad1d77a8ea8e4afef66691dc1a06344618

sound: Simplify locking during device creation:
https://cgit.freebsd.org/src/commit/?id=fd906e47b18f53b09524647bf8431dc6170b8dfd

sound: Update comment and channel insertion in vchan_create():
https://cgit.freebsd.org/src/commit/?id=2868776c9c6f5313a5676786f642b766f103d780

sound: Call chn_kill() in chn_init() failure:
https://cgit.freebsd.org/src/commit/?id=bc7e65e950154572d8c9a04dc033075bf37aae40

snd_uaudio.4: Move non-uaudio-specific BUGS paragraph to pcm.4:
https://cgit.freebsd.org/src/commit/?id=cfdee707fb18a0fde4bed4e85414f8803461249d

mixer(3): Do not skip devices with no volume control:
https://cgit.freebsd.org/src/commit/?id=f121de8fbcbc8aa82f9fb59039c502406b7c88b6

RELNOTES: Add 02d4eeabfd73 note:
https://cgit.freebsd.org/src/commit/?id=3b60c193fc8e0d4fdc6cf8683afbb7c9b3b5f6ca

sound: Refactor the format conversion framework:
https://reviews.freebsd.org/D47932

	Discussion about dealing with unused compiler warnings. See
	discussion in review.

Laptop project:

	Abandoned D48809 and updated GitHub issue:
	https://github.com/FreeBSDFoundation/proj-laptop/issues/17

	Continued discussions with mav@.

	Working on new approach discussed in previous report.
	Re-implementing `/dev/dsp` as a virtual device, similar to
	virtual_oss. This will help us adapt snd_hda(4) to more easily
	redirect sound. So far I have implemented basic redirection by
	making `/dev/dsp` a router device, whose `cdev` routines simply
	route everything to `/dev/dsp${hw.snd.default_unit}`, like the
	`giant_*()` functions in `sys/kern/kern_conf.c`. I am now
	working on being able to hot-swap devices when the default unit
	changes.

	Attended LDWG call.

Bug reports:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=283948

This work is sponsored by the FreeBSD Foundation.

Christos