From nobody Tue Jan 16 21:06:12 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TF1l85X9Fz583Qg; Tue, 16 Jan 2024 21:06:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TF1l855Qzz49x8; Tue, 16 Jan 2024 21:06:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705439172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=COXe+F+ulWgiOUa1LxDfU7O2I3kGKnioqcuap5uXvoE=; b=G/QfVNUJZ/O/NteDE9dUD+GpAITl7yNBQEq/bz7e513p795nOhccWjB0h/Hj9DdkrOVGLX 41Oe6DbLhyc5Dkq5qoXG6nVPSBfsuVUIfdQgZlOwzg7TkCLdFRtzhHQfHPiramXZYFAIFU u6dAatddYc2cpSVcQz/67q8RY0WbsR719O7hh5QA5GLGZqMFa8do20w2agNG9k+KvgS9XO gMx0EkvJ8IWnnUgKFO7CEnX6u0hB2wwbelZwNDIao9BImdV3zqcZ/ZQL6r5g4l5lZf67ok kcFG5xFu/cBP9OUjw4FJ+IGR143Q1DLhP0RpGUWMGevck/bE/o9dn8wQ3LrYnQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1705439172; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=COXe+F+ulWgiOUa1LxDfU7O2I3kGKnioqcuap5uXvoE=; b=hVYFjbBPRxLu+G2ieqwLFxrDA7LdLotUqeDSbu0YznJQHuCn9F4VnkuXMi7CJHQR/5wZoj 88Ge4uCcHZgm61e9XbI/DwhgoVCqzVR0Dpo7Ed4gsz6qA9FvTNZrf8yUjCJiAzq8gX/c5p 2iItpg+gCuObjEa+aJRpeiq1ynYl4kn24nl8KpYlEFxFajpWRhrwo4KK4NYVvCj6+l1lC/ NolSHdJOu4dTT9VjAlFN9iH6e4nvmwNR8XzvqYWSzl/wzPZXVx6Y/TczLOQsUiQ/VWxZN/ rcdOZyVqohJZFirlaZ93I3hqAe4jt7I57WPH8ueSAujPQqbqgrSb6b2PRAqZgw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1705439172; a=rsa-sha256; cv=none; b=fqKTjzT7Sy6V2wycfSSjEc+gjKJFSgk2EZ43tM156DpCb8qLW/hlcytQjzk7rbN4Dz5iHf UgzWGhVsviHBCvEGIOwous2JvxLASv4MH5pKNIZ5r1qU63UAGtvwYvPWlW0NX8AODaPsg8 cidgrPJlaLsswEMNEdau7TVE+dvaXKo2G96zJCOGP9klBnGYbOOO15L3vGTUjScanosoCc B2VElokl0MnxZWZPrgt0YXooAu230lUs/7gnJKPErttzukUcNU4CfbQHZ839f1ce+eVDtN JwZuVXLn01tUDsNIN+886ciDJlXhsh1VZxHAO5Rh0VcUpPm1n1gN6AkRvP2EFw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TF1l843BXzwK7; Tue, 16 Jan 2024 21:06:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 40GL6CeP012536; Tue, 16 Jan 2024 21:06:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 40GL6CHQ012533; Tue, 16 Jan 2024 21:06:12 GMT (envelope-from git) Date: Tue, 16 Jan 2024 21:06:12 GMT Message-Id: <202401162106.40GL6CHQ012533@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Ed Maste Subject: git: 61c831679615 - main - sound: Fix OSS API requests for more than 8 channels List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: emaste X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 61c831679615d2a03a494bd7f3627fb945f2795c Auto-Submitted: auto-generated The branch main has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=61c831679615d2a03a494bd7f3627fb945f2795c commit 61c831679615d2a03a494bd7f3627fb945f2795c Author: Florian Walpen AuthorDate: 2023-11-25 00:04:34 +0000 Commit: Ed Maste CommitDate: 2024-01-16 21:05:44 +0000 sound: Fix OSS API requests for more than 8 channels Audio devices with more than 8 channels need bitperfect mode to operate, the vchan processing chain is limited to 8 channels. For these devices, let applications properly select a certain number of channels supported by the driver, instead of mapping the request to a vchan format. Reviewed by: emaste Pull Request: https://github.com/freebsd/freebsd-src/pull/914 --- sys/dev/sound/pcm/dsp.c | 27 +++++++++++++++++---------- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 5aa7979b98c9..9040c77893d4 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -1502,24 +1502,31 @@ dsp_ioctl(struct cdev *i_dev, u_long cmd, caddr_t arg, int mode, case SOUND_PCM_WRITE_CHANNELS: /* case SNDCTL_DSP_CHANNELS: ( == SOUND_PCM_WRITE_CHANNELS) */ - if (*arg_i < 0) { + if (*arg_i < 0 || *arg_i > AFMT_CHANNEL_MAX) { *arg_i = 0; ret = EINVAL; break; } if (*arg_i != 0) { - struct pcmchan_matrix *m; - uint32_t ext; + uint32_t ext = 0; tmp = 0; - if (*arg_i > SND_CHN_MAX) - *arg_i = SND_CHN_MAX; + /* + * Map channel number to surround sound formats. + * Devices that need bitperfect mode to operate + * (e.g. more than SND_CHN_MAX channels) are not + * subject to any mapping. + */ + if (!(dsp_get_flags(i_dev) & SD_F_BITPERFECT)) { + struct pcmchan_matrix *m; - m = feeder_matrix_default_channel_map(*arg_i); - if (m != NULL) - ext = m->ext; - else - ext = 0; + if (*arg_i > SND_CHN_MAX) + *arg_i = SND_CHN_MAX; + + m = feeder_matrix_default_channel_map(*arg_i); + if (m != NULL) + ext = m->ext; + } PCM_ACQUIRE_QUICK(d); if (wrch) {