Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-9]: src/sys/dev/audio Pull up following revision(s) (requested by...
details: https://anonhg.NetBSD.org/src/rev/a4cd070486ec
branches: netbsd-9
changeset: 933016:a4cd070486ec
user: martin <martin%NetBSD.org@localhost>
date: Mon May 18 18:12:24 2020 +0000
description:
Pull up following revision(s) (requested by isaki in ticket #911):
sys/dev/audio/audiodef.h: revision 1.13
sys/dev/audio/audiodef.h: revision 1.14
sys/arch/sparc/include/param.h: revision 1.74
sys/arch/evbarm/conf/GENERIC64: revision 1.148
sys/arch/sh3/include/param.h: revision 1.25
sys/arch/evbarm/conf/GENERIC: revision 1.75
sys/arch/m68k/include/param.h: revision 1.23
sys/arch/amd64/conf/GENERIC: revision 1.564
sys/arch/hppa/include/param.h: revision 1.27
sys/dev/audio/audio.c: revision 1.68
sys/arch/vax/include/param.h: revision 1.63
sys/dev/audio/audio.c: revision 1.69
Reduce default AUDIO_BLK_MS from 40msec to 10msec on all platform except m68k
(m68k uses 40msec default as before). And remove the option from GENERIC.
- It's not good idea to set such parameter in individual GENERICs.
- 4msec is (probably no problem for most modern real hardware but)
too aggressive to be default.
- 10msec is too severe for antique machines but it's hard to draw a line.
Set AUDIO_BLK_MS 40 msec on other old(slow) architectures not only m68k.
Thanks tsutsui@ for comment about architecture choice.
And move it from audiodef.h to audio.c as suggested by joerg@.
Move machine dependent AUDIO_BLK_MS default value to <machine/param.h>.
If the port has __AUDIO_BLK_MS in <machine/param.h>, it will be used.
Otherwise the default value (currently 10 msec) defined in audio.c will
be used. This mechanism is for very old ports which cannot satisfactorily
handle 10 msec block. Currently hppa, m68k, sh3, sparc(!64) and vax are.
For port maintainers, if general models in your port cannot satisfactorily
handle 10 msec block, please consider to define your suitable longer period
(40 msec would be a good first choice).
But please don't be eager to make the default value shorter.
<machine/param.h> was discussed in source-changes-d. It's better than
ifdef storm, or adding 60+ new header files in every arch/*/include/
directories for this. Thanks mrg@, ad@, and everyone.
http://mail-index.netbsd.org/source-changes-d/2020/05/01/msg012572.html
diffstat:
sys/arch/amd64/conf/GENERIC | 7 ++-----
sys/arch/evbarm/conf/GENERIC | 3 +--
sys/arch/evbarm/conf/GENERIC64 | 3 +--
sys/arch/hppa/include/param.h | 7 ++++++-
sys/arch/m68k/include/param.h | 7 ++++++-
sys/arch/sh3/include/param.h | 7 ++++++-
sys/arch/sparc/include/param.h | 5 ++++-
sys/arch/vax/include/param.h | 6 +++++-
sys/dev/audio/audio.c | 26 ++++++++++++++++++++++++--
sys/dev/audio/audiodef.h | 13 +------------
10 files changed, 56 insertions(+), 28 deletions(-)
diffs (231 lines):
diff -r aeac4755e43a -r a4cd070486ec sys/arch/amd64/conf/GENERIC
--- a/sys/arch/amd64/conf/GENERIC Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/amd64/conf/GENERIC Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.531.2.8 2020/01/27 07:06:02 martin Exp $
+# $NetBSD: GENERIC,v 1.531.2.9 2020/05/18 18:12:25 martin Exp $
#
# GENERIC machine description file
#
@@ -22,7 +22,7 @@
options INCLUDE_CONFIG_FILE # embed config file in kernel binary
-#ident "GENERIC-$Revision: 1.531.2.8 $"
+#ident "GENERIC-$Revision: 1.531.2.9 $"
maxusers 64 # estimated number of users
@@ -55,9 +55,6 @@
options INSECURE # disable kernel security levels - X needs this
-options AUDIO_BLK_MS=4 # make software with low latency needs performant
- # no substantial CPU overhead on this platform
-
options RTC_OFFSET=0 # hardware clock is this many mins. west of GMT
options NTP # NTP phase/frequency locked loop
diff -r aeac4755e43a -r a4cd070486ec sys/arch/evbarm/conf/GENERIC
--- a/sys/arch/evbarm/conf/GENERIC Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/evbarm/conf/GENERIC Mon May 18 18:12:24 2020 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC,v 1.48.2.7 2020/04/02 19:20:07 martin Exp $
+# $NetBSD: GENERIC,v 1.48.2.8 2020/05/18 18:12:25 martin Exp $
#
# GENERIC ARM (aarch32) kernel
#
@@ -614,7 +614,6 @@
sunxicodec* at fdt? # Allwinner audio codec
sunxii2s* at fdt? # I2S/PCM
audio* at audiobus?
-options AUDIO_BLK_MS=4
spkr* at audio?
# SDMMC
diff -r aeac4755e43a -r a4cd070486ec sys/arch/evbarm/conf/GENERIC64
--- a/sys/arch/evbarm/conf/GENERIC64 Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/evbarm/conf/GENERIC64 Mon May 18 18:12:24 2020 +0000
@@ -1,5 +1,5 @@
#
-# $NetBSD: GENERIC64,v 1.103.2.9 2020/04/02 19:20:07 martin Exp $
+# $NetBSD: GENERIC64,v 1.103.2.10 2020/05/18 18:12:25 martin Exp $
#
# GENERIC ARM (aarch64) kernel
#
@@ -426,7 +426,6 @@
a64acodec* at fdt? # Allwinner A64 audio codec (analog part)
sunxii2s* at fdt? # Allwinner I2S/PCM
audio* at audiobus?
-options AUDIO_BLK_MS=4
spkr* at audio? # PC speaker (synthesized)
diff -r aeac4755e43a -r a4cd070486ec sys/arch/hppa/include/param.h
--- a/sys/arch/hppa/include/param.h Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/hppa/include/param.h Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.23 2019/04/16 12:25:17 skrll Exp $ */
+/* $NetBSD: param.h,v 1.23.4.1 2020/05/18 18:12:25 martin Exp $ */
/* $OpenBSD: param.h,v 1.12 2001/07/06 02:07:41 provos Exp $ */
@@ -88,3 +88,8 @@
#define btop(x) ((unsigned long)(x) >> PGSHIFT)
#define ptob(x) ((unsigned long)(x) << PGSHIFT)
+
+/* Default audio blocksize in msec. See sys/dev/audio/audio.c */
+#if defined(_KERNEL)
+#define __AUDIO_BLK_MS (40)
+#endif
diff -r aeac4755e43a -r a4cd070486ec sys/arch/m68k/include/param.h
--- a/sys/arch/m68k/include/param.h Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/m68k/include/param.h Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.22 2019/01/07 22:00:31 jdolecek Exp $ */
+/* $NetBSD: param.h,v 1.22.4.1 2020/05/18 18:12:25 martin Exp $ */
/*
* Copyright (c) 1988 University of Utah.
@@ -95,4 +95,9 @@
#define m68k_btop(x) ((vaddr_t)(x) >> PGSHIFT)
#define m68k_ptob(x) ((vaddr_t)(x) << PGSHIFT)
+/* Default audio blocksize in msec. See sys/dev/audio/audio.c */
+#if defined(_KERNEL)
+#define __AUDIO_BLK_MS (40)
+#endif
+
#endif /* !_M68K_PARAM_H_ */
diff -r aeac4755e43a -r a4cd070486ec sys/arch/sh3/include/param.h
--- a/sys/arch/sh3/include/param.h Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/sh3/include/param.h Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.24 2019/01/07 22:00:32 jdolecek Exp $ */
+/* $NetBSD: param.h,v 1.24.4.1 2020/05/18 18:12:25 martin Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc. All rights reserved.
@@ -91,4 +91,9 @@
#define NKMEMPAGES_MIN_DEFAULT ((16 * 1024 * 1024) >> PAGE_SHIFT)
#define NKMEMPAGES_MAX_DEFAULT ((128 * 1024 * 1024) >> PAGE_SHIFT)
+/* Default audio blocksize in msec. See sys/dev/audio/audio.c */
+#if defined(_KERNEL)
+#define __AUDIO_BLK_MS (40)
+#endif
+
#endif /* !_SH3_PARAM_H_ */
diff -r aeac4755e43a -r a4cd070486ec sys/arch/sparc/include/param.h
--- a/sys/arch/sparc/include/param.h Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/sparc/include/param.h Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.73 2019/05/15 16:59:10 christos Exp $ */
+/* $NetBSD: param.h,v 1.73.2.1 2020/05/18 18:12:25 martin Exp $ */
/*
* Copyright (c) 1992, 1993
@@ -155,4 +155,7 @@
# define PGSHIFT pgshift
#endif
+/* Default audio blocksize in msec. See sys/dev/audio/audio.c */
+#define __AUDIO_BLK_MS (40)
+
#endif /* _KERNEL || _STANDALONE */
diff -r aeac4755e43a -r a4cd070486ec sys/arch/vax/include/param.h
--- a/sys/arch/vax/include/param.h Mon May 18 18:05:34 2020 +0000
+++ b/sys/arch/vax/include/param.h Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: param.h,v 1.62 2019/01/07 22:00:33 jdolecek Exp $ */
+/* $NetBSD: param.h,v 1.62.4.1 2020/05/18 18:12:25 martin Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -118,6 +118,10 @@
#define DELAY(x) delay(x)
#define MAXEXEC 1
+
+/* Default audio blocksize in msec. See sys/dev/audio/audio.c */
+#define __AUDIO_BLK_MS (40)
+
#endif /* _KERNEL */
#endif /* _VAX_PARAM_H_ */
diff -r aeac4755e43a -r a4cd070486ec sys/dev/audio/audio.c
--- a/sys/dev/audio/audio.c Mon May 18 18:05:34 2020 +0000
+++ b/sys/dev/audio/audio.c Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audio.c,v 1.28.2.14 2020/05/18 18:05:34 martin Exp $ */
+/* $NetBSD: audio.c,v 1.28.2.15 2020/05/18 18:12:24 martin Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -138,7 +138,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.14 2020/05/18 18:05:34 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.28.2.15 2020/05/18 18:12:24 martin Exp $");
#ifdef _KERNEL_OPT
#include "audio.h"
@@ -454,6 +454,28 @@
#define SPECIFIED(x) ((x) != ~0)
#define SPECIFIED_CH(x) ((x) != (u_char)~0)
+/*
+ * Default hardware blocksize in msec.
+ *
+ * We use 10 msec for most modern platforms. This period is good enough to
+ * play audio and video synchronizely.
+ * In contrast, for very old platforms, this is usually too short and too
+ * severe. Also such platforms usually can not play video confortably, so
+ * it's not so important to make the blocksize shorter. If the platform
+ * defines its own value as __AUDIO_BLK_MS in its <machine/param.h>, it
+ * uses this instead.
+ *
+ * In either case, you can overwrite AUDIO_BLK_MS by your kernel
+ * configuration file if you wish.
+ */
+#if !defined(AUDIO_BLK_MS)
+# if defined(__AUDIO_BLK_MS)
+# define AUDIO_BLK_MS __AUDIO_BLK_MS
+# else
+# define AUDIO_BLK_MS (10)
+# endif
+#endif
+
/* Device timeout in msec */
#define AUDIO_TIMEOUT (3000)
diff -r aeac4755e43a -r a4cd070486ec sys/dev/audio/audiodef.h
--- a/sys/dev/audio/audiodef.h Mon May 18 18:05:34 2020 +0000
+++ b/sys/dev/audio/audiodef.h Mon May 18 18:12:24 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: audiodef.h,v 1.7.2.3 2020/03/21 15:47:00 martin Exp $ */
+/* $NetBSD: audiodef.h,v 1.7.2.4 2020/05/18 18:12:24 martin Exp $ */
/*
* Copyright (C) 2017 Tetsuya Isaki. All rights reserved.
@@ -43,17 +43,6 @@
#define AUMINNOBLK (3)
/*
- * Hardware blocksize in msec.
- * We use 40 msec as default. (1 / 40ms) = 25 = 5^2.
- * In this case, the number of frames in a block can be an integer
- * even if the frequency is a multiple of 100 (44100, 48000, etc),
- * or even if 15625Hz (vs(4)).
- */
-#if !defined(AUDIO_BLK_MS)
-#define AUDIO_BLK_MS 40
-#endif
-
-/*
* Whether the playback mixer use single buffer mode.
* It reduces the latency one block but needs machine power.
* In case of the double buffer (as default), it increases the latency
Home |
Main Index |
Thread Index |
Old Index