Date: Mon, 29 Oct 2001 11:29:38 -0500 (EST) From: "Alexander N. Kabaev" <ak03@gte.com> To: FreeBSD-gnats-submit@freebsd.org Subject: kern/31597: pcm_addchan incorrectly adds vchans to PCMDIR_REC channels Message-ID: <200110291629.f9TGTcK00687@h132-197-97-45.gte.com>
next in thread | raw e-mail | index | archive | help
>Number: 31597
>Category: kern
>Synopsis: pcm_addchan incorrectly adds vchans to PCMDIR_REC channels
>Confidential: no
>Severity: serious
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: sw-bug
>Submitter-Id: current-users
>Arrival-Date: Mon Oct 29 08:30:00 PST 2001
>Closed-Date:
>Last-Modified:
>Originator: Alexander N. Kabaev
>Release: FreeBSD 5.0-CURRENT i386
>Organization:
Verizon Data Services
>Environment:
System: FreeBSD kanpc.gte.com 5.0-CURRENT FreeBSD 5.0-CURRENT #0: Thu Oct 25 10:14:33 EDT 2001 root@kanpc.gte.com:/usr/src/sys/i386/compile/KANPC i386
ES1371-based audio card.
>Description:
pcm_addchans function in sys/dev/sound/pcm/sound.c incorrectly
adds virtual channels to each and every hardware channel, passed
to it as a parameter. If the hardware channel has the direction
set to PCMDIR_REC, this leads to the scenario, where PCMDIR_PLAY
virtual channel sits on top of PCMDIR_REC physical channel. Each
attempt to play through such a vistual channel leads to "interrupt"
timeout,channel dead" errors.
When hw.snd.maxautovchans=<num> is set through /boot/loader.conf,
virtual channels subsystem is enabled at the
>How-To-Repeat:
Set the hw.snd.maxautovchans=<num> in /boot/loader.conf. This way
virtual channels will be enabled at the sound card probe time and
virtual channel will be created for each hardware channel on the
card. Now, if driver calls pcm_addchan(..., PCMDIR_REC) before
pcm_addchan(..., PCMDIR_PLAY), the virtual channel sitting on
top of the record channel will be choosen at the next playback
attempt and playback will fail with the above interrupt timeout
message.
The problem can not be reproduced if hw.snd.maxautovchans is being
set through sysctl, because pcm_setmaxautovchan function is smart
enough to ignore record channels and it will only create single
vcannel on the first free hardware playback channel.
>Fix:
The following patch changes pcm_addchan function to only create
virtual channels if the parent channel is PCMDIR_PLAY and if
no virtual channels have been created already. This fixes pcm
playback on my -CURRENT boxes.
Index: sound.c
===================================================================
RCS file: /usr/ncvs/src/sys/dev/sound/pcm/sound.c,v
retrieving revision 1.66
diff -u -r1.66 sound.c
--- sound.c 18 Sep 2001 14:50:52 -0000 1.66
+++ sound.c 29 Oct 2001 15:40:53 -0000
@@ -503,7 +503,8 @@
return err;
}
- if (snd_maxautovchans > 0 && (d->flags & SD_F_AUTOVCHAN)) {
+ if (snd_maxautovchans > 0 && (d->flags & SD_F_AUTOVCHAN) &&
+ ch->direction == PCMDIR_PLAY && d->vchancount == 0) {
ch->flags |= CHN_F_BUSY;
err = vchan_create(ch);
if (err) {
>Release-Note:
>Audit-Trail:
>Unformatted:
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200110291629.f9TGTcK00687>
