Subject: kern/3380: Odd time's audio play fails with recent kernel
To: None <gnats-bugs@gnats.netbsd.org>
From: None <enami@ba2.so-net.or.jp>
List: netbsd-bugs
Date: 03/22/1997 13:50:21
>Number:         3380
>Category:       kern
>Synopsis:       Odd time's audio play fails with recent kernel
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Mar 21 22:20:03 1997
>Last-Modified:
>Originator:     enami tsugutomo
>Organization:
	an individual
>Release:        NetBSD-current 1997 Mar. 20
>Environment:
System: NetBSD plants-doll.enami.ba2.so-net.or.jp 1.2D NetBSD 1.2D (PLANTS_DOLL) #260: Sat Mar 22 09:32:37 JST 1997 enami@plants-doll.enami.ba2.so-net.or.jp:/usr/src/sys/arch/i386/compile/PLANTS_DOLL i386

The hardware is DEC HighNote UltraII, which has sound blaster
compatible sound chip (as far as catalog says).  It is recognized by
kernel as follows:

Mar 22 12:08:13 plants-doll /netbsd: sb0 at isa0 port 0x220-0x237 irq 5 drq 1: dsp v3.01

I remember that with a kernel about a week ago, the problem didn't exist.

>Description:

	Odd time's (i.e.; first, third, fifth, ...) audio play fails
	with recent kernel.  It repeats just first part of given sound
	instead of playing entire sound.  But even time's (second,
	forth, ..) play succeeds.

	With enabling AUDIO_DEBUG and setting audiodebug and sbdebug
	to 2, I got following message in /var/log/message:

Mar 22 12:08:40 plants-doll /netbsd: audio_open: dev=0x2a80 flags=0x402 sc=0xf8736a00 hdl=0xf8736b00
Mar 22 12:08:40 plants-doll /netbsd: sbdsp_open: sc=0xf8736b00
Mar 22 12:08:40 plants-doll /netbsd: sbdsp_open: opened
Mar 22 12:08:40 plants-doll /netbsd: audio_open: rr.bp=f874f000-f874ffa0 pr.bp=f8750000-f8750fa0
Mar 22 12:08:40 plants-doll /netbsd: audiostartp: hp=0xf8750000 nblk=0
Mar 22 12:08:40 plants-doll /netbsd: audio_write: cc=65536 hiwat=25
Mar 22 12:08:40 plants-doll /netbsd: audio_write: cc=65536 tp=0xf8750000 bs=160 nblk=0 left=4000
Mar 22 12:08:40 plants-doll /netbsd: audiostartp: hp=0xf8750000 nblk=1
Mar 22 12:08:40 plants-doll /netbsd: sbdsp_dma_output: cc=160 0xf810d2cc (0xf8736a00)
Mar 22 12:08:40 plants-doll /netbsd: sbdsp_set_timeconst: sc=0xf8736b00 tc=131
Mar 22 12:08:41 plants-doll /netbsd: audio_write: cc=65376 tp=0xf87500a0 bs=160 nblk=1 left=3840
Mar 22 12:08:41 plants-doll /netbsd: audio_write: cc=65216 tp=0xf8750140 bs=160 nblk=2 left=3680
					# similar lines (nblk 3 to 23) deleted
Mar 22 12:08:42 plants-doll /netbsd: audio_write: cc=61696 tp=0xf8750f00 bs=160 nblk=24 left=160
Mar 22 12:08:42 plants-doll /netbsd: audio_write: nblk=25 hiwat=25 lowat=12
Mar 22 12:08:42 plants-doll /netbsd: sbdsp_intr: intr=0xf810d2cc
					# I killed process here
Mar 22 12:09:02 plants-doll /netbsd: audio_sleep: -1
Mar 22 12:09:02 plants-doll /netbsd: audio_close: unit=0
Mar 22 12:09:02 plants-doll /netbsd: audio_drain: nblk=25
Mar 22 12:10:02 plants-doll /netbsd: audio_sleep: 35
Mar 22 12:10:02 plants-doll /netbsd: sbdsp_close: sc=0xf8736b00
Mar 22 12:10:03 plants-doll /netbsd: sbdsp_haltdma: sc=0xf8736b00
Mar 22 12:10:03 plants-doll /netbsd: sbdsp_close: closed
Mar 22 12:10:03 plants-doll /netbsd: audio_close: done

	When sound is played normally, audio_pint is called after
	sbdsp_intr, like this:

			:
Mar 22 12:11:06 plants-doll /netbsd: audio_write: cc=61696 tp=0xf8750f00 bs=160 nblk=24 left=160
Mar 22 12:11:06 plants-doll /netbsd: audio_write: nblk=25 hiwat=25 lowat=12
Mar 22 12:11:07 plants-doll /netbsd: sbdsp_intr: intr=0xf810d2cc
Mar 22 12:11:07 plants-doll /netbsd: audio_pint: hp=0xf87500a0 cc=160
Mar 22 12:11:07 plants-doll /netbsd: sbdsp_dma_output: cc=160 0xf810d2cc (0xf8736a00)
Mar 22 12:11:07 plants-doll /netbsd: audio_pint: mode=5 pause=0 nblk=24 lowat=12
Mar 22 12:11:07 plants-doll /netbsd: sbdsp_intr: intr=0xf810d2cc
Mar 22 12:11:07 plants-doll /netbsd: audio_pint: hp=0xf8750140 cc=160
Mar 22 12:11:07 plants-doll /netbsd: sbdsp_dma_output: cc=160 0xf810d2cc (0xf8736a00)
Mar 22 12:11:07 plants-doll /netbsd: audio_pint: mode=5 pause=0 nblk=23 lowat=12
			:

>How-To-Repeat:
	Feed some audio data to /dev/audio, like this:
		% cat sample.au > /dev/audio
	or play AVI or QT file with xanim.
>Fix:
	Unknown.
>Audit-Trail:
>Unformatted: