From nobody Mon Sep 21 11:05:34 2026 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 4hpL4N03zmz6rRD8 for ; Mon, 21 Sep 2026 11:05:40 +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 "YR2" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4hpL4M5f5dz3H09 for ; Mon, 21 Sep 2026 11:05:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789988739; 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=XQqtomaEQ0u8xTQth/ei0BrJKFEPc14JZkK+aOVt0AM=; b=akBgGeTmJqAWbVnqkpDd4/hQNfr/A7zUjqPIvN/bKHBnfWIYv6/uRA0x5POfj1PAFPw5m/ Sc1oy34rFAuwnem58nAp3f2+pNhfGVCVmLcAmUqOPRzKBg5GNIzY42aDcOGveIcFPJcMuL Z3mdDy6ob2+C8Z9GVtotAB2CwtNSP/CL68fLonOmPtxD21G3UtO1tOJIpcGz0rE+1Ab48b fTTTYWWMcjLIvsBBxUnfHEzNs0NM6DilavjOYgngcFXKuz7wy3StsKeFskLP72PkLDZpIo /zrQdLlupFLzK4y+AwxIV0h5R9VO5NRm+Lx+3ES26s2Ksv8cfKNBO+AYEM6UbA== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789988739; b=kmqAgjePNy/5l3c1pJOU6h1b1392nUDr26hJm53mx/lYjrRZ8pbmG7AvUABJTG3M8igxYh DxOWf3SmHSluSc0igJAHNVIHVYPYMMk0+31fCuNshk0SR/8WeMDhnVMOOjt1WY2MnTQVOP pWNFCJHnzLlPcHb1DfGED6nupm24j7NGhy9toxlGstQiri6kTpu+ZdJLElX5YQ317SKepd +XptJYb9f32K4RSseM4jPOwK1LWNc1YzlyXLTH4YL7NbWP9acan4RgjV6FQdfsOeQ1N/MG 6a9SgqoZuowf5R04ODkdJQJLRfmYbvx/T4TggONnyDJgY/+iP5lsWnHH7TkxZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789988739; 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=XQqtomaEQ0u8xTQth/ei0BrJKFEPc14JZkK+aOVt0AM=; b=UrTwWV4pokIfI6TaLDYVG0Ue+cXplufhrzMk41h/MkIA8u2BQoFQSmF6WW4edxBmqXsOVG 8FQq2U2f/LOpifqbGwXPCIaTzi1Zg8PlXzBRqyhOaf8qLHM0YXuar20ec04F2BR0Iwml/x WT/d5pkB+640/ziy/g/JDpQ/HGiTLeCYO4f4dNSmWbJaLSb/LoUJFoJBGoFeZSqt2zVaT/ 3o4e8KEGM4x/SJl2yVEsmTFj+GVM9NkbZ24JPTx91AwPc4/eYiU6PmRTp+gTrqE4J0+Hfu AOrh5+DzojbJe/YlibVCUvHxcFCL6iOhgb4KUQQIhF9ev41kU77IkVkXEOvt0g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4hpL4M4k1HzHdc for ; Mon, 21 Sep 2026 11:05:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 34597 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 21 Sep 2026 11:05:34 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: eefd55678c53 - stable/15 - sound: Prefer idle primary channels when allocating 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: christos X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: eefd55678c530e9d0cf3480edf86c4d815f36fc8 Auto-Submitted: auto-generated Date: Mon, 21 Sep 2026 11:05:34 +0000 Message-Id: <6ab10f7e.34597.6c4d64b0@gitrepo.freebsd.org> The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=eefd55678c530e9d0cf3480edf86c4d815f36fc8 commit eefd55678c530e9d0cf3480edf86c4d815f36fc8 Author: Christos Margiolis AuthorDate: 2026-09-07 13:04:09 +0000 Commit: Christos Margiolis CommitDate: 2026-09-21 11:04:08 +0000 sound: Prefer idle primary channels when allocating dsp_chn_alloc() stopped at the first primary channel that was either idle or already had vchans. Since the list is walked in order, the first channel matched both conditions once it had been used, so every client after the first was stacked onto it as a vchan and the remaining primary channels were never allocated at all. This is invisible on devices with a single primary channel, but not on those which provide several. snd_emu10kx(4), for instance, registers four primary channels for its front device, each able to run with its own rate. Look for an idle primary channel first, and only fall back to sharing one that already has vchans when there is none left. Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D59084 (cherry picked from commit 5e02679f03cda224f59adcf83d5308fffa6d11a1) --- sys/dev/sound/pcm/dsp.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c index 633f096a4e78..c7616d9ecefc 100644 --- a/sys/dev/sound/pcm/dsp.c +++ b/sys/dev/sound/pcm/dsp.c @@ -186,18 +186,28 @@ dsp_chn_alloc(struct snddev_info *d, struct pcm_channel **ch, int direction, (direction == PCMDIR_REC && d->flags & SD_F_RVCHANS); *ch = NULL; + + /* + * Prefer an idle primary channel, so that devices which provide more + * than one of them use them all, instead of stacking every client on + * the first one. + */ CHN_FOREACH(c, d, channels.pcm.primary) { CHN_LOCK(c); - if (c->direction != direction) { - CHN_UNLOCK(c); - continue; - } - /* Find an available primary channel to use. */ - if ((c->flags & CHN_F_BUSY) == 0 || - (vdir_enabled && (c->flags & CHN_F_HAS_VCHAN))) + if (c->direction == direction && (c->flags & CHN_F_BUSY) == 0) break; CHN_UNLOCK(c); } + /* Fall back to sharing a primary channel that already has vchans. */ + if (c == NULL && vdir_enabled) { + CHN_FOREACH(c, d, channels.pcm.primary) { + CHN_LOCK(c); + if (c->direction == direction && + (c->flags & CHN_F_HAS_VCHAN)) + break; + CHN_UNLOCK(c); + } + } if (c == NULL) return (EBUSY);