Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/pci/hdaudio ossaudio's SNDCTL_DSP_GETOSPACE will cal...
details: https://anonhg.NetBSD.org/src/rev/e7b4584fb28b
branches: trunk
changeset: 770575:e7b4584fb28b
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Mon Oct 24 02:08:22 2011 +0000
description:
ossaudio's SNDCTL_DSP_GETOSPACE will call AUDIO_SETINFO if the block size
isn't a power of two, and since the block size is changing this tells
audio(4) to halt output, reconfigure the device, then trigger output again.
mplayer's oss driver uses SNDCTL_DSP_GETOSPACE a lot.
Instead of simply rounding to 128 bytes as required by the hardware, change
hdafg_round_blocksize to return one of 128, 256, 512, 1024, 2048, 4096,
or 8192.
diffstat:
sys/dev/pci/hdaudio/hdafg.c | 25 +++++++++++++++----------
1 files changed, 15 insertions(+), 10 deletions(-)
diffs (59 lines):
diff -r 1bc0fea75802 -r e7b4584fb28b sys/dev/pci/hdaudio/hdafg.c
--- a/sys/dev/pci/hdaudio/hdafg.c Sun Oct 23 23:41:56 2011 +0000
+++ b/sys/dev/pci/hdaudio/hdafg.c Mon Oct 24 02:08:22 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hdafg.c,v 1.8 2011/09/07 20:34:58 jmcneill Exp $ */
+/* $NetBSD: hdafg.c,v 1.9 2011/10/24 02:08:22 jmcneill Exp $ */
/*
* Copyright (c) 2009 Precedence Technologies Ltd <support%precedence.co.uk@localhost>
@@ -60,7 +60,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.8 2011/09/07 20:34:58 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hdafg.c,v 1.9 2011/10/24 02:08:22 jmcneill Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -3801,7 +3801,7 @@
{
struct hdaudio_audiodev *ad = opaque;
struct hdaudio_stream *st;
- int bufsize;
+ int bufsize, nblksize;
st = (mode == AUMODE_PLAY) ? ad->ad_playback : ad->ad_capture;
if (st == NULL) {
@@ -3810,19 +3810,24 @@
return 128;
}
- /* Multiple of 128 */
- blksize &= ~127;
- if (blksize <= 0)
+ if (blksize > 8192)
+ blksize = 8192;
+ else if (blksize < 0)
blksize = 128;
+ /* HD audio wants a multiple of 128, and OSS wants a power of 2 */
+ for (nblksize = 128; nblksize < blksize; nblksize <<= 1)
+ ;
+
+ /* Make sure there are enough BDL descriptors */
bufsize = st->st_data.dma_size;
- if (bufsize > HDAUDIO_BDL_MAX * blksize) {
+ if (bufsize > HDAUDIO_BDL_MAX * nblksize) {
blksize = bufsize / HDAUDIO_BDL_MAX;
- if (blksize & 127)
- blksize = (blksize + 127) & ~127;
+ for (nblksize = 128; nblksize < blksize; nblksize <<= 1)
+ ;
}
- return blksize;
+ return nblksize;
}
static int
Home |
Main Index |
Thread Index |
Old Index