From nobody Mon Sep 14 10:45:08 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 4hk1y24c6Vz6sNnx for ; Mon, 14 Sep 2026 10:45:14 +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 4hk1y22PdQz4pDn for ; Mon, 14 Sep 2026 10:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789382714; 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=xrEOFq96kZCEhRkYBZ5IoyE6oYFlHO+rMs+CyxF19HQ=; b=Y0tUL8yaqKxb6KwdJ1j1BekaGl5EsP2abW4lW2CWfkX4AECMhJE4lQyoLZ7A6+4cYyHNL2 KrvFKwCNhVpaCLzMlQcSA0ch4whE2nVhMMuV2BMPEN8wE3E5hziVABzUILuSRIH/ipI3Aj 9gFyyboYZy9KtkDAFTo3i8yeOMJmYLFgbt8OIqRlO4Jy8vtbiTsg/dRsAnYspxYfU0qLFT Qw7EeHe7ltx+uze2tKPBBv0lkE3GreQSi+V8mVQt9nkuy3rGOn0Pn52ShYSNx1ecMjFY75 +FGvwOQTxZ2Zjwm9NvnBUQ/+wVxNaAhiwhcnl0/nugm+DhsdOEYIGYBgCNyqCg== ARC-Seal: i=1; a=rsa-sha256; d=freebsd.org; s=dkim; cv=none; t=1789382714; b=IBhOI/5u3H/N4gZ6K4AN0t3tj6jphSHRYGZzqiFjiv+zzOJp8TUe2H75MeqoK+NnV9Aehn qS8StWPrOMd6UMuuGEsZAVGsBlCLWIUTYN742HKlGizufNexGmt+oZbddLTRNa7P8CnbYC RAk03/10Ck3l6eNICRhMlYEgVN8QQIT5ULGeZdp/TznplHXUaEOaVDnrHTaSs9HennnzEl ukry+hvH3PJUDowhxTl29I9df20/AUz0agiHiHWxddO0N57DrMrDw4MCtYl6QHaAx772D5 /NvgXyi8QGMBR+l243PQ0z0syW7D/2LJRKd4JlmBjW274bGK9ciiUE7JWorCGg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1789382714; 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=xrEOFq96kZCEhRkYBZ5IoyE6oYFlHO+rMs+CyxF19HQ=; b=ttqA1zJN44YtfmY6YEOuCo1i2rCt3DPIflX+wyXcAQfbdkeNnyt145pxaf7P1VnxMSmNw9 WTe7cRMeYZKxJFXXZWFQHoN3i4L9n0HZPqIo9sBkAI1jnr0wimayEjq1eQ0UuBDWenXvVF pHEphaC9JSspAClFuc3OA8d8V1s47VfSP0w39L9JhtEliJc0d+3VeBwfi2O902t3HsIxGK yMbfO1x4k8kC+N00c4diuhhEt3mYpNKC8dQoV+X6Jp1tK1sePU+Z/GKNkN3en+y5epdo88 bemhYsm+5IYyuV/8oTx7g12v4yNQiGCbL5mApem4HOOiGYvpGsoegSLFnz6J/w== 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 4hk1y21D88z1PLJ for ; Mon, 14 Sep 2026 10:45:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 434e1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Mon, 14 Sep 2026 10:45:08 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Christos Margiolis Subject: git: cbd730ebeb03 - stable/15 - snd_emu10kx: Make sure the block count and size cover the whole buffer 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: cbd730ebeb03e26578bdef61669acca1cc7c65fa Auto-Submitted: auto-generated Date: Mon, 14 Sep 2026 10:45:08 +0000 Message-Id: <6aa7d034.434e1.450bf8ef@gitrepo.freebsd.org> The branch stable/15 has been updated by christos: URL: https://cgit.FreeBSD.org/src/commit/?id=cbd730ebeb03e26578bdef61669acca1cc7c65fa commit cbd730ebeb03e26578bdef61669acca1cc7c65fa Author: Christos Margiolis AuthorDate: 2026-09-07 14:48:21 +0000 Commit: Christos Margiolis CommitDate: 2026-09-14 10:44:57 +0000 snd_emu10kx: Make sure the block count and size cover the whole buffer The playback voices always loop over the whole EMU_PLAY_BUFSZ buffer, but emupchan_setblocksize() only recorded the new block size and left the block count as it was set up by emu_vinit(). The blocks then no longer covered the whole buffer, and the part they left out was played without ever being written to, which became audible as distortion once playback started going through a virtual channel. Resize the buffer, so that the block count and size always cover it. Fixes: 02d4eeabfd73 ("sound: Allocate vchans on-demand") PR: 287687 MFC after: 1 week Sponsored by: The FreeBSD Foundation Reviewed by: markj Differential Revision: https://reviews.freebsd.org/D59444 (cherry picked from commit a7258157e1a20957af23332814197ea723f5778d) --- sys/dev/sound/pci/emu10kx-pcm.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/sys/dev/sound/pci/emu10kx-pcm.c b/sys/dev/sound/pci/emu10kx-pcm.c index 7cb371d82d39..0a15b8ba3448 100644 --- a/sys/dev/sound/pci/emu10kx-pcm.c +++ b/sys/dev/sound/pci/emu10kx-pcm.c @@ -768,13 +768,30 @@ emupchan_setblocksize(kobj_t obj __unused, void *c_devinfo, uint32_t blocksize) { struct emu_pcm_pchinfo *ch = c_devinfo; struct emu_pcm_info *sc = ch->pcm; + uint32_t blkcnt; + + /* + * The channel always plays the whole EMU_PLAY_BUFSZ buffer, so the + * blocks have to cover it exactly, or the part they do not cover is + * "played" without ever being written to. + * + * sndbuf_resize() needs at least two blocks, so a block can be at most + * half the buffer's size. The block count has to be a power of two as + * well, because only then does the division come out exact. + */ + if (blocksize == 0 || blocksize > EMU_PLAY_BUFSZ / 2) + blocksize = EMU_PLAY_BUFSZ / 2; + blkcnt = 1 << (fls(EMU_PLAY_BUFSZ / blocksize) - 1); + blocksize = EMU_PLAY_BUFSZ / blkcnt; + + if (sndbuf_resize(ch->buffer, blkcnt, blocksize) != 0) + return (ch->blksz); - if (blocksize > ch->pcm->bufsz) - blocksize = ch->pcm->bufsz; mtx_lock(&sc->lock); ch->blksz = blocksize; emu_timer_set(sc->card, ch->timer, ch->blksz / ch->buffer->align); mtx_unlock(&sc->lock); + return (ch->blksz); }