Bug 31597

Summary: pcm_addchan incorrectly adds vchans to PCMDIR_REC channels
Product: Base System Reporter: ak03 <ak03>
Component: kernAssignee: Alexander Kabaev <kan>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 5.0-CURRENT   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description ak03 2001-10-29 16:30:00 UTC
	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

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.
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.
Comment 1 Alexander Kabaev freebsd_committer freebsd_triage 2002-07-23 15:51:09 UTC
State Changed
From-To: open->closed

Maintainer timeout. Patch committed. 



Comment 2 Alexander Kabaev freebsd_committer freebsd_triage 2002-07-23 15:51:09 UTC
Responsible Changed
From-To: freebsd-bugs->kan

Assign my PR to myself.