5.2-RELEASE TODO

Munish Chopra chopra at soulwax.net
Tue Dec 16 09:27:22 PST 2003


On 2003-12-16 11:22 +0000, Peter Schultz wrote:
> Mathew Kanner wrote:
> >On Dec 15, Munish Chopra wrote:
> >>
> >>They haven't been corrected in my case, or the cases of quite a few
> >>other folks experiencing them (see some of the other ongoing threads).
> >>
> 
> I stand corrected.  I thought I was being abusive enough, but if I make 
> my SCSI hard disk (I don't think this is limited to ATA disk activity) 
> really busy there is still slight glitching.  It appears as though 
> sync'ing the disk is what causes the trouble.
> 
> >>I'm not personally seeing any LOR's, but audio playback slows down under
> >>load, and every few seconds I hear popping noises during audio playback,
> >>whether under load or not.
> >>
> >>I've got a simple SB16:
> >>pcm0: <Creative CT5880-C> port 0xd800-0xd83f irq 5 at device 15.0 on
> >>pci0
> >>pcm0: <TriTech TR28602 AC97 Codec>
> >
> >
> >	Hello Munish,
> >	I would realy like to help you and others.  Please describe in
> >detail the circumstances that create the problem.  Are you
> >experiencing buffer overruns or underruns?  How many devices are
> >sharing the IRQ? What are they?  What happens when you cat a raw file
> >to the device?  Does this happen with VCHANs?  Have you tried the patch
> >I posted to -current under the heading "sound patch for pop &
> >crackles"?
> 
> I would like to try your patch, but hunk #3 fails on -CURRENT:

[...]

I've attached the updated patch I sent Mathew yesterday.

-- 
Munish Chopra
-------------- next part --------------
--- channel.c.old	Mon Dec 15 15:43:09 2003
+++ channel.c	Mon Dec 15 18:26:56 2003
@@ -41,6 +41,10 @@
 #define DEB(x) x
 */
 
+static int chn_fragsps = 0;
+SYSCTL_INT(_hw_snd, OID_AUTO, fragsps, CTLFLAG_RW,
+		   &chn_fragsps, 1, "max fragments per second, 0 to disable");
+
 static int chn_targetirqrate = 32;
 TUNABLE_INT("hw.snd.targetirqrate", &chn_targetirqrate);
 
@@ -59,7 +63,7 @@
 	return err;
 }
 SYSCTL_PROC(_hw_snd, OID_AUTO, targetirqrate, CTLTYPE_INT | CTLFLAG_RW,
-	0, sizeof(int), sysctl_hw_snd_targetirqrate, "I", "");
+	0, sizeof(int), sysctl_hw_snd_targetirqrate, "I", "default fragment tar");
 static int report_soft_formats = 1;
 SYSCTL_INT(_hw_snd, OID_AUTO, report_soft_formats, CTLFLAG_RW,
 	&report_soft_formats, 1, "report software-emulated formats");
@@ -115,11 +119,18 @@
 static void
 chn_wakeup(struct pcm_channel *c)
 {
-    	struct snd_dbuf *bs = c->bufsoft;
-
-	CHN_LOCKASSERT(c);
-	if (SEL_WAITING(sndbuf_getsel(bs)) && chn_polltrigger(c))
-		selwakeuppri(sndbuf_getsel(bs), PRIBIO);
+  	struct snd_dbuf *bs = c->bufsoft;
+   	struct pcmchan_children *pce;
+		
+  	// CHN_LOCKASSERT(c);
+	if (SLIST_EMPTY(&c->children)) {
+	  if (SEL_WAITING(sndbuf_getsel(bs)) && chn_polltrigger(c))
+		selwakeup(sndbuf_getsel(bs));
+	} else {
+	  SLIST_FOREACH(pce, &c->children, link) {
+		chn_wakeup(pce->channel);
+	  }
+	}
 	wakeup(bs);
 }
 
@@ -971,7 +982,7 @@
 {
 	struct snd_dbuf *b = c->bufhard;
 	struct snd_dbuf *bs = c->bufsoft;
-	int bufsz, irqhz, tmp, ret;
+	int irqhz, tmp, ret;
 
 	CHN_LOCKASSERT(c);
 	if (!CANCHANGE(c) || (c->flags & CHN_F_MAPPED))
@@ -1000,14 +1011,23 @@
 			DEB(printf("%s: updating (%d, %d)\n", __func__, blkcnt, blksz));
 		}
 	} else {
+	  if ( chn_fragsps != 0 &&
+		   sndbuf_getbps(bs) * sndbuf_getspd(bs) / blksz > chn_fragsps)
+		{
+		  blksz = sndbuf_getbps(bs) * sndbuf_getspd(bs) / chn_fragsps;
+		  tmp = 32;
+		  while (tmp < blksz)
+			tmp <<= 1;
+		  blksz = tmp;
+		  if (blksz * blkcnt > CHN_2NDBUFMAXSIZE)
+			blkcnt = CHN_2NDBUFMAXSIZE / blksz;
+		}
 		ret = EINVAL;
 		if ((blksz < 16) || (blkcnt < 2) || (blkcnt * blksz > CHN_2NDBUFMAXSIZE))
 			goto out;
 		ret = 0;
 		c->flags |= CHN_F_HAS_SIZE;
 	}
-
-	bufsz = blkcnt * blksz;
 
 	ret = sndbuf_remalloc(bs, blkcnt, blksz);
 	if (ret)


More information about the freebsd-current mailing list