git: 968e748c439a - main - snd_dummy: advance pointers for both channels

From: Christos Margiolis <christos_at_FreeBSD.org>
Date: Sat, 27 Jun 2026 13:42:36 UTC
The branch main has been updated by christos:

URL: https://cgit.FreeBSD.org/src/commit/?id=968e748c439a50ad0a1a4463f4753f58a2bdaf9f

commit 968e748c439a50ad0a1a4463f4753f58a2bdaf9f
Author:     Goran Mekić <meka@tilda.center>
AuthorDate: 2026-06-27 13:41:57 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2026-06-27 13:41:57 +0000

    snd_dummy: advance pointers for both channels
    
    Previously only the play pointer advanced each tick; the record channel
    refilled the whole buffer with silence and left the DMA pointer at 0.
    Advance the record pointer by one block per tick and fill that block
    with silence, so the DMA pointer changes and mmap kqueue consumers can
    track progress.
    
    MFC after:      1 week
    Reviewed by:    christos
    Differential Revision:  https://reviews.freebsd.org/D57834
---
 sys/dev/sound/dummy.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/sys/dev/sound/dummy.c b/sys/dev/sound/dummy.c
index 91a198e3d9f6..7390ba9f467f 100644
--- a/sys/dev/sound/dummy.c
+++ b/sys/dev/sound/dummy.c
@@ -112,11 +112,10 @@ dummy_chan_io(void *arg)
 		ch = &sc->chans[i];
 		if (!ch->run)
 			continue;
-		if (ch->dir == PCMDIR_PLAY) {
-			ch->ptr += ch->buf->blksz;
-			ch->ptr %= ch->buf->bufsize;
-		} else
+		if (ch->dir == PCMDIR_REC)
 			sndbuf_fillsilence(ch->buf);
+		ch->ptr += ch->buf->blksz;
+		ch->ptr %= ch->buf->bufsize;
 		mtx_unlock(&sc->lock);
 		chn_intr(ch->chan);
 		mtx_lock(&sc->lock);