NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: kern/39204
The following reply was made to PR kern/39204; it has been noted by GNATS.
From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
Subject: Re: kern/39204
Date: Tue, 15 May 2012 23:22:02 +1000
Hi.
I have been working on a better patch so I came up with this:
pad.c - same as version 2.
audiovar.c - same as version 2.
audio.c as follows:
===================================================================
RCS file: /cvsroot/src/sys/dev/audio.c,v
retrieving revision 1.261
diff -u -r1.261 audio.c
--- audio.c 30 Apr 2012 02:16:46 -0000 1.261
+++ audio.c 15 May 2012 13:22:46 -0000
@@ -401,6 +401,7 @@
cv_init(&sc->sc_rchan, "audiord");
cv_init(&sc->sc_wchan, "audiowr");
cv_init(&sc->sc_lchan, "audiolk");
+ cv_init(&sc->sc_dataready, "audiordy");
if (hwp == 0 || hwp->get_locks == 0) {
printf(": missing method\n");
@@ -760,6 +761,7 @@
cv_destroy(&sc->sc_rchan);
cv_destroy(&sc->sc_wchan);
cv_destroy(&sc->sc_lchan);
+ cv_destroy(&sc->sc_dataready);
return 0;
}
@@ -1780,6 +1782,7 @@
KASSERT(mutex_owned(sc->sc_lock));
KASSERT(mutex_owned(sc->sc_intr_lock));
+ cv_broadcast(&sc->sc_dataready);
DPRINTF(("audio_drain: enter busy=%d\n", sc->sc_pbus));
cb = &sc->sc_pr;
if (cb->mmapped)
@@ -1824,6 +1827,7 @@
audio_stream_get_used(&sc->sc_pr.s), cb->drops));
mutex_exit(sc->sc_intr_lock);
error = audio_waitio(sc, &sc->sc_wchan);
+ cv_broadcast(&sc->sc_dataready);
mutex_enter(sc->sc_intr_lock);
if (sc->sc_dying)
error = EIO;
@@ -2001,6 +2005,7 @@
}
if (sc->sc_pbus) {
cv_broadcast(&sc->sc_wchan);
+ cv_broadcast(&sc->sc_dataready);
sc->hw_if->halt_output(sc->hw_hdl);
sc->sc_pbus = false;
sc->sc_pr.pause = false;
@@ -2298,6 +2303,7 @@
cc = stream.end - stream.start;
error = fetcher->fetch_to(sc, fetcher, &stream, cc);
}
+
mutex_enter(sc->sc_intr_lock);
if (sc->sc_npfilters > 0) {
cb->fstamp += ufetcher.last_used
@@ -2343,6 +2349,7 @@
}
mutex_exit(sc->sc_intr_lock);
+ cv_broadcast(&sc->sc_dataready);
return error;
}
@@ -2783,7 +2790,7 @@
KASSERT(mutex_owned(sc->sc_lock));
KASSERT(mutex_owned(sc->sc_intr_lock));
- used = audio_stream_get_used(&sc->sc_pr.s);
+ used = audio_stream_get_used(sc->sc_pustream);
DPRINTF(("audiostartp: start=%p used=%d(hi=%d blk=%d) mmapped=%d\n",
sc->sc_pr.s.start, used, sc->sc_pr.usedhigh,
sc->sc_pr.blksize, sc->sc_pr.mmapped));
@@ -3042,8 +3049,15 @@
sc->sc_mode, cb->pause,
audio_stream_get_used(sc->sc_pustream), cb->usedlow));
if ((sc->sc_mode & AUMODE_PLAY) && !cb->pause) {
- if (audio_stream_get_used(sc->sc_pustream) <= cb->usedlow)
+ if ((used = audio_stream_get_used(sc->sc_pustream)) <=
cb->usedlow) {
softint_schedule(sc->sc_sih_wr);
+
+ if (used < blksize && device_is_a(sc->sc_dev, "pad"))
{
+ mutex_exit(sc->sc_intr_lock);
+ cv_wait_sig(&sc->sc_dataready, sc->sc_lock);
+ mutex_enter(sc->sc_intr_lock);
+ }
+ }
}
/* Possible to return one or more "phantom blocks" now. */
I hope this helps.
Regards,
Nat.
Home |
Main Index |
Thread Index |
Old Index