From nobody Mon Sep 21 11:05:34 2026 X-Original-To: dev-commits-src-branches@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 4hpL4G4tsbz6rRV6 for ; Mon, 21 Sep 2026 11:05:34 +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 4hpL4G4Gm6z3H2H for ; Mon, 21 Sep 2026 11:05:34 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789988734; 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=RtVPdwcLScIVyNCdl8bDGY8whxdITe0W8mTyIm7dGZEheJ8dn12kbQSdcZv03xnCqT5fg9 l2JrsQaLtJq87nSMbBTt4nVXV3wjljl/BRojrysfrSfqE4mB/L4GeNRDh5G/in/mJqgJrB EwjSgom1hHrspuaDtJAXAoBct26Ya6KpUMDIBVf/TEydspl+nQEiq5Gc1HfxEFKOv8V9Kp tfg67auHtaYC2odtBTHbzIeTrpC6y+O03D/23EJEmm3kigimOlDKJNdqph4OZTnT0iZyrP rMRE1kV60gyLQcJ86c6Ly/VlZokben4K+u0MeYJfcBwq01RK9uy1751uKBCztg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789988734; b=Uhb9/lyXLNMl++mZihO3cIxGxG33qiQcGmpUuxCndCnlyVaJryi3l7hsBI01j0ph1/HyLM M3BqQb0gqw3DIZmBUZbkOsQyJz1tCWdlvVWv39coJQonF3DcS7TsweRrgowyGm/lX34Q1C /TCwQbqIR0GBYIf2l4+qgTdHvVBvUJbbLLLEyyu1L91gzr/aUwWcdoxH2UoOZkRM29LN8c lCml/H1X5SdOX8UDdBoqfM6tc6Xc72UmzeolZlN77AI9aJ9T4KL5CxtxCRK5CWiw1TKnbL w3HJlWkCJO+H5Ty3t2vh/puKTXRJhKXS96K1KDEocFaav8ObIBP+1+wTCMWIog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789988734; 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=pWxgx/U0K14GXmHLkIoIRwdmE83RvwMhGb+BMB0K60tW2RAiLNc74Ma508DmFa/M8RDh0O lXMFKp9OySg+BwmfUG7nJ01z60XzAnu7wBG3t2EU8Wc9ySsJBnPkCrBSHHGXEB73Po0lZy 5iepm+Q/pX1SQYM7WRhlBIEGHv0l/05HANs2jUnUFsXB+rRhcxlEneyptaoH27b+A1yDii wJUJyxpB5o42CijygWID1haq8FVQMLcdD1Kw1CP/mcRQZ0YC71UT1X2dlA18VdNn4JT3Zf KshBEPKrQg4bkQWkhkyW27rJNXoinrXk6QyCSo2c62TTmOkdlsm+f0Ff69dxSQ== 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 4hpL4G34vfzGdq for ; Mon, 21 Sep 2026 11:05:34 +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: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@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);