aboutsummaryrefslogtreecommitdiff
path: root/sys/modules
diff options
context:
space:
mode:
authorChristos Margiolis <christos@FreeBSD.org>2024-04-28 19:44:35 +0000
committerChristos Margiolis <christos@FreeBSD.org>2024-04-28 19:48:24 +0000
commit25723d66369fe6786e9e4f5f77381b944755f267 (patch)
tree8da33a7f7b452261a164125f6958ebbb850e9031 /sys/modules
parentfa284525499d75955525839074bf5968d0923e6b (diff)
downloadsrc-25723d66369fe6786e9e4f5f77381b944755f267.tar.gz
src-25723d66369fe6786e9e4f5f77381b944755f267.zip
sound: Retire unit.*
The unit.* code is largely obsolete and imposes limits that are no longer needed nowadays. - Capping the maximum allowed soundcards in a given machine. By default, the limit is 512 (snd_max_u() in unit.c), and the maximum possible is 2048 (SND_UNIT_UMAX in unit.h). It can also be tuned through the hw.snd.maxunit loader(8) tunable. Even though these limits are large enough that they should never cause problems, there is no need for this limit to exist in the first place. - Capping the available device/channel types. By default, this is 32 (snd_max_d() in unit.c). However, these types are pre-defined in pcm/sound.h (see SND_DEV_*), so the cap is unnecessary when we know that their number is constant. - Capping the number of channels per-device. By default, the limit 1024 (snd_max_c() in unit.c). This is probably the most problematic of the limits mentioned, because this limit can never be reached, as the maximum is hard-capped at either hw.snd.maxautovchans (16 by default), or SND_MAXHWCHAN and SND_MAXVCHANS. These limtits are encoded in masks (see SND_U_MASK, SND_D_MASK, SND_C_MASK in unit.h) and are used to construct a bitfield of the form [dsp_unit, type, channel_unit] in snd_mkunit() which is assigned to pcm_channel->unit. This patch gets rid of everything unit.*-related and makes a slightly different use of the "unit" field to only contain the channel unit number. The channel type is stored in a new pcm_channel->type field, and the DSP unit number need not be stored at all, since we can fetch it from device_get_unit(pcm_channel->dev). This change has the effect that we no longer need to impose caps on the number of soundcards, device/channel types and per-device channels. As a result the code is noticeably simplified and more readable. Apart from the fact that the hw.snd.maxunit loader(8) tunable is also retired as a side-effect of this patch, sound(4)'s behavior remains the same. Sponsored by: The FreeBSD Foundation MFC after: 1 week Reviewed by: dev_submerge.ch Differential Revision: https://reviews.freebsd.org/D44912
Diffstat (limited to 'sys/modules')
-rw-r--r--sys/modules/sound/sound/Makefile2
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/modules/sound/sound/Makefile b/sys/modules/sound/sound/Makefile
index 833330ef9b26..1c3685715503 100644
--- a/sys/modules/sound/sound/Makefile
+++ b/sys/modules/sound/sound/Makefile
@@ -17,7 +17,7 @@ SRCS+= feeder_eq_gen.h feeder_rate_gen.h snd_fxdiv_gen.h
SRCS+= mpu_if.h mpufoi_if.h synth_if.h
SRCS+= mpu_if.c mpufoi_if.c synth_if.c
SRCS+= ac97.c ac97_patch.c buffer.c channel.c dsp.c
-SRCS+= mixer.c sndstat.c sound.c unit.c vchan.c
+SRCS+= mixer.c sndstat.c sound.c vchan.c
SRCS+= midi.c mpu401.c sequencer.c
feeder_eq_gen.h: ${SYSDIR}/tools/sound/feeder_eq_mkfilter.awk