diff options
author | Christos Margiolis <christos@FreeBSD.org> | 2024-04-28 19:44:35 +0000 |
---|---|---|
committer | Christos Margiolis <christos@FreeBSD.org> | 2024-04-28 19:48:24 +0000 |
commit | 25723d66369fe6786e9e4f5f77381b944755f267 (patch) | |
tree | 8da33a7f7b452261a164125f6958ebbb850e9031 /sys/dev/sound/pcm/vchan.c | |
parent | fa284525499d75955525839074bf5968d0923e6b (diff) | |
download | src-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/dev/sound/pcm/vchan.c')
-rw-r--r-- | sys/dev/sound/pcm/vchan.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sys/dev/sound/pcm/vchan.c b/sys/dev/sound/pcm/vchan.c index d10c3ff4aabb..ac5a0535ddce 100644 --- a/sys/dev/sound/pcm/vchan.c +++ b/sys/dev/sound/pcm/vchan.c @@ -923,7 +923,7 @@ vchan_sync(struct pcm_channel *c) if (snd_passthrough_verbose != 0) { char *devname, buf[CHN_NAMELEN]; - devname = dsp_unit2name(buf, sizeof(buf), c->unit); + devname = dsp_unit2name(buf, sizeof(buf), c); device_printf(c->dev, "%s(%s/%s) %s() -> re-sync err=%d\n", __func__, (devname != NULL) ? devname : "dspX", c->comm, |