Module Name: src Committed By: isaki Date: Wed Apr 29 03:58:27 UTC 2020
Modified Files: src/sys/dev/audio: audio.c audiodef.h Log Message: 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@. To generate a diff of this commit: cvs rdiff -u -r1.67 -r1.68 src/sys/dev/audio/audio.c cvs rdiff -u -r1.13 -r1.14 src/sys/dev/audio/audiodef.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.67 src/sys/dev/audio/audio.c:1.68 --- src/sys/dev/audio/audio.c:1.67 Sun Apr 19 03:52:22 2020 +++ src/sys/dev/audio/audio.c Wed Apr 29 03:58:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.67 2020/04/19 03:52:22 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.68 2020/04/29 03:58:27 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.67 2020/04/19 03:52:22 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.68 2020/04/29 03:58:27 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -451,6 +451,41 @@ audio_track_bufstat(audio_track_t *track #define SPECIFIED(x) ((x) != ~0) #define SPECIFIED_CH(x) ((x) != (u_char)~0) +/* + * Default hardware blocksize in msec. + * + * We use 10 msec for most 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. + * In either case, you can overwrite AUDIO_BLK_MS by your kernel + * configuration file if you wish. + * + * 40 msec was initially choosen for the following reason: + * (1 / 40ms) = 25 = 5^2. Thus, the frequency is factored by 5. + * 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(__hppa__) || \ + defined(__m68k__) || \ + defined(__sh3__) || \ + (defined(__sparc__) && !defined(__sparc64__)) || \ + defined(__vax__) +#define AUDIO_TOO_SLOW_ARCHS 1 +#endif + +#if !defined(AUDIO_BLK_MS) +# if defined(AUDIO_TOO_SLOW_ARCHS) +# define AUDIO_BLK_MS 40 +# else +# define AUDIO_BLK_MS 10 +# endif +#endif + +#undef AUDIO_TOO_SLOW_ARCHS + /* Device timeout in msec */ #define AUDIO_TIMEOUT (3000) Index: src/sys/dev/audio/audiodef.h diff -u src/sys/dev/audio/audiodef.h:1.13 src/sys/dev/audio/audiodef.h:1.14 --- src/sys/dev/audio/audiodef.h:1.13 Sat Mar 28 08:35:36 2020 +++ src/sys/dev/audio/audiodef.h Wed Apr 29 03:58:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audiodef.h,v 1.13 2020/03/28 08:35:36 isaki Exp $ */ +/* $NetBSD: audiodef.h,v 1.14 2020/04/29 03:58:27 isaki Exp $ */ /* * Copyright (C) 2017 Tetsuya Isaki. All rights reserved. @@ -43,25 +43,6 @@ #define AUMINNOBLK (3) /* - * Hardware blocksize in msec. - * We use 10 msec as default for most platforms. But it's too severe for - * most m68k. - * - * 40 msec was initially choosen for the following reason: - * (1 / 40ms) = 25 = 5^2. Thus, the frequency is factored by 5. - * 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) -# if defined(__m68k__) -# define AUDIO_BLK_MS 40 -# else -# define AUDIO_BLK_MS 10 -# endif -#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