NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
port-mac68k/60702: mac68k: ascaudio(4) has hardcoded 368 ms playback block
>Number: 60702
>Category: port-mac68k
>Synopsis: mac68k: ascaudio(4) has hardcoded 368 ms playback block
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: port-mac68k-maintainer
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Wed Sep 09 12:45:01 +0000 2026
>Originator: Ray Tran
>Release: 11.0
>Organization:
Diamond Creek Digital
>Environment:
Apple Macintosh Centris 650 running NetBSD 11.0
>Description:
ascaudio_round_blocksize() returns PLAYBLKSIZE (8192 bytes) for playback
whatever size it is asked for. At the driver's format that is a 368 ms
block. The MI audio layer primes two blocks before it starts the
hardware (audio_pmixer_start: "Need two blocks to start normally") and
drains to a block boundary at the end, so the block size is the latency
of every sound. On a Centris 650 the console bell rings about three
quarters of a second after the keystroke, and a 0.2 s clip takes 1.45 s
of wall time in audioplay(1).
The MI layer has a knob for this, hw.audioN.blk_ms, with a default of
10 ms. The driver's callback overrides it, so the sysctl
exists and does nothing for playback. The play ring in the driver takes
the block size as a parameter and does not depend on the fixed value.
I propose a change to make the callback honour the size it is asked for, rounded up to
whole FIFO halves (1024 bytes, 512 frames), with 2048 as the floor and
the old 8192 as the cap.
>How-To-Repeat:
On an AUDIO kernel, ring the console bell and listen for the delay, or
time audioplay(1) on a 0.2 s clip. sysctl -w hw.audio0.blk_ms=10 has no effect.
>Fix:
Applies to sys/arch/mac68k/obio/ascaudio.c, on top of the patch in the
via2_noint(4) PR (ascaudio_intr_enable on A/UX-interrupt machines).
Measured on a Centris 650 (68040/25 MHz, EASC 0xbb) running NetBSD 11.0,
before and after:
fixed 8192 1024 (floor tried) 2048 (floor)
dmesg block 368 ms 46 ms 92 ms
0.2 s clip, wall 1.45 s 0.50 s 0.56 s
3 s clip, wall 4.38 s 3.55 s
3 s clip, sys time 0.51 s 0.70 s
The bell is judged responsive by ear at both sizes, and two streams
mix correctly. The extra system time at 1024 is the mixer thread
waking eight times as often, 0.2 s over a 3 s clip on this CPU.
Playback produces no via2_noint lines with both patches applied. The
same patch applies to -current.
Applies with "patch -p1" from the top of usr/src; verified with -F0
(no fuzz) against NetBSD-current 11.99.8 (20260830003849Z) and 11.0.
--- a/sys/arch/mac68k/obio/ascaudio.c
+++ b/sys/arch/mac68k/obio/ascaudio.c
@@ -64,7 +64,22 @@
#define MAC68K_ASCAUDIO_LEN 0x2000
#define BUFSIZE 32768
-#define PLAYBLKSIZE 8192
+#define PLAYBLKUNIT 1024 /* one FIFO half: 512 frames */
+#define PLAYBLKMIN 2048 /* 92 ms */
+#define PLAYBLKSIZE 8192 /* 368 ms, the cap */
#define RECBLKSIZE 1024
#define ASC_VIA_CLR_INTR() via_reg(VIA2, vIFR) = V2IF_ASC
@@ -760,10 +775,15 @@
sc = (ascaudio_softc_t *)opaque;
KASSERT(mutex_owned(&sc->sc_lock));
- if (mode == AUMODE_PLAY)
- return PLAYBLKSIZE;
- else
- return RECBLKSIZE;
+ if (mode == AUMODE_PLAY) {
+ blksize = roundup(blksize, PLAYBLKUNIT);
+ if (blksize < PLAYBLKMIN)
+ blksize = PLAYBLKMIN;
+ if (blksize > PLAYBLKSIZE)
+ blksize = PLAYBLKSIZE;
+ return blksize;
+ }
+ return RECBLKSIZE;
}
static void
Home |
Main Index |
Thread Index |
Old Index