Broken audio on FreeBSD 6.2

OSS specific BSD discussion (FreeBSD/NetBSD/OpenBSD)

Moderators: cesium, dev, kodachi, hannu

Broken audio on FreeBSD 6.2

Postby spl » Tue Jul 31, 2007 12:41 am

I'm having trouble getting OSS to work on a HP Pavilion DV6000 laptop. This is an AMD Touron64x2 system.

Code: Select all
FreeBSD <obscured> 6.2-RELEASE-p6 FreeBSD 6.2-RELEASE-p6 #2: Sat Jul 28 19:00:27 PDT 2007     <obscured>:/usr/obj/usr/src/sys/SMP  amd64


When I try to play an MP3 file with xine or other player, I get only about the first quarter to half second of the file played over and over again.

dmesg shows:

Code: Select all
hdaudio: Pin widget 16 is EAPD capable.
hdaudio0: <nVidia HD Audio> mem 0xb0000000-0xb0003fff irq 11 at device 16.1 on pci0
hdaudio: Ignored request for 5 channels
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.


and ossinfo -v shows

Code: Select all
ossinfo -v
Version info: OSS 4.0 (b070717/200707310009) (0x00040002) CDDL
Platform: FreeBSD/amd64 6.2-RELEASE-p6 FreeBSD 6.2-RELEASE-p6 #2: Sat Jul 28 19:00:27 PDT 2007     <obscured>:/usr/obj/usr/src/sys/SMP

Number of audio devices:        7
Number of audio engines:        7
Number of MIDI devices:         0
Number of mixer devices:        1


Device objects
0: hdaudio0 nVidia HD Audio
1: vmix0 OSS transparent virtual support

MIDI devices (/dev/midi*)

Mixer devices (/dev/mixer*)
0: nVidia HD Audio SmartAMC HD2 (Mixer 0 of device object 0)
    Device file /dev/oss/hdaudio0/mix0, Legacy device /dev/mixer0
    Priority: 10
    Caps:

Audio devices
/dev/oss/hdaudio0/pcm0  nVidia HD Audio pcm output  (device index 0)
    Legacy device /dev/dsp0
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: Available for use
      Engine      2: Available for use
      Engine      3: Available for use
      Engine      4: Available for use
      Engine      5: Available for use
/dev/oss/hdaudio0/spdout0       nVidia HD Audio spdifout output  (device index 1)
    Legacy device /dev/dsp1
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: Available for use
/dev/oss/hdaudio0/pcmin0        nVidia HD Audio rec input  (device index 2)
    Legacy device /dev/dsp2
    Caps: TRIGGER MMAP
    Modes: INPUT 
      In engine   1: Available for use
      Engine      2: Available for use
      Engine      3: Available for use
      Engine      4: Available for use
      Engine      5: Available for use
/dev/oss/vmix0/pcm0     nVidia HD Audio pcm output (VMIX0)  (device index 3)
    Legacy device /dev/dsp3
    Caps: DUPLEX TRIGGER MMAP VIRTUAL
    Modes: IN/OUT
      Engine      1: Available for use
      Engine      2: Available for use
      Engine      3: Available for use
      Engine      4: Available for use
/dev/oss/vmix0/pcm1     nVidia HD Audio pcm output (VMIX0)  (device index 4)
    Legacy device /dev/dsp4
    Caps: DUPLEX TRIGGER MMAP VIRTUAL SHADOW HIDDEN
    Modes: IN/OUT
      Engine      1: Available for use
      Engine      2: Available for use
      Engine      3: Available for use
/dev/oss/vmix0/pcm2     nVidia HD Audio pcm output (VMIX0)  (device index 5)
    Legacy device /dev/dsp5
    Caps: DUPLEX TRIGGER MMAP VIRTUAL SHADOW HIDDEN
    Modes: IN/OUT
      Engine      1: Available for use
      Engine      2: Available for use
/dev/oss/vmix0/pcm3     nVidia HD Audio pcm output (VMIX0)  (device index 6)
    Legacy device /dev/dsp6
    Caps: DUPLEX TRIGGER MMAP VIRTUAL SHADOW HIDDEN
    Modes: IN/OUT
      Engine      1: Available for use


When I run osstest, I get three short beeps and it prints out

Code: Select all
osstest
Sound subsystem and version: OSS 4.0 (b070717/200707310009) (0x00040002)
Platform: FreeBSD/amd64 6.2-RELEASE-p6 FreeBSD 6.2-RELEASE-p6 #2: Sat Jul 28 19:00:27 PDT 2007     <obscured>:/usr/obj/usr/src/sys/SMP

*** Scanning sound adapter #-1 ***
/dev/oss/hdaudio0/pcm0 (audio engine 0): nVidia HD Audio pcm output
- Performing audio playback test...
  <left> Device returned error: Input/output error
/dev/oss/hdaudio0/spdout0 (audio engine 1): nVidia HD Audio spdifout output
- Performing audio playback test...
  <left> Device returned error: Input/output error
/dev/oss/hdaudio0/pcmin0 (audio engine 2): nVidia HD Audio rec input
- Skipping input only device

*** Scanning sound adapter #0 ***
/dev/oss/vmix0/pcm0 (audio engine 3): nVidia HD Audio pcm output (VMIX0)
- Performing audio playback test...
  <left> Device returned error: Input/output error
/dev/oss/vmix0/pcm1 (audio engine 4): nVidia HD Audio pcm output (VMIX0)
- Skipping device (card already tested)
/dev/oss/vmix0/pcm2 (audio engine 5): nVidia HD Audio pcm output (VMIX0)
- Skipping device (card already tested)
/dev/oss/vmix0/pcm3 (audio engine 6): nVidia HD Audio pcm output (VMIX0)
- Skipping device (card already tested)

*** Some errors were detected during the tests ***


I've tried the default install from the ports collection and 1005rc1 with identical results.

This is a "brand new" reconditioned machine.

This is my first encounter with OSS but I'm fairly experienced with FreeBSD. Any suggestions?
spl
New Member
 
Posts: 4
Joined: Mon Jul 30, 2007 11:30 pm

Postby fli » Tue Jul 31, 2007 6:46 pm

I was just about to do a post about this, but as it seems to be exactly the same problem as I have, I'll simply reply here instead.

I have the same type of sound card (HDA) as the original poster and I'm experiencing exactly the same symptoms as well. The card works with snd_hda(4) so I guess it's not broken hardware (snd_hda doesn't do spdifout and surround, thats why I want oss).

Here is the output from ossinfo (I've tried oss-v4.1test0-070717-src-cddl.tar.bz2 as well but with no luck).
Code: Select all
Version info: OSS 4.0 (build 070707/200707311333/C^B (0x00040002)
Platform: FreeBSD/i386 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Tue Jul 31 00:51:41 CEST 2007     root@nexus:/usr/obj/usr/src/sys/NEXUS

Number of audio devices:        14
Number of audio engines:        14
Number of MIDI devices:         0
Number of mixer devices:        1

Device objects
0: hdaudio0 Intel HD Audio
1: vmix0 OSS transparent virtual support


MIDI devices (/dev/midi*)

Mixer devices (/dev/mixer*)
0: Intel HD Audio STAC9271D (Mixer 0 of device object 0)
    Device file /dev/oss/hdaudio0/mix0, Legacy device /dev/mixer0
    Priority: 10
    Caps:
    Device handle: OSS-PCI-mx01
    Device priority: 10

Audio devices
/dev/oss/hdaudio0/pcm0  Intel HD Audio pcm1 output  (device index 0)
    Legacy device /dev/dsp0
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 0/Intel HD Audio pcm1 output
                     Available for use
      Engine      2: 10/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
      Engine      3: 11/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
      Engine      4: 12/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
      Engine      5: 13/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au01
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 8
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/pcm1  Intel HD Audio pcm2 output  (device index 1)
    Legacy device /dev/dsp1
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 1/Intel HD Audio pcm2 output
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au02
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/pcm2  Intel HD Audio pcm3 output  (device index 2)
    Legacy device /dev/dsp2
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 2/Intel HD Audio pcm3 output
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au03
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated


/dev/oss/hdaudio0/pcm3  Intel HD Audio pcm4 output  (device index 3)
    Legacy device /dev/dsp3
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 3/Intel HD Audio pcm4 output
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au04
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/pcm4  Intel HD Audio pcm5 output  (device index 4)
    Legacy device /dev/dsp4
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 4/Intel HD Audio pcm5 output
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au05
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/spdout0       Intel HD Audio spdifout output  (device index 5)
    Legacy device /dev/dsp5
    Caps: TRIGGER MMAP
    Modes: OUTPUT
      Out engine  1: 5/Intel HD Audio spdifout output
                     Available for use
    Input formats (0x00001410):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_AC3          - AC3 (Dolby Digital) encoded audio
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001410):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_AC3          - AC3 (Dolby Digital) encoded audio
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au06
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/pcmin0        Intel HD Audio rec1 input  (device index 6)
    Legacy device /dev/dsp6
    Caps: TRIGGER MMAP
    Modes: INPUT 
      In engine   1: 6/Intel HD Audio rec1 input
                     Available for use
      Engine      2: 10/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
      Engine      3: 11/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
      Engine      4: 12/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
      Engine      5: 13/Intel HD Audio pcm1 output (VMIX0)
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au07
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/pcmin1        Intel HD Audio rec2 input  (device index 7)
    Legacy device /dev/dsp7
    Caps: TRIGGER MMAP
    Modes: INPUT 
      In engine   1: 7/Intel HD Audio rec2 input
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au08
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated

/dev/oss/hdaudio0/pcmin2        Intel HD Audio rec3 input  (device index 8)
    Legacy device /dev/dsp8
    Caps: TRIGGER MMAP
    Modes: INPUT 
      In engine   1: 8/Intel HD Audio rec3 input
                     Available for use
    Input formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001010):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au09
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 192000 (44100,48000,88200,96000,176400,192000)
    HW Type: Not indicated.
    Minimum latency: Not indicated
/dev/oss/hdaudio0/spdin0        Intel HD Audio spdifin input  (device index 9)
    Legacy device /dev/dsp9
    Caps: TRIGGER MMAP
    Modes: INPUT 
      In engine   1: 9/Intel HD Audio spdifin input
                     Available for use
    Input formats (0x00001410):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_AC3          - AC3 (Dolby Digital) encoded audio
      AFMT_S32_LE       - 32 bit signed little endian
    Output formats (0x00001410):
      AFMT_S16_LE       - 16 bit signed little endian
      AFMT_AC3          - AC3 (Dolby Digital) encoded audio
      AFMT_S32_LE       - 32 bit signed little endian
    Device handle: OSS-PCI-au10
    Related mixer dev: 0
    Sample rate source: 0
    Preferred channel configuration: Not indicated
    Supported number of channels (min - max): 2 - 2
    Native sample rates (min - max): 44100 - 96000 (44100,48000,96000)
    HW Type: Not indicated.
    Minimum latency: Not indicated


I did some debugging and it appears that find_output_space() (framework/audio/audio.c) fails to get free buffer space the second time around, first attempt does always succeeds (hence, one hears the "first quarter to half second of the file played").
More precisely it's oss_sleep() (kernel/OS/FreeBSD/os_freebsd.c), called from find_output_space(), that returns returns 0 because the timeout expired and it didn't succeed in getting a buffer within the timeout.

I added a printf() in oss_do_timing(). Here is a debug printout of a failure
Code: Select all
483697909/1: =-=-=- Audio device 0 (Intel HD Audio pcm1 output) opened, ode 2 -=-=-=
483697911/2: Opened by PID: 9411
483697912/1: Opening process name: osstest
483697914/2: oss_audio_ioctl(0, SNDCTL_DSP_GETCAPS)
483697915/1: oss_audio_ioctl(0, SNDCTL_DSP_SETFMT, *0x00000010)
483697917/2: oss_audio_ioctl(0, SNDCTL_DSP_CHANNELS,  *2)
483697918/1: Set channels 2
483697919/1: oss_audio_ioctl(0, SNDCTL_DSP_SPEED,  *48000)
483697959/40: --- audio_write(0, 1351904) ---
483697960/1: No format conversions needed
483697961/1: setup_fragments(0, dir=2)
483697962/1: Max intrate 100 -> min buffer 1920
483697963/1: fragsz=2048, nfrags=32483697965/2: Prepare output dev=0, fragsize=2048, nfrags=32, bytes_in_use=65536/65536
483698075/110: 1351904/1351904 bytes to go
483698077/2: Got output buffer, offs 0/65536, len 65536
483698078/1: Move wrpointer, len 65536
483698079/1:   User=65536
483698080/1:   Byte=0
483698081/1:   Fill=65536
483698082/1: Launch output called
483698083/1: Launch_output calling output_block
483698084/1: Launch_output calling trigger
483698086/2: 1286368/1351904 bytes to go
483698087/1: Sleep(0)
483699138/1051: Sleep(0) (out) timed out
hdaudio: Output timed out on /dev/oss/hdaudio0/pcm0.
483699145/7: =-=-=- Closing audio engine 0 -=-=-=


I haven't figured out where and how the buffers are allocated (DMA?), but hopefully somebody with a little more knowledge of OSS internals can provide a hint.
fli
New Member
 
Posts: 3
Joined: Tue Jul 31, 2007 6:12 pm

Postby spl » Tue Jul 31, 2007 9:48 pm

I couldn't even get snd_hda to work. Did you have to do anything special to make it work?

I notice that you're on 7.0-CURRENT. Maybe I should upgrade?
spl
New Member
 
Posts: 4
Joined: Mon Jul 30, 2007 11:30 pm

Postby spl » Wed Aug 01, 2007 4:51 am

A followup: I attempted to install 7.0-CURRENT and met with no success -- I got it to boot once and then it hung. Subsequent tries caused a general protection fault and a debugger prompt.

I ended up falling back to 6.2.

Oh, well.

I'm not absolutely wedded to FreeBSD for this machine. Does anyone know if any of the Linux distributions work? I tried Ubuntu and had all sorts of problems. I'm just about to write this machine off as a total loss.
spl
New Member
 
Posts: 4
Joined: Mon Jul 30, 2007 11:30 pm

Postby fli » Wed Aug 01, 2007 10:01 am

From some more code reading I know believe that the problem is within hdaintr() (hdaudio.c) or in the call path to oss_wakeup()

hdaintr() (hdaudio.c)
oss_audio_outputintr() (macro)
audio_outputintr() (audio.c)
do_outputintr() (audio.c)
oss_wakeup() (os_freebsd.c)

I think that somewhere along this path something goes wrong or the interrupt doesn't even fire at all (or the problem is something completely different :)).

I haven't done any practical testing yet to verify my claims, need to take care of some real-life work for a while.

Oh, and I tried OSS on another machine running -current, that machine has an old ICH card and it works perfectly so it's really a hdaudio problem.
fli
New Member
 
Posts: 3
Joined: Tue Jul 31, 2007 6:12 pm

Postby spl » Thu Aug 02, 2007 4:42 pm

A final followup: upgrading FreeBSD to 6.2-STABLE (from 6.2-RELEASE) allowed me to use <b>snd_hda</b>, which is fine with me at this juncture, since I really don't care about any "advanced features" right now -- at least the thing makes noise.
spl
New Member
 
Posts: 4
Joined: Mon Jul 30, 2007 11:30 pm

Postby fli » Tue Aug 21, 2007 3:08 pm

Look at it a bit more today, in the cases when audio is broken the interrupt isn't fired and hdaintr() isn't executed, I haven't really figured out why, maybe somebody can help?

I have timing outputs from a broken case and a non-broken case if somebody is interested.
They differ a bit during driver attach where the broken case has a bunch of
Code: Select all
-2006633358/0: Inputintr(6)
-2006633358/0: Wake up (in)

don't know if it's related though.
fli
New Member
 
Posts: 3
Joined: Tue Jul 31, 2007 6:12 pm


Return to BSD

Who is online

Users browsing this forum: No registered users and 1 guest