At Wed, 29 Apr 2020 21:59:59 +0000, Andrew Doran wrote: > > > How about this diff? > > > The old platforms are the same as before, hppa, m68k, sh3, sparc(!64) > > > and vax. > > > > machine/param.h seems more natural to me. I don't have a strong opinion > > though. > > .. I mean, if it's a "tuneable" value like this rather than a constant like > __HAVE_SLOW_COMPUTER. :-)
I see. I like this feeling. (not strong opinion too though) How about you, mrg@? Thanks, --- Tetsuya Isaki <is...@pastel-flower.jp / is...@netbsd.org> diff --git a/sys/arch/hppa/include/param.h b/sys/arch/hppa/include/param.h index 39ce45623..69686c405 100644 --- a/sys/arch/hppa/include/param.h +++ b/sys/arch/hppa/include/param.h @@ -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 --git a/sys/arch/m68k/include/param.h b/sys/arch/m68k/include/param.h index f0bbe169e..ae67a324c 100644 --- a/sys/arch/m68k/include/param.h +++ b/sys/arch/m68k/include/param.h @@ -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 --git a/sys/arch/sh3/include/param.h b/sys/arch/sh3/include/param.h index 547b791f2..66b6d578e 100644 --- a/sys/arch/sh3/include/param.h +++ b/sys/arch/sh3/include/param.h @@ -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 --git a/sys/arch/sparc/include/param.h b/sys/arch/sparc/include/param.h index f6112f886..2225a52a2 100644 --- a/sys/arch/sparc/include/param.h +++ b/sys/arch/sparc/include/param.h @@ -155,4 +155,7 @@ extern void delay(unsigned int); # define PGSHIFT pgshift #endif +/* Default audio blocksize in msec. See sys/dev/audio/audio.c */ +#define __AUDIO_BLK_MS (40) + #endif /* _KERNEL || _STANDALONE */ diff --git a/sys/arch/vax/include/param.h b/sys/arch/vax/include/param.h index 57685709c..f350237b7 100644 --- a/sys/arch/vax/include/param.h +++ b/sys/arch/vax/include/param.h @@ -118,6 +118,10 @@ void delay(int); #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 --git a/sys/dev/audio/audio.c b/sys/dev/audio/audio.c index 13386ccfb..ef1424d48 100644 --- a/sys/dev/audio/audio.c +++ b/sys/dev/audio/audio.c @@ -454,38 +454,25 @@ audio_track_bufstat(audio_track_t *track, struct audio_track_debugbuf *buf) /* * Default hardware blocksize in msec. * - * We use 10 msec for most platforms. This period is good enough to play - * audio and video synchronizely. + * 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. + * 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. - * - * 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 +# if defined(__AUDIO_BLK_MS) +# define AUDIO_BLK_MS __AUDIO_BLK_MS # else -# define AUDIO_BLK_MS 10 +# define AUDIO_BLK_MS (10) # endif #endif -#undef AUDIO_TOO_SLOW_ARCHS - /* Device timeout in msec */ #define AUDIO_TIMEOUT (3000)