NetBSD Problem Report #32405

From www@netbsd.org  Thu Dec 29 02:20:16 2005
Return-Path: <www@netbsd.org>
Received: by narn.netbsd.org (Postfix, from userid 31301)
	id 51F0A63B898; Thu, 29 Dec 2005 02:20:16 +0000 (UTC)
Message-Id: <20051229022016.51F0A63B898@narn.netbsd.org>
Date: Thu, 29 Dec 2005 02:20:16 +0000 (UTC)
From: stephane.witzmann@gmail.com
Reply-To: stephane.witzmann@gmail.com
To: gnats-bugs@netbsd.org
Subject: Looks like SNDCTL_DSP_GETOPTR ioctl went wrong in auich(4) between 2.1 and 3.0
X-Send-Pr-Version: www-1.0

>Number:         32405
>Category:       kern
>Synopsis:       Looks like SNDCTL_DSP_GETOPTR ioctl went wrong in auich(4) between 2.1 and 3.0
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kent
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 29 02:25:00 +0000 2005
>Closed-Date:    Wed May 10 11:23:33 +0000 2006
>Last-Modified:  Wed May 10 11:23:33 +0000 2006
>Originator:     Stéphane Witzmann
>Release:        3.0/i386 kernel, 2.1/i386 userland
>Organization:
>Environment:
NetBSD wolfenstein 3.0 NetBSD 3.0 (GENERIC) #0: Mon Dec 19 01:04:02 UTC 2005 builds@works.netbsd.org:/home/builds/ab/netbsd-3-0-RELEASE/i386/200512182024Z-obj/home/builds/ab/netbsd-3-0-RELEASE/src/sys/arch/i386/compile/GENERIC i386

>Description:
As a first step towards upgrading from 2.1 to 3.0, I tested a GENERIC 3.0 kernel with my current 2.1 userland. Trying to play videos with xine, I noticed there was a problem with the sound: for each file, it played about 0.1s audio then nothing, while video was ok. Playing the same videos with mplayer worked, as well as playing mp3s with xmms.

I ran a few tests, compared the integrated sound card (auich) of my laptop with a usb one, with the two kernels (2.1 and 3.0), and playing with xine a/v sync options, which are the following:

- auto: auto-select best
- getodelay: uses the SNDCTL_DSP_GETODELAY ioctl
- getoptr: uses the SNDCTL_DSP_GETOPTR ioctl
- softsync: uses software synchronization with system clock
- probebuffer: probes the sound card buffer size on initialization to calculate the latency for a/v sync

Since I never got getodelay to work, auto seems to always select getoptr. With both sound card and kernels, softsync and probebuffer worked. getoptr also worked with both kernels on my usb sound card, worked with 2.1 on auich, but I got the above problem with 3.0 on auich. Didn't try another non-USB sound card since the machine is a laptop.


Here are the audio devices, according to dmesg:

auich0 at pci0 dev 31 function 5: i82801DB/DBM (ICH4/ICH4M) AC-97 Audio
auich0: interrupting at irq 5
auich0: ac97: CXT48 codec; reserved, headphone, 18 bit DAC, 18 bit ADC, no 3D stereo
auich0: ac97: ext id a04<AC97_23,AMAP,SPDIF>
audio0 at auich0: full duplex, independent

uaudio0 at uhub0 port 1 configuration 1 interface 1: M-Audio Audiophile USB (tm), rev 1.00/1.01, addr 2
uaudio0: ignored audio interface with 2 endpoints
uaudio0: ignored audio interface with 2 endpoints
uaudio0: ignored audio interface with 2 endpoints
uaudio0: ignored audio interface with 2 endpoints
uaudio0: ignored setting with type 8193 format
uaudio0: audio rev 1.00
audio1 at uaudio0: full duplex, independent

>How-To-Repeat:
Use a 3.0 kernel and play a video with xine using auto or getoptr as a/v sync method on a (or at least on my) auich sound card.

>Fix:
Use another sync method in xine, but that is only a workaround.

>Release-Note:

>Audit-Trail:
From: =?ISO-8859-1?Q?St=E9phane_Witzmann?= <stephane.witzmann@gmail.com>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/32405
Date: Thu, 29 Dec 2005 05:10:29 +0100

 Well, I had it fail (ie not work with getoptr) with 3.0 on my USB
 sound card too, but only on a few videos (always the same ones,
 hopefully).

 Since we now know that this PR is NOT about auich(4) but more general,
 it sounds like a good idea to rename it.


 I also ran additional tests, I compared the output of "audioctl -a"
 with 2.1 and 3.0 when playing the same video, one which doesn't work
 with 3.0.

 2.1 says:
 name=3DICH4 AC97
 version=3D0x03
 config=3Dauich0
 encodings=3Dulinear:8*,mulaw:8*,alaw:8*,slinear:8*,slinear_le:16,ulinear_le=
 :16*,slinear_be:16*,ulinear_be:16*
 properties=3Dfull_duplex,independent
 full_duplex=3D0
 fullduplex=3D0
 blocksize=3D9600
 hiwat=3D6
 lowat=3D4
 monitor_gain=3D0
 mode=3Dplay
 play.rate=3D44100
 play.channels=3D1
 play.precision=3D16
 play.encoding=3Dslinear_le
 play.gain=3D127
 play.balance=3D32
 play.port=3D0x0
 play.avail_ports=3D0x0
 play.seek=3D57596
 play.samples=3D2707200
 play.eof=3D0
 play.pause=3D0
 play.error=3D0
 play.waiting=3D0
 play.open=3D1
 play.active=3D1
 play.buffer_size=3D65536
 record.rate=3D44100
 record.channels=3D1
 record.precision=3D16
 record.encoding=3Dslinear_le
 record.gain=3D0
 record.balance=3D32
 record.port=3D0x1
 record.avail_ports=3D0x7
 record.seek=3D0
 record.samples=3D0
 record.eof=3D0
 record.pause=3D0
 record.error=3D0
 record.waiting=3D0
 record.open=3D0
 record.active=3D0
 record.buffer_size=3D65536
 record.errors=3D0

 and 3.0 says:
 name=3DICH4 AC97
 version=3D0x03
 config=3Dauich0
 encodings=3Dslinear_le:16,slinear_be:16*,ulinear_le:16*,ulinear_be:16*,mula=
 w:8*,alaw:8*
 properties=3Dfull_duplex,independent
 full_duplex=3D0
 fullduplex=3D0
 blocksize=3D9600
 hiwat=3D6
 lowat=3D5
 monitor_gain=3D0
 mode=3Dplay
 play.rate=3D44100
 play.channels=3D1
 play.precision=3D16
 play.encoding=3Dslinear_le
 play.gain=3D119
 play.balance=3D32
 play.port=3D0x0
 play.avail_ports=3D0x0
 play.seek=3D0
 play.samples=3D4290948852
 play.eof=3D0
 play.pause=3D0
 play.error=3D1
 play.waiting=3D0
 play.open=3D1
 play.active=3D1
 play.buffer_size=3D65536
 record.rate=3D44100
 record.channels=3D1
 record.precision=3D16
 record.encoding=3Dslinear_le
 record.gain=3D0
 record.balance=3D32
 record.port=3D0x1
 record.avail_ports=3D0x7
 record.seek=3D0
 record.samples=3D0
 record.eof=3D0
 record.pause=3D0
 record.error=3D0
 record.waiting=3D0
 record.open=3D0
 record.active=3D0
 record.buffer_size=3D65536
 record.errors=3D0


 diff points out that :
 - play.error=3D1
 - play.samples is huge
 - lowat (what is it ?) changed from 4 to 5

Responsible-Changed-From-To: kern-bug-people->kent
Responsible-Changed-By: kent@netbsd.org
Responsible-Changed-When: Sun, 07 May 2006 13:53:06 +0000
Responsible-Changed-Why:
My change seems to cause the problem.


State-Changed-From-To: open->analyzed
State-Changed-By: kent@netbsd.org
State-Changed-When: Sun, 07 May 2006 13:53:06 +0000
State-Changed-Why:
I confirmed SNDCTL_DSP_GETOPTR's count_info::bytes value is never updated.


From: TAMURA Kent <kent@NetBSD.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/32405 (Looks like SNDCTL_DSP_GETOPTR ioctl went wrong in auich(4) between 2.1 and 3.0)
Date: Mon,  8 May 2006 00:21:31 +0900 (JST)

 > I confirmed SNDCTL_DSP_GETOPTR's count_info::bytes value is never updated.

 Oops, it was incorrect.
 count_info::blocks has wrong value.

 Stephane, could you try the following patch?  If the patch
 doesn't work, would you tell me the version of your xine?  I
 couldn't find choices such as getodelay and getoptr with
 xine-lib-1.0.3a and xine-ui-0.99.4.

 Index: sys/dev/audio.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/audio.c,v
 retrieving revision 1.204
 diff -u -r1.204 audio.c
 --- sys/dev/audio.c     19 Apr 2006 14:10:58 -0000      1.204
 +++ sys/dev/audio.c     7 May 2006 15:16:27 -0000
 @@ -1181,6 +1181,7 @@
         rp->s.outp = rp->s.inp = rp->s.start;
         rp->s.used = 0;
         rp->stamp = 0;
 +       rp->stamp_last = 0;
         rp->fstamp = 0;
         rp->drops = 0;
         rp->pause = FALSE;

 -- 
 TAMURA Kent <kent_2006 at hauN.org> <kent at NetBSD.org>

State-Changed-From-To: analyzed->closed
State-Changed-By: kent@netbsd.org
State-Changed-When: Wed, 10 May 2006 11:23:33 +0000
State-Changed-Why:
A fix has been committed.
The submitter confirmed the fix resolved the problem.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.