diff options
author | cg <cg@FreeBSD.org> | 2001-09-18 14:45:09 +0000 |
---|---|---|
committer | cg <cg@FreeBSD.org> | 2001-09-18 14:45:09 +0000 |
commit | 89b447d5202dcba7ae5666fa9cdbc1176489589a (patch) | |
tree | b4698dea31694640f25fcddb33f85cddd8a4b40e /sys/dev/sound | |
parent | afb2bba74cea514729fecbabc6c271793147e833 (diff) | |
download | FreeBSD-src-89b447d5202dcba7ae5666fa9cdbc1176489589a.zip FreeBSD-src-89b447d5202dcba7ae5666fa9cdbc1176489589a.tar.gz |
add a tunable/sysctl, hw.snd.targetirqrate, to modify the default target
irq rate for apps that do not set a blocksize.
Diffstat (limited to 'sys/dev/sound')
-rw-r--r-- | sys/dev/sound/pcm/channel.c | 24 | ||||
-rw-r--r-- | sys/dev/sound/pcm/channel.h | 2 |
2 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/sound/pcm/channel.c b/sys/dev/sound/pcm/channel.c index dc843ee..dd562c1 100644 --- a/sys/dev/sound/pcm/channel.c +++ b/sys/dev/sound/pcm/channel.c @@ -42,6 +42,26 @@ SND_DECLARE_FILE("$FreeBSD$"); #define DEB(x) x */ +static int chn_targetirqrate = 32; +TUNABLE_INT("hw.snd.targetirqrate", &chn_targetirqrate); + +static int +sysctl_hw_snd_targetirqrate(SYSCTL_HANDLER_ARGS) +{ + int err, val; + + val = chn_targetirqrate; + err = sysctl_handle_int(oidp, &val, sizeof(val), req); + if (val < 16 || val > 512) + err = EINVAL; + else + chn_targetirqrate = val; + + return err; +} +SYSCTL_PROC(_hw_snd, OID_AUTO, targetirqrate, CTLTYPE_INT | CTLFLAG_RW, + 0, sizeof(int), sysctl_hw_snd_targetirqrate, "I", ""); + static int chn_buildfeeder(struct pcm_channel *c); static void @@ -678,7 +698,7 @@ chn_init(struct pcm_channel *c, void *devinfo, int dir) } chn_setdir(c, dir); - /* And the secondary bufhard. */ + /* And the secondary buffer. */ sndbuf_setfmt(b, AFMT_U8); sndbuf_setfmt(bs, AFMT_U8); CHN_UNLOCK(c); @@ -859,7 +879,7 @@ chn_setblocksize(struct pcm_channel *c, int blkcnt, int blksz) if (blksz == -1) c->flags &= ~CHN_F_HAS_SIZE; if (!(c->flags & CHN_F_HAS_SIZE)) { - blksz = (sndbuf_getbps(bs) * sndbuf_getspd(bs)) / CHN_DEFAULT_HZ; + blksz = (sndbuf_getbps(bs) * sndbuf_getspd(bs)) / chn_targetirqrate; tmp = 32; while (tmp <= blksz) tmp <<= 1; diff --git a/sys/dev/sound/pcm/channel.h b/sys/dev/sound/pcm/channel.h index 118cf5d..cc3a3ea 100644 --- a/sys/dev/sound/pcm/channel.h +++ b/sys/dev/sound/pcm/channel.h @@ -155,6 +155,4 @@ int fmtvalid(u_int32_t fmt, u_int32_t *fmtlist); /* The size of a whole secondary bufhard. */ #define CHN_2NDBUFMAXSIZE (131072) -#define CHN_DEFAULT_HZ 50 - #define CHANNEL_DECLARE(name) static DEFINE_CLASS(name, name ## _methods, sizeof(struct kobj)) |