Module Name:    src
Committed By:   nat
Date:           Mon May 15 01:03:47 UTC 2017

Modified Files:
        src/sys/dev: audio.c

Log Message:
Don't hold sc_lock whilst calling mix_write/read.  This makes uaudio work
again.

With regard to uaudio however tyr-quake's audio does not work well.


To generate a diff of this commit:
cvs rdiff -u -r1.346 -r1.347 src/sys/dev/audio.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/audio.c
diff -u src/sys/dev/audio.c:1.346 src/sys/dev/audio.c:1.347
--- src/sys/dev/audio.c:1.346	Sun May 14 10:57:32 2017
+++ src/sys/dev/audio.c	Mon May 15 01:03:47 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: audio.c,v 1.346 2017/05/14 10:57:32 nat Exp $	*/
+/*	$NetBSD: audio.c,v 1.347 2017/05/15 01:03:47 nat Exp $	*/
 
 /*-
  * Copyright (c) 2016 Nathanial Sloss <nathanialsl...@yahoo.com.au>
@@ -148,7 +148,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.346 2017/05/14 10:57:32 nat Exp $");
+__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.347 2017/05/15 01:03:47 nat Exp $");
 
 #include "audio.h"
 #if NAUDIO > 0
@@ -3485,10 +3485,12 @@ audiostartr(struct audio_softc *sc, stru
 		return EINVAL;
 
 	if (sc->sc_rec_started == false) {
+		mutex_exit(sc->sc_lock);
 		mutex_enter(sc->sc_intr_lock);
 		mix_read(sc);
 		cv_broadcast(&sc->sc_rcondvar);
 		mutex_exit(sc->sc_intr_lock);
+		mutex_enter(sc->sc_lock);
 	}
 	vc->sc_rbus = true;
 
@@ -3523,6 +3525,7 @@ audiostartp(struct audio_softc *sc, stru
 	if (sc->sc_trigger_started == false) {
 		audio_mix(sc);
 		audio_mix(sc);
+		mutex_exit(sc->sc_lock);
 		mutex_enter(sc->sc_intr_lock);
 		mix_write(sc);
 		vc = chan->vc;
@@ -3532,6 +3535,7 @@ audiostartp(struct audio_softc *sc, stru
 		mix_write(sc);
 		cv_broadcast(&sc->sc_condvar);
 		mutex_exit(sc->sc_intr_lock);
+		mutex_enter(sc->sc_lock);
 	}
 
 	return error;

Reply via email to