Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev Allow for block sizes less than hw block size. This...
details: https://anonhg.NetBSD.org/src/rev/8262699cba55
branches: trunk
changeset: 827553:8262699cba55
user: nat <nat%NetBSD.org@localhost>
date: Fri Nov 03 05:07:37 2017 +0000
description:
Allow for block sizes less than hw block size. This allows for the lowest
possible latency for all precision, sample rate and frequencies.
This is a rework of rev 1.419.
diffstat:
sys/dev/audio.c | 24 ++++++++++++++++++++----
1 files changed, 20 insertions(+), 4 deletions(-)
diffs (46 lines):
diff -r 1f5b369f0d77 -r 8262699cba55 sys/dev/audio.c
--- a/sys/dev/audio.c Fri Nov 03 05:04:17 2017 +0000
+++ b/sys/dev/audio.c Fri Nov 03 05:07:37 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.423 2017/11/03 05:04:17 nat Exp $ */
+/* $NetBSD: audio.c,v 1.424 2017/11/03 05:07:37 nat Exp $ */
/*-
* Copyright (c) 2016 Nathanial Sloss <nathanialsloss%yahoo.com.au@localhost>
@@ -148,7 +148,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.423 2017/11/03 05:04:17 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.424 2017/11/03 05:07:37 nat Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -2005,9 +2005,25 @@
blksize = rp->s.bufsize / AUMINNOBLK;
ROUNDSIZE(blksize);
DPRINTF(("audio_init_ringbuffer: MI blksize=%d\n", blksize));
- if (sc->hw_if->round_blocksize)
+
+ struct virtual_channel *hwvc = sc->sc_hwvc;
+ if (sc->hw_if->round_blocksize &&
+ (rp == &hwvc->sc_mpr || rp == &hwvc->sc_mrr)) {
blksize = sc->hw_if->round_blocksize(sc->hw_hdl, blksize,
- mode, &rp->s.param);
+ mode, &rp->s.param);
+ } else {
+ int hwblksize = AU_RING_SIZE;
+ if (sc->hw_if->round_blocksize) {
+ if (audio_can_capture(sc))
+ hwblksize = sc->sc_hwvc->sc_mpr.blksize;
+ else
+ hwblksize = sc->sc_hwvc->sc_mrr.blksize;
+ }
+
+ if (blksize > hwblksize)
+ blksize = hwblksize;
+ }
+
if (blksize <= 0)
panic("audio_init_ringbuffer: blksize=%d", blksize);
nblks = rp->s.bufsize / blksize;
Home |
Main Index |
Thread Index |
Old Index