Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 15 Sep 2004 15:40:00 +0300
From:      Erik Udo <erik.u@dnainternet.net>
To:        freebsd-current@freebsd.org
Subject:   Laggy audio and patch that fixes it at the cost of gnome
Message-ID:  <41483820.1070503@dnainternet.net>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------000706070405030702070302
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

In the latest RELENG_5_2:

I added the following patch, with success. It worked just fine in kde, 
but when i installed gnome and i was loading it(i got the "loading 
gnome.." splashscreen) and then i got page fault.

So if anyone could tell me how i can keep that patch and still be able 
to use gnome? And what about 5.3? I hope it doesnt have that audio lag 
feature when i go back or forward in mplayer or xmms or any other app.

--------------000706070405030702070302
Content-Type: text/plain;
 name="dsp.1.67-1.70.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="dsp.1.67-1.70.patch"

--- /sys/dev/sound/pcm/dsp.c.orig	Tue Nov 11 11:38:28 2003
+++ /sys/dev/sound/pcm/dsp.c	Wed Jan 21 11:51:31 2004
@@ -29,7 +29,7 @@
 
 #include <dev/sound/pcm/sound.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/dsp.c,v 1.67 2003/11/11 05:38:28 scottl Exp $");
+SND_DECLARE_FILE("$FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/dsp.c,v 1.70 2004/01/20 05:30:09 matk Exp $");
 
 #define OLDPCM_IOCTL
 
@@ -41,7 +41,7 @@
 static d_poll_t dsp_poll;
 static d_mmap_t dsp_mmap;
 
-static struct cdevsw dsp_cdevsw = {
+struct cdevsw dsp_cdevsw = {
 	.d_open =	dsp_open,
 	.d_close =	dsp_close,
 	.d_read =	dsp_read,
@@ -455,15 +455,11 @@
 	 * on dsp devices.
 	 */
 
-	if (IOCGROUP(cmd) == 'M') {
-		dev_t pdev;
-
-		pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(PCMUNIT(i_dev), SND_DEV_CTL, 0));
-		return mixer_ioctl(pdev, cmd, arg, mode, td);
-	}
+	d = dsp_get_info(i_dev);
+	if (IOCGROUP(cmd) == 'M')
+		return mixer_ioctl(d->mixer_dev, cmd, arg, mode, td);
 
     	s = spltty();
-	d = dsp_get_info(i_dev);
 	getchns(i_dev, &rdch, &wrch, 0);
 
 	kill = 0;
@@ -580,7 +576,7 @@
 			 	     (wrch? chn_getformats(wrch) : 0xffffffff);
 			if (rdch && wrch)
 				p->formats |= (dsp_get_flags(i_dev) & SD_F_SIMPLEX)? 0 : AFMT_FULLDUPLEX;
-			pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(PCMUNIT(i_dev), SND_DEV_CTL, 0));
+			pdev = d->mixer_dev;
 	    		p->mixers = 1; /* default: one mixer */
 	    		p->inputs = pdev->si_drv1? mix_getdevs(pdev->si_drv1) : 0;
 	    		p->left = p->right = 100;
@@ -664,10 +660,18 @@
 
     	case SNDCTL_DSP_RESET:
 		DEB(printf("dsp reset\n"));
-		if (wrch)
+		if (wrch) {
+			CHN_LOCK(wrch);
 			chn_abort(wrch);
-		if (rdch)
+			chn_resetbuf(wrch);
+			CHN_UNLOCK(wrch);
+		}
+		if (rdch) {
+			CHN_LOCK(rdch);
 			chn_abort(rdch);
+			chn_resetbuf(rdch);
+			CHN_UNLOCK(rdch);
+		}
 		break;
 
     	case SNDCTL_DSP_SYNC:
@@ -1048,60 +1052,23 @@
 	return 0;
 }
 
-int
-dsp_register(int unit, int channel)
-{
-	make_dev(&dsp_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP, channel),
-		 UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d", unit, channel);
-	make_dev(&dsp_cdevsw, PCMMKMINOR(unit, SND_DEV_DSP16, channel),
-		 UID_ROOT, GID_WHEEL, 0666, "dspW%d.%d", unit, channel);
-	make_dev(&dsp_cdevsw, PCMMKMINOR(unit, SND_DEV_AUDIO, channel),
-		 UID_ROOT, GID_WHEEL, 0666, "audio%d.%d", unit, channel);
-
-	return 0;
-}
-
-int
-dsp_registerrec(int unit, int channel)
-{
-	make_dev(&dsp_cdevsw, PCMMKMINOR(unit, SND_DEV_DSPREC, channel),
-		 UID_ROOT, GID_WHEEL, 0666, "dspr%d.%d", unit, channel);
-
-	return 0;
-}
-
-int
-dsp_unregister(int unit, int channel)
-{
-	dev_t pdev;
-
-	pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, SND_DEV_DSP, channel));
-	destroy_dev(pdev);
-	pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, SND_DEV_DSP16, channel));
-	destroy_dev(pdev);
-	pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, SND_DEV_AUDIO, channel));
-	destroy_dev(pdev);
-
-	return 0;
-}
-
-int
-dsp_unregisterrec(int unit, int channel)
-{
-	dev_t pdev;
-
-	pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, SND_DEV_DSPREC, channel));
-	destroy_dev(pdev);
-
-	return 0;
-}
-
 #ifdef USING_DEVFS
+
+/*
+ * Clone logic is this:
+ * x E X = {dsp, dspW, audio}
+ * x -> x${sysctl("hw.snd.unit")}
+ * xN->
+ *    for i N = 1 to channels of device N
+ *    	if xN.i isn't busy, return its dev_t
+ */
 static void
 dsp_clone(void *arg, char *name, int namelen, dev_t *dev)
 {
 	dev_t pdev;
-	int i, cont, unit, devtype;
+	struct snddev_info *pcm_dev;
+	struct snddev_channel *pcm_chan;
+	int i, unit, devtype;
 	int devtypes[3] = {SND_DEV_DSP, SND_DEV_DSP16, SND_DEV_AUDIO};
 	char *devnames[3] = {"dsp", "dspW", "audio"};
 
@@ -1124,16 +1091,27 @@
 	if (unit == -1 || unit >= devclass_get_maxunit(pcm_devclass))
 		return;
 
-	cont = 1;
-	for (i = 0; cont; i++) {
-		pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, devtype, i));
-		if (pdev->si_flags & SI_NAMED) {
-			if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
-				*dev = pdev;
-				return;
-			}
-		} else {
-			cont = 0;
+	pcm_dev = devclass_get_softc(pcm_devclass, unit);
+
+	SLIST_FOREACH(pcm_chan, &pcm_dev->channels, link) {
+
+		switch(devtype) {
+			case SND_DEV_DSP:
+				pdev = pcm_chan->dsp_devt;
+				break;
+			case SND_DEV_DSP16:
+				pdev = pcm_chan->dspW_devt;
+				break;
+			case SND_DEV_AUDIO:
+				pdev = pcm_chan->audio_devt;
+				break;
+			default:
+				panic("Unknown devtype %d", devtype);
+		}
+
+		if ((pdev->si_drv1 == NULL) && (pdev->si_drv2 == NULL)) {
+			*dev = pdev;
+			return;
 		}
 	}
 }
--- /sys/dev/sound/pcm/dsp.h.orig	Sun Sep  7 23:28:03 2003
+++ /sys/dev/sound/pcm/dsp.h	Wed Jan 21 12:00:40 2004
@@ -23,10 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/sound/pcm/dsp.h,v 1.7 2003/09/07 16:28:03 cg Exp $
+ * $FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/dsp.h,v 1.8 2004/01/20 03:58:57 matk Exp $
  */
 
-int dsp_register(int unit, int channel);
-int dsp_registerrec(int unit, int channel);
-int dsp_unregister(int unit, int channel);
-int dsp_unregisterrec(int unit, int channel);
+extern struct cdevsw dsp_cdevsw;
--- /sys/dev/sound/pcm/sound.h.orig	Sun Sep  7 23:28:03 2003
+++ /sys/dev/sound/pcm/sound.h	Wed Jan 21 12:06:35 2004
@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/dev/sound/pcm/sound.h,v 1.52 2003/09/07 16:28:03 cg Exp $
+ * $FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/sound.h,v 1.54 2004/01/20 03:58:57 matk Exp $
  */
 
 /*
@@ -98,7 +98,6 @@
 #include <dev/sound/pcm/channel.h>
 #include <dev/sound/pcm/feeder.h>
 #include <dev/sound/pcm/mixer.h>
-#include <dev/sound/pcm/dsp.h>
 
 #define	PCM_SOFTC_SIZE	512
 
@@ -222,8 +221,8 @@
 
 struct pcm_channel *pcm_chn_create(struct snddev_info *d, struct pcm_channel *parent, kobj_class_t cls, int dir, void *devinfo);
 int pcm_chn_destroy(struct pcm_channel *ch);
-int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev);
-int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch, int rmdev);
+int pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch);
+int pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch);
 
 int pcm_addchan(device_t dev, int dir, kobj_class_t cls, void *devinfo);
 unsigned int pcm_getbuffersize(device_t dev, unsigned int min, unsigned int deflt, unsigned int max);
@@ -234,6 +233,7 @@
 void pcm_setflags(device_t dev, u_int32_t val);
 void *pcm_getdevinfo(device_t dev);
 
+
 int snd_setup_intr(device_t dev, struct resource *res, int flags,
 		   driver_intr_t hand, void *param, void **cookiep);
 
@@ -276,12 +276,17 @@
 /*
  * this is rather kludgey- we need to duplicate these struct def'ns from sound.c
  * so that the macro versions of pcm_{,un}lock can dereference them.
+ * we also have to do this now makedev() has gone away.
  */
 
-#ifdef	PCM_DEBUG_MTX
 struct snddev_channel {
 	SLIST_ENTRY(snddev_channel) link;
 	struct pcm_channel *channel;
+	int chan_num;
+	dev_t dsp_devt;
+	dev_t dspW_devt;
+	dev_t audio_devt;
+	dev_t dspr_devt;
 };
 
 struct snddev_info {
@@ -297,8 +302,11 @@
 	struct sysctl_ctx_list sysctl_tree;
 	struct sysctl_oid *sysctl_tree_top;
 	struct mtx *lock;
+	dev_t mixer_dev;
+
 };
 
+#ifdef	PCM_DEBUG_MTX
 #define	pcm_lock(d) mtx_lock(((struct snddev_info *)(d))->lock)
 #define	pcm_unlock(d) mtx_unlock(((struct snddev_info *)(d))->lock)
 #else
--- /sys/dev/sound/pcm/sound.c.orig	Sun Sep  7 23:28:03 2003
+++ /sys/dev/sound/pcm/sound.c	Wed Jan 21 12:05:25 2004
@@ -27,33 +27,12 @@
 
 #include <dev/sound/pcm/sound.h>
 #include <dev/sound/pcm/vchan.h>
+#include <dev/sound/pcm/dsp.h>
 #include <sys/sysctl.h>
 
 #include "feeder_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/sound.c,v 1.85 2003/09/07 16:28:03 cg Exp $");
-
-#ifndef	PCM_DEBUG_MTX
-struct snddev_channel {
-	SLIST_ENTRY(snddev_channel) link;
-	struct pcm_channel *channel;
-};
-
-struct snddev_info {
-	SLIST_HEAD(, snddev_channel) channels;
-	struct pcm_channel *fakechan;
-	unsigned devcount, playcount, reccount, vchancount;
-	unsigned flags;
-	int inprog;
-	unsigned int bufsz;
-	void *devinfo;
-	device_t dev;
-	char status[SND_STATUSLEN];
-	struct sysctl_ctx_list sysctl_tree;
-	struct sysctl_oid *sysctl_tree_top;
-	struct mtx *lock;
-};
-#endif
+SND_DECLARE_FILE("$FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/sound.c,v 1.88 2004/01/20 03:58:57 matk Exp $");
 
 devclass_t pcm_devclass;
 
@@ -96,7 +75,7 @@
 	m = malloc(sizeof(*m), M_DEVBUF, M_WAITOK | M_ZERO);
 	if (m == NULL)
 		return NULL;
-	mtx_init(m, desc, type, MTX_RECURSE);
+	mtx_init(m, desc, type, MTX_DEF | MTX_RECURSE);
 	return m;
 #else
 	return (void *)0xcafebabe;
@@ -435,11 +414,20 @@
 }
 
 int
-pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch, int mkdev)
+pcm_chn_add(struct snddev_info *d, struct pcm_channel *ch)
 {
     	struct snddev_channel *sce, *tmp, *after;
-    	int unit = device_get_unit(d->dev);
-	int x = -1;
+    	int device = device_get_unit(d->dev);
+
+	/*
+	 * Note it's confusing nomenclature.
+	 * dev_t
+	 * device -> pcm_device
+         * unit -> pcm_channel
+	 * channel -> snddev_channel
+	 * device_t
+	 * unit -> pcm_device
+	 */
 
 	sce = malloc(sizeof(*sce), M_DEVBUF, M_WAITOK | M_ZERO);
 	if (!sce) {
@@ -448,6 +436,7 @@
 
 	snd_mtxlock(d->lock);
 	sce->channel = ch;
+	sce->chan_num= d->devcount++;
 	if (SLIST_EMPTY(&d->channels)) {
 		SLIST_INSERT_HEAD(&d->channels, sce, link);
 	} else {
@@ -457,24 +446,36 @@
 		}
 		SLIST_INSERT_AFTER(after, sce, link);
 	}
-	if (mkdev)
-		x = d->devcount++;
 	snd_mtxunlock(d->lock);
-
-	if (mkdev) {
-		dsp_register(unit, x);
-		if (ch->direction == PCMDIR_REC)
-			dsp_registerrec(unit, ch->num);
-	}
+	sce->dsp_devt= make_dev(&dsp_cdevsw,
+			PCMMKMINOR(device, SND_DEV_DSP, sce->chan_num),
+			UID_ROOT, GID_WHEEL, 0666, "dsp%d.%d",
+			device, sce->chan_num);
+
+	sce->dspW_devt= make_dev(&dsp_cdevsw,
+			PCMMKMINOR(device, SND_DEV_DSP16, sce->chan_num),
+			UID_ROOT, GID_WHEEL, 0666, "dspW%d.%d",
+			device, sce->chan_num);
+
+	sce->audio_devt= make_dev(&dsp_cdevsw,
+			PCMMKMINOR(device, SND_DEV_AUDIO, sce->chan_num),
+			UID_ROOT, GID_WHEEL, 0666, "audio%d.%d",
+			device, sce->chan_num);
+
+	if (ch->direction == PCMDIR_REC)
+		sce->dspr_devt = make_dev(&dsp_cdevsw,
+				PCMMKMINOR(device, SND_DEV_DSPREC,
+					sce->chan_num), UID_ROOT, GID_WHEEL,
+				0666, "dspr%d.%d", device, sce->chan_num);
 
 	return 0;
 }
 
 int
-pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch, int rmdev)
+pcm_chn_remove(struct snddev_info *d, struct pcm_channel *ch)
 {
     	struct snddev_channel *sce;
-    	int unit = device_get_unit(d->dev);
+#if 0
 	int ourlock;
 
 	ourlock = 0;
@@ -482,21 +483,19 @@
 		snd_mtxlock(d->lock);
 		ourlock = 1;
 	}
+#endif
 
 	SLIST_FOREACH(sce, &d->channels, link) {
 		if (sce->channel == ch)
 			goto gotit;
 	}
+#if 0
 	if (ourlock)
 		snd_mtxunlock(d->lock);
+#endif
 	return EINVAL;
 gotit:
 	SLIST_REMOVE(&d->channels, sce, snddev_channel, link);
-	if (rmdev) {
-		dsp_unregister(unit, --d->devcount);
-		if (ch->direction == PCMDIR_REC)
-			dsp_unregisterrec(unit, ch->num);
-	}
 
     	if (ch->direction == PCMDIR_REC)
 		d->reccount--;
@@ -505,8 +504,10 @@
 	else
 		d->playcount--;
 
+#if 0
 	if (ourlock)
 		snd_mtxunlock(d->lock);
+#endif
 	free(sce, M_DEVBUF);
 
 	return 0;
@@ -525,7 +526,7 @@
 		return ENODEV;
 	}
 
-	err = pcm_chn_add(d, ch, 1);
+	err = pcm_chn_add(d, ch);
 	if (err) {
 		device_printf(d->dev, "pcm_chn_add(%s) failed, err=%d\n", ch->name, err);
 		snd_mtxunlock(d->lock);
@@ -554,12 +555,10 @@
 	struct pcm_channel *ch;
 	int error = 0;
 
-	snd_mtxlock(d->lock);
 	sce = SLIST_FIRST(&d->channels);
-	snd_mtxunlock(d->lock);
 	ch = sce->channel;
 
-	error = pcm_chn_remove(d, sce->channel, SLIST_EMPTY(&ch->children));
+	error = pcm_chn_remove(d, sce->channel);
 	if (error)
 		return (error);
 	return (pcm_chn_destroy(ch));
@@ -652,6 +651,9 @@
 	d->vchancount = 0;
 	d->inprog = 0;
 
+	SLIST_INIT(&d->channels);
+	SLIST_INIT(&d->channels);
+
 	if (((numplay == 0) || (numrec == 0)) && (numplay != numrec))
 		d->flags |= SD_F_SIMPLEX;
 
@@ -700,6 +702,8 @@
 		snd_mtxunlock(d->lock);
 		return EBUSY;
 	}
+
+
 	SLIST_FOREACH(sce, &d->channels, link) {
 		ch = sce->channel;
 		if (ch->refcount > 0) {
@@ -708,6 +712,15 @@
 			return EBUSY;
 		}
 	}
+
+	SLIST_FOREACH(sce, &d->channels, link) {
+		destroy_dev(sce->dsp_devt);
+		destroy_dev(sce->dspW_devt);
+		destroy_dev(sce->audio_devt);
+		if (sce->dspr_devt)
+			destroy_dev(sce->dspr_devt);
+	}
+
 	if (mixer_uninit(dev)) {
 		device_printf(dev, "unregister: mixer busy\n");
 		snd_mtxunlock(d->lock);
@@ -725,6 +738,7 @@
 	fkchan_kill(d->fakechan);
 
 	sndstat_unregister(dev);
+	snd_mtxunlock(d->lock);
 	snd_mtxfree(d->lock);
 	return 0;
 }
@@ -778,7 +792,7 @@
 			c = sce->channel;
 			sbuf_printf(s, "\n\t");
 
-			/* it would be bettet to indent child channels */
+			/* it would be better to indent child channels */
 			sbuf_printf(s, "%s[%s]: ", c->parentchannel? c->parentchannel->name : "", c->name);
 			sbuf_printf(s, "spd %d", c->speed);
 			if (c->speed != sndbuf_getspd(c->bufhard))
--- /sys/dev/sound/pcm/vchan.c.orig	Sun Sep  7 23:28:03 2003
+++ /sys/dev/sound/pcm/vchan.c	Wed Jan 21 12:07:12 2004
@@ -28,7 +28,7 @@
 #include <dev/sound/pcm/vchan.h>
 #include "feeder_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/vchan.c,v 1.13 2003/09/07 16:28:03 cg Exp $");
+SND_DECLARE_FILE("$FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/vchan.c,v 1.15 2004/01/20 03:58:57 matk Exp $");
 
 struct vchinfo {
 	u_int32_t spd, fmt, blksz, bps, run;
@@ -260,7 +260,10 @@
 	CHN_UNLOCK(parent);
 
 	/* add us to our grandparent's channel list */
-	err = pcm_chn_add(d, child, !first);
+	/*
+	 * XXX maybe we shouldn't always add the dev_t
+ 	 */
+	err = pcm_chn_add(d, child);
 	if (err) {
 		pcm_chn_destroy(child);
 		free(pce, M_DEVBUF);
@@ -312,8 +315,8 @@
 	if (last)
 		parent->flags &= ~CHN_F_BUSY;
 
-	/* remove us from our grantparent's channel list */
-	err = pcm_chn_remove(d, c, !last);
+	/* remove us from our grandparent's channel list */
+	err = pcm_chn_remove(d, c);
 	if (err)
 		return err;
 
--- /sys/dev/sound/pcm/mixer.c.orig	Tue Nov 11 11:38:28 2003
+++ /sys/dev/sound/pcm/mixer.c	Wed Jan 21 12:08:16 2004
@@ -28,7 +28,7 @@
 
 #include "mixer_if.h"
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/mixer.c,v 1.33 2003/11/11 05:38:28 scottl Exp $");
+SND_DECLARE_FILE("$FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/mixer.c,v 1.34 2004/01/17 10:37:11 phk Exp $");
 
 MALLOC_DEFINE(M_MIXER, "mixer", "mixer");
 
@@ -87,13 +87,11 @@
 static dev_t
 mixer_get_devt(device_t dev)
 {
-	dev_t pdev;
-	int unit;
+	struct snddev_info *snddev;
 
-	unit = device_get_unit(dev);
-	pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(unit, SND_DEV_CTL, 0));
+	snddev = device_get_softc(dev);
 
-	return pdev;
+	return snddev->mixer_dev;
 }
 
 #ifdef SND_DYNSYSCTL
@@ -187,6 +185,7 @@
 int
 mixer_init(device_t dev, kobj_class_t cls, void *devinfo)
 {
+	struct snddev_info *snddev;
 	struct snd_mixer *m;
 	u_int16_t v;
 	dev_t pdev;
@@ -213,6 +212,8 @@
 	pdev = make_dev(&mixer_cdevsw, PCMMKMINOR(unit, SND_DEV_CTL, 0),
 		 UID_ROOT, GID_WHEEL, 0666, "mixer%d", unit);
 	pdev->si_drv1 = m;
+	snddev = device_get_softc(dev);
+	snddev->mixer_dev = pdev;
 
 	return 0;
 
@@ -478,14 +479,14 @@
 static void
 mixer_clone(void *arg, char *name, int namelen, dev_t *dev)
 {
-	dev_t pdev;
+	struct snddev_info *sd;
 
 	if (*dev != NODEV)
 		return;
 	if (strcmp(name, "mixer") == 0) {
-		pdev = makedev(SND_CDEV_MAJOR, PCMMKMINOR(snd_unit, SND_DEV_CTL, 0));
-		if (pdev->si_flags & SI_NAMED)
-			*dev = pdev;
+		sd = devclass_get_softc(pcm_devclass, snd_unit);
+		if (sd != NULL)
+			*dev = sd->mixer_dev;
 	}
 }
 
--- /sys/dev/sound/pcm/sndstat.c.orig	Sun Sep  7 23:28:03 2003
+++ /sys/dev/sound/pcm/sndstat.c	Wed Jan 21 12:09:17 2004
@@ -27,7 +27,7 @@
 #include <dev/sound/pcm/sound.h>
 #include <dev/sound/pcm/vchan.h>
 
-SND_DECLARE_FILE("$FreeBSD: src/sys/dev/sound/pcm/sndstat.c,v 1.14 2003/09/07 16:28:03 cg Exp $");
+SND_DECLARE_FILE("$FreeBSD: /repoman/r/ncvs/src/sys/dev/sound/pcm/sndstat.c,v 1.15 2003/12/08 01:08:03 truckman Exp $");
 
 #define	SS_TYPE_MODULE		0
 #define	SS_TYPE_FIRST		1
@@ -340,7 +340,7 @@
 static int
 sndstat_init(void)
 {
-	mtx_init(&sndstat_lock, "sndstat", NULL, 0);
+	mtx_init(&sndstat_lock, "sndstat", NULL, MTX_DEF);
 	sndstat_dev = make_dev(&sndstat_cdevsw, SND_DEV_STATUS, UID_ROOT, GID_WHEEL, 0444, "sndstat");
 
 	return (sndstat_dev != 0)? 0 : ENXIO;

--------------000706070405030702070302
Content-Type: text/plain;
 name="output.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="output.txt"

GNU gdb 5.2.1 (FreeBSD)
Copyright 2002 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-unknown-freebsd"...
panic: page fault
panic messages:
---
Fatal trap 12: page fault while in kernel mode
fault virtual address	= 0x0
fault code		= supervisor read, page not present
instruction pointer	= 0x8:0xc04a4756
stack pointer	        = 0x10:0xdcc4ea18
frame pointer	        = 0x10:0xdcc4ea58
code segment		= base 0x0, limit 0xfffff, type 0x1b
			= DPL 0, pres 1, def32 1, gran 1
processor eflags	= interrupt enabled, resume, IOPL = 0
current process		= 638 (gnome-settings-daem)
trap number		= 12
panic: page fault

syncing disks, buffers remaining... 2299 2299 2299 2299 2299 2299 2299 2299 2299 2299 2299 2299 2299 2299 2299 ad0: WARNING - WRITE_DMA interrupt was seen but timeout fired LBA=34232255
2299 2299 2299 2299 2299 
giving up on 1691 buffers
Uptime: 1m22s
ad0: WARNING - WRITE_DMA interrupt was seen but timeout fired LBA=34232255
Dumping 511 MB
 16 32[CTRL-C to abort] [CTRL-C to abort] [CTRL-C to abort] [CTRL-C to abort] [CTRL-C to abort] [CTRL-C to abort]  48[CTRL-C to abort] [CTRL-C to abort] [CTRL-C to abort]  64 80 96 112 128 144 160 176 192 208 224 240 256 272 288 304 320 336 352 368 384 400 416 432 448 464 480 496
---
Reading symbols from /usr/src/sys/i386/compile/bsdkernel/modules/usr/src/sys/modules/linux/linux.ko.debug...done.
Loaded symbols for /usr/src/sys/i386/compile/bsdkernel/modules/usr/src/sys/modules/linux/linux.ko.debug
Reading symbols from /usr/src/sys/i386/compile/bsdkernel/modules/usr/src/sys/modules/acpi/acpi.ko.debug...done.
Loaded symbols for /usr/src/sys/i386/compile/bsdkernel/modules/usr/src/sys/modules/acpi/acpi.ko.debug
Reading symbols from /usr/src/sys/i386/compile/bsdkernel/modules/usr/src/sys/modules/linprocfs/linprocfs.ko.debug...done.
Loaded symbols for /usr/src/sys/i386/compile/bsdkernel/modules/usr/src/sys/modules/linprocfs/linprocfs.ko.debug
#0  doadump () at ../../../kern/kern_shutdown.c:240
240		dumping++;
(kgdb) quit

--------------000706070405030702070302--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?41483820.1070503>