On Thu, Dec 11, 2003 at 12:12:01PM +0200, juha.nygard1_at_netikka.fi wrote: > Upgrading from 5.1 to 5.2-BETA has introduced a startup lag when starting > to play something through /dev/dsp. It takes about two seconds from pressing play > button in xmms to hearing the sound. I don't really know if this is a bug > or a feature but still it is quite annoying. I've seen this on one of my machines too (also bursts of static when seeking in mplayer). Can you try backing out r1.89 of sys/dev/sound/pcm/channel.c? I've not been able to find time to test this hypothesis myself. Kris Index: channel.c =================================================================== RCS file: /mnt2/ncvs/src/sys/dev/sound/pcm/channel.c,v retrieving revision 1.89 retrieving revision 1.88 diff -u -u -r1.89 -r1.88 --- channel.c 18 Aug 2003 23:18:47 -0000 1.89 +++ channel.c 26 Feb 2003 14:38:19 -0000 1.88 _at__at_ -508,19 +508,7 _at__at_ struct snd_dbuf *bs = c->bufsoft; CHN_LOCKASSERT(c); - - /* if we haven't yet started and nothing is buffered, else start*/ - if (!(c->flags & CHN_F_TRIGGERED)) { - if (sndbuf_getready(bs) > 0) { - ret = chn_start(c, 1); - if (ret) - return ret; - } else { - return 0; - } - } - - for (;;) { + for (;;) { rdy = (c->direction == PCMDIR_PLAY)? sndbuf_getfree(bs) : sndbuf_getready(bs); if (rdy <= threshold) { ret = chn_sleep(c, "pcmsyn", 1); _at__at_ -584,13 +572,10 _at__at_ /* * this routine tries to flush the dma transfer. It is called - * on a close of a playback channel. - * first, if there is data in the buffer, but the dma has not yet - * begun, we need to start it. - * next, we wait for the play buffer to drain - * finally, we stop the dma. + * on a close. We immediately abort any read DMA + * operation, and then wait for the play buffer to drain. * - * called from: dsp_close, not valid for record channels. + * called from: dsp_close */ int _at__at_ -601,19 +586,10 _at__at_ struct snd_dbuf *bs = c->bufsoft; CHN_LOCKASSERT(c); - KASSERT(c->direction == PCMDIR_PLAY, ("chn_flush on bad channel")); - DEB(printf("chn_flush: c->flags 0x%08x\n", c->flags)); - - /* if we haven't yet started and nothing is buffered, else start*/ - if (!(c->flags & CHN_F_TRIGGERED)) { - if (sndbuf_getready(bs) > 0) { - ret = chn_start(c, 1); - if (ret) - return ret; - } else { - return 0; - } - } + KASSERT(c->direction == PCMDIR_PLAY, ("chn_wrupdate on bad channel")); + DEB(printf("chn_flush c->flags 0x%08x\n", c->flags)); + if (!(c->flags & CHN_F_TRIGGERED)) + return 0; c->flags |= CHN_F_CLOSING; resid = sndbuf_getready(bs) + sndbuf_getready(b); _at__at_ -627,16 +603,13 _at__at_ ret = 0; if (ret == 0) { resid = sndbuf_getready(bs) + sndbuf_getready(b); - if (resid == resid_p) + if (resid >= resid_p) count--; - if (resid > resid_p) - DEB(printf("chn_flush: buffer length increasind %d -> %d\n", resid_p, resid)); resid_p = resid; } } if (count == 0) - DEB(printf("chn_flush: timeout, hw %d, sw %d\n", - sndbuf_getready(b), sndbuf_getready(bs))); + DEB(printf("chn_flush: timeout\n")); c->flags &= ~CHN_F_TRIGGERED; /* kill the channel */ _at__at_ -803,7 +776,7 _at__at_ chn_setvolume(struct pcm_channel *c, int left, int right) { CHN_LOCKASSERT(c); - /* should add a feeder for volume changing if channel returns -1 */ + /* could add a feeder for volume changing if channel returns -1 */ c->volume = (left << 8) | right; return 0; } _at__at_ -1102,7 +1075,7 _at__at_ } flags = c->feederflags; - DEB(printf("feederflags %x\n", flags)); + DEB(printf("not mapped, feederflags %x\n", flags)); for (type = FEEDER_RATE; type <= FEEDER_LAST; type++) { if (flags & (1 << type)) { _at__at_ -1120,7 +1093,7 _at__at_ } if (c->feeder->desc->out != fc->desc->in) { - DEB(printf("build fmtchain from 0x%x to 0x%x: ", c->feeder->desc->out, fc->desc->in)); + DEB(printf("build fmtchain from %x to %x: ", c->feeder->desc->out, fc->desc->in)); tmp[0] = fc->desc->in; tmp[1] = 0; if (chn_fmtchain(c, tmp) == 0) { _at__at_ -1133,11 +1106,11 _at__at_ err = chn_addfeeder(c, fc, fc->desc); if (err) { - DEB(printf("can't add feeder %p, output 0x%x, err %d\n", fc, fc->desc->out, err)); + DEB(printf("can't add feeder %p, output %x, err %d\n", fc, fc->desc->out, err)); return err; } - DEB(printf("added feeder %p, output 0x%x\n", fc, c->feeder->desc->out)); + DEB(printf("added feeder %p, output %x\n", fc, c->feeder->desc->out)); } } _at__at_ -1153,7 +1126,7 _at__at_ u_int32_t *x = chn_getcaps(c)->fmtlist; printf("acceptable formats for %s:\n", c->name); while (*x) { - printf("[0x%8x] ", *x); + printf("[%8x] ", *x); x++; } #endif
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:33 UTC