All of lore.kernel.org
 help / color / mirror / Atom feed
* aplay -l  vs.  aplay -L: Missing PCMs?
@ 2010-08-19 22:12 Stephen Warren
  2010-08-20  1:28 ` Raymond Yau
  2010-08-20  8:34 ` Jaroslav Kysela
  0 siblings, 2 replies; 8+ messages in thread
From: Stephen Warren @ 2010-08-19 22:12 UTC (permalink / raw)
  To: 'alsa-devel@alsa-project.org'

The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:

(on card 1):

[swarren@swarren-lx2 ~]$ sudo aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 7: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 8: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia_1 [HDA NVidia], device 9: NVIDIA HDMI [NVIDIA HDMI]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

... all of which appear to work OK.

However, the list of available "PCMs" from aplay -L doesn't expose them all:

[swarren@swarren-lx2 ~]$ sudo aplay -L
front:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    Front speakers
surround40:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    4.0 Surround output to Front and Rear speakers
surround41:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Analog
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
hdmi:CARD=NVidia,DEV=0
    HDA NVidia, ALC1200 Digital
    HDMI Audio Output
null
    Discard all samples (playback) or generate zero samples (capture)
pulse
    Playback/recording through the PulseAudio sound server
hdmi:CARD=NVidia_1
    HDA NVidia, NVIDIA HDMI
    HDMI Audio Output

Similarly, pulseaudio only shows one output for the GPU; I assume it uses
the same enumeration mechanism for ALSA sinks as "aplay -L".

Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
converter. Is this an incorrect assumption? How would I make that happen?

I imagine that's why Google shows up so many hits on probe_mask for NVIDIA
GPUs, so that the one that does show up is the one users want?

Thanks.

-- 
nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l vs. aplay -L: Missing PCMs?
  2010-08-19 22:12 aplay -l vs. aplay -L: Missing PCMs? Stephen Warren
@ 2010-08-20  1:28 ` Raymond Yau
  2010-08-20  8:34 ` Jaroslav Kysela
  1 sibling, 0 replies; 8+ messages in thread
From: Raymond Yau @ 2010-08-20  1:28 UTC (permalink / raw)
  To: ALSA Development Mailing List

2010/8/20 Stephen Warren <swarren@nvidia.com>

> The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
>
> (on card 1):
>
> [swarren@swarren-lx2 ~]$ sudo aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 7: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 8: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 9: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
>
> ... all of which appear to work OK.
>
> However, the list of available "PCMs" from aplay -L doesn't expose them
> all:
>
> [swarren@swarren-lx2 ~]$ sudo aplay -L
> front:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    Front speakers
> surround40:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    4.0 Surround output to Front and Rear speakers
> surround41:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    4.1 Surround output to Front, Rear and Subwoofer speakers
> surround50:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    5.0 Surround output to Front, Center and Rear speakers
> surround51:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
> surround71:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
> hdmi:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Digital
>    HDMI Audio Output
> null
>    Discard all samples (playback) or generate zero samples (capture)
> pulse
>    Playback/recording through the PulseAudio sound server
> hdmi:CARD=NVidia_1
>    HDA NVidia, NVIDIA HDMI
>    HDMI Audio Output
>
> Similarly, pulseaudio only shows one output for the GPU; I assume it uses
> the same enumeration mechanism for ALSA sinks as "aplay -L".
>

AFAIK , pulseaudio hardcoded the device name and you can see PA probe hdmi
even when the card is intel8x0  (e.g. using intel8x0 inside VirtualBox)


>
> Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
> converter. Is this an incorrect assumption? How would I make that happen?
>

Do you mean that you have 4 hdmi out on your motherboard ?

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l  vs.  aplay -L: Missing PCMs?
  2010-08-19 22:12 aplay -l vs. aplay -L: Missing PCMs? Stephen Warren
  2010-08-20  1:28 ` Raymond Yau
@ 2010-08-20  8:34 ` Jaroslav Kysela
  2010-08-20 17:08   ` Stephen Warren
  1 sibling, 1 reply; 8+ messages in thread
From: Jaroslav Kysela @ 2010-08-20  8:34 UTC (permalink / raw)
  To: Stephen Warren; +Cc: 'alsa-devel@alsa-project.org'

On Thu, 19 Aug 2010, Stephen Warren wrote:

> The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
>
> (on card 1):
>
> [swarren@swarren-lx2 ~]$ sudo aplay -l
> **** List of PLAYBACK Hardware Devices ****
> card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 0: NVidia [HDA NVidia], device 3: ALC1200 Digital [ALC1200 Digital]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 7: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 8: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
> card 1: NVidia_1 [HDA NVidia], device 9: NVIDIA HDMI [NVIDIA HDMI]
>  Subdevices: 1/1
>  Subdevice #0: subdevice #0
>
> ... all of which appear to work OK.
>
> However, the list of available "PCMs" from aplay -L doesn't expose them all:
>
> [swarren@swarren-lx2 ~]$ sudo aplay -L
> front:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    Front speakers
> surround40:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    4.0 Surround output to Front and Rear speakers
> surround41:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    4.1 Surround output to Front, Rear and Subwoofer speakers
> surround50:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    5.0 Surround output to Front, Center and Rear speakers
> surround51:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
> surround71:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Analog
>    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
> hdmi:CARD=NVidia,DEV=0
>    HDA NVidia, ALC1200 Digital
>    HDMI Audio Output
> null
>    Discard all samples (playback) or generate zero samples (capture)
> pulse
>    Playback/recording through the PulseAudio sound server
> hdmi:CARD=NVidia_1
>    HDA NVidia, NVIDIA HDMI
>    HDMI Audio Output
>
> Similarly, pulseaudio only shows one output for the GPU; I assume it uses
> the same enumeration mechanism for ALSA sinks as "aplay -L".
>
> Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
> converter. Is this an incorrect assumption? How would I make that happen?

There is a bug in alsa-lib to namehint.c. The code assumes that hw device 
number is similar to logical device numbers which is not true in case of 
your HDMI devices:

3, 7, 8, 9

The fallback code is used and only first logical device 0 is created.

Could you test this patch?

http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=97d25c0766405453d3c298bd51dd4916121a4f6a

PulseAudio uses different device enumeration, so ask on their mailing 
list.

 					Jaroslav

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l  vs.  aplay -L: Missing PCMs?
  2010-08-20  8:34 ` Jaroslav Kysela
@ 2010-08-20 17:08   ` Stephen Warren
  2010-08-20 20:21     ` Jaroslav Kysela
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Warren @ 2010-08-20 17:08 UTC (permalink / raw)
  To: 'Jaroslav Kysela'; +Cc: 'alsa-devel@alsa-project.org'

Jaroslav Kysela wrote:
> 
> On Thu, 19 Aug 2010, Stephen Warren wrote:
> 
> > The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
> >
> > (on card 1):
> >
> > [swarren@swarren-lx2 ~]$ sudo aplay -l
> > << includes hw=1,3 hw=1,7 hw=1,8 hw=1,9 >>
> > ... all of which appear to work OK.
> >
> > However, the list of available "PCMs" from aplay -L doesn't expose them all:
> >
> > [swarren@swarren-lx2 ~]$ sudo aplay -L
> > <<card 0 "Nvidia" elided>>
> > hdmi:CARD=NVidia_1
> >    HDA NVidia, NVIDIA HDMI
> >    HDMI Audio Output
> >
> > Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
> > converter. Is this an incorrect assumption? How would I make that happen?
> 
> There is a bug in alsa-lib to namehint.c. The code assumes that hw device
> number is similar to logical device numbers which is not true in case of
> your HDMI devices:
> 
> 3, 7, 8, 9
> 
> The fallback code is used and only first logical device 0 is created.
> 
> Could you test this patch?
> 
> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=97d25c0766405453d3c298bd51dd4916121a4f6a

I tested that, and unfortunately it doesn't seem to work; I get the exact same
aplay -L output.

I debugged this a little, and see that add_card() is calculating the correct
max_devices value for card=1 str=hdmi. However, in the loop that right after
that calls try_config, when device=0, it returns 0, but when device=1, it
returns -2 (-ENOENT). This happens inside try_config where it calls
snd_config_search_definition (line 244 in latest git). At that point, buf is:

hdmi:CARD=NVidia_1,DEV=1

... which seems reasonable.

I'm a little confused about the device numbering though: The max_devices
value is counting values "3, 7, 8, 9" and hence gets 9. However, the loop that
calls try_config loops 0..max_devices-1, but bails out as soon as any error is
found, thus disallowing "holes" in the numbering. That implies that "device" in
that loop is a different numbering space? After I noticed that, I hacked that
loop to continue instead of break on errors, and also removed the "err >= 0"
condition from the loop, expecting that when device==3/7/8/9, try_config might
work. In fact, 0 still works (of course) and 1..8 all fail with err=-2, so I
assume at the same place in try_config.

-- 
nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l  vs.  aplay -L: Missing PCMs?
  2010-08-20 17:08   ` Stephen Warren
@ 2010-08-20 20:21     ` Jaroslav Kysela
  2010-08-20 20:35       ` Stephen Warren
  0 siblings, 1 reply; 8+ messages in thread
From: Jaroslav Kysela @ 2010-08-20 20:21 UTC (permalink / raw)
  To: Stephen Warren; +Cc: 'alsa-devel@alsa-project.org'

On Fri, 20 Aug 2010, Stephen Warren wrote:

> Jaroslav Kysela wrote:
>>
>> On Thu, 19 Aug 2010, Stephen Warren wrote:
>>
>>> The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
>>>
>>> (on card 1):
>>>
>>> [swarren@swarren-lx2 ~]$ sudo aplay -l
>>> << includes hw=1,3 hw=1,7 hw=1,8 hw=1,9 >>
>>> ... all of which appear to work OK.
>>>
>>> However, the list of available "PCMs" from aplay -L doesn't expose them all:
>>>
>>> [swarren@swarren-lx2 ~]$ sudo aplay -L
>>> <<card 0 "Nvidia" elided>>
>>> hdmi:CARD=NVidia_1
>>>    HDA NVidia, NVIDIA HDMI
>>>    HDMI Audio Output
>>>
>>> Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
>>> converter. Is this an incorrect assumption? How would I make that happen?
>>
>> There is a bug in alsa-lib to namehint.c. The code assumes that hw device
>> number is similar to logical device numbers which is not true in case of
>> your HDMI devices:
>>
>> 3, 7, 8, 9
>>
>> The fallback code is used and only first logical device 0 is created.
>>
>> Could you test this patch?
>>
>> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=97d25c0766405453d3c298bd51dd4916121a4f6a
>
> I tested that, and unfortunately it doesn't seem to work; I get the exact same
> aplay -L output.
>
> I debugged this a little, and see that add_card() is calculating the correct
> max_devices value for card=1 str=hdmi. However, in the loop that right after
> that calls try_config, when device=0, it returns 0, but when device=1, it
> returns -2 (-ENOENT). This happens inside try_config where it calls
> snd_config_search_definition (line 244 in latest git). At that point, buf is:
>
> hdmi:CARD=NVidia_1,DEV=1
>
> ... which seems reasonable.
>
> I'm a little confused about the device numbering though: The max_devices 
> value is counting values "3, 7, 8, 9" and hence gets 9. However, the 
> loop that calls try_config loops 0..max_devices-1, but bails out as soon 
> as any error is found, thus disallowing "holes" in the numbering. That 
> implies that "device" in that loop is a different numbering space? After 
> I noticed that, I hacked that loop to continue instead of break on 
> errors, and also removed the "err >= 0" condition from the loop, 
> expecting that when device==3/7/8/9, try_config might work. In fact, 0 
> still works (of course) and 1..8 all fail with err=-2, so I assume at 
> the same place in try_config.

See my description. It's assumed that the logical devices 
(hdmi:DEV=<logical_device>) are continous. Does
'aplay -D hdmi:CARD=NVidia_1,DEV=1' work in your system?

 					Jaroslav

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l  vs.  aplay -L: Missing PCMs?
  2010-08-20 20:21     ` Jaroslav Kysela
@ 2010-08-20 20:35       ` Stephen Warren
  2010-08-21  5:56         ` Jaroslav Kysela
  0 siblings, 1 reply; 8+ messages in thread
From: Stephen Warren @ 2010-08-20 20:35 UTC (permalink / raw)
  To: 'Jaroslav Kysela'; +Cc: 'alsa-devel@alsa-project.org'

Jaroslav Kysela wrote:
> 
> On Fri, 20 Aug 2010, Stephen Warren wrote:
> 
> > Jaroslav Kysela wrote:
> >>
> >> On Thu, 19 Aug 2010, Stephen Warren wrote:
> >>
> >>> The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
> >>>
> >>> (on card 1):
> >>>
> >>> [swarren@swarren-lx2 ~]$ sudo aplay -l
> >>> << includes hw=1,3 hw=1,7 hw=1,8 hw=1,9 >>
> >>> ... all of which appear to work OK.
> >>>
> >>> However, the list of available "PCMs" from aplay -L doesn't expose them all:
> >>>
> >>> [swarren@swarren-lx2 ~]$ sudo aplay -L
> >>> <<card 0 "Nvidia" elided>>
> >>> hdmi:CARD=NVidia_1
> >>>    HDA NVidia, NVIDIA HDMI
> >>>    HDMI Audio Output
> >>>
> >>> Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
> >>> converter. Is this an incorrect assumption? How would I make that happen?
> >>
> >> There is a bug in alsa-lib to namehint.c. The code assumes that hw device
> >> number is similar to logical device numbers which is not true in case of
> >> your HDMI devices:
> >>
> >> 3, 7, 8, 9
> >>
> >> The fallback code is used and only first logical device 0 is created.
> >>
> >> Could you test this patch?
> >>
> >> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=97d25c0766405453d3c298bd51dd4916121a4f6a
> >
> > I tested that, and unfortunately it doesn't seem to work; I get the exact same
> > aplay -L output.
> >
> > I debugged this a little, and see that add_card() is calculating the correct
> > max_devices value for card=1 str=hdmi. However, in the loop that right after
> > that calls try_config, when device=0, it returns 0, but when device=1, it
> > returns -2 (-ENOENT). This happens inside try_config where it calls
> > snd_config_search_definition (line 244 in latest git). At that point, buf is:
> >
> > hdmi:CARD=NVidia_1,DEV=1
> >
> > ... which seems reasonable.
> >
> > I'm a little confused about the device numbering though: The max_devices
> > value is counting values "3, 7, 8, 9" and hence gets 9. However, the
> > loop that calls try_config loops 0..max_devices-1, but bails out as soon
> > as any error is found, thus disallowing "holes" in the numbering. That
> > implies that "device" in that loop is a different numbering space? After
> > I noticed that, I hacked that loop to continue instead of break on
> > errors, and also removed the "err >= 0" condition from the loop,
> > expecting that when device==3/7/8/9, try_config might work. In fact, 0
> > still works (of course) and 1..8 all fail with err=-2, so I assume at
> > the same place in try_config.
> 
> See my description. It's assumed that the logical devices
> (hdmi:DEV=<logical_device>) are continous. Does
> 'aplay -D hdmi:CARD=NVidia_1,DEV=1' work in your system?

Sure, the logical device IDs should be contiguous. But then, I don't see why
the code would need to calculate max_devices (which is max HW device ID and
hence something other than logical device ID). Anyway...

[swarren@swarren-lx2 ~]$ aplay -D hw:1,7 Shamisen-C4.wav 
Playing WAVE 'Shamisen-C4.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo

[swarren@swarren-lx2 ~]$ aplay -D hdmi:CARD=NVidia_1,DEV=1 Shamisen-C4.wav 
ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find definition 'cards.HDA-Intel.pcm.hdmi.1:CARD=NVidia_1,AES0=4,AES1=130,AES2=0,AES3=2'
ALSA lib conf.c:4170:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:4649:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2229:(snd_pcm_open_noupdate) Unknown PCM hdmi:CARD=NVidia_1,DEV=1
aplay: main:608: audio open error: No such file or directory

-- 
nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l  vs.  aplay -L: Missing PCMs?
  2010-08-20 20:35       ` Stephen Warren
@ 2010-08-21  5:56         ` Jaroslav Kysela
  2010-08-23 16:30           ` Stephen Warren
  0 siblings, 1 reply; 8+ messages in thread
From: Jaroslav Kysela @ 2010-08-21  5:56 UTC (permalink / raw)
  To: Stephen Warren; +Cc: 'alsa-devel@alsa-project.org'

On Fri, 20 Aug 2010, Stephen Warren wrote:

> Jaroslav Kysela wrote:
>>
>> On Fri, 20 Aug 2010, Stephen Warren wrote:
>>
>>> Jaroslav Kysela wrote:
>>>>
>>>> On Thu, 19 Aug 2010, Stephen Warren wrote:
>>>>
>>>>> The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
>>>>>
>>>>> (on card 1):
>>>>>
>>>>> [swarren@swarren-lx2 ~]$ sudo aplay -l
>>>>> << includes hw=1,3 hw=1,7 hw=1,8 hw=1,9 >>
>>>>> ... all of which appear to work OK.
>>>>>
>>>>> However, the list of available "PCMs" from aplay -L doesn't expose them all:
>>>>>
>>>>> [swarren@swarren-lx2 ~]$ sudo aplay -L
>>>>> <<card 0 "Nvidia" elided>>
>>>>> hdmi:CARD=NVidia_1
>>>>>    HDA NVidia, NVIDIA HDMI
>>>>>    HDMI Audio Output
>>>>>
>>>>> Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
>>>>> converter. Is this an incorrect assumption? How would I make that happen?
>>>>
>>>> There is a bug in alsa-lib to namehint.c. The code assumes that hw device
>>>> number is similar to logical device numbers which is not true in case of
>>>> your HDMI devices:
>>>>
>>>> 3, 7, 8, 9
>>>>
>>>> The fallback code is used and only first logical device 0 is created.
>>>>
>>>> Could you test this patch?
>>>>
>>>> http://git.alsa-project.org/?p=alsa-lib.git;a=commitdiff;h=97d25c0766405453d3c298bd51dd4916121a4f6a
>>>
>>> I tested that, and unfortunately it doesn't seem to work; I get the exact same
>>> aplay -L output.
>>>
>>> I debugged this a little, and see that add_card() is calculating the correct
>>> max_devices value for card=1 str=hdmi. However, in the loop that right after
>>> that calls try_config, when device=0, it returns 0, but when device=1, it
>>> returns -2 (-ENOENT). This happens inside try_config where it calls
>>> snd_config_search_definition (line 244 in latest git). At that point, buf is:
>>>
>>> hdmi:CARD=NVidia_1,DEV=1
>>>
>>> ... which seems reasonable.
>>>
>>> I'm a little confused about the device numbering though: The max_devices
>>> value is counting values "3, 7, 8, 9" and hence gets 9. However, the
>>> loop that calls try_config loops 0..max_devices-1, but bails out as soon
>>> as any error is found, thus disallowing "holes" in the numbering. That
>>> implies that "device" in that loop is a different numbering space? After
>>> I noticed that, I hacked that loop to continue instead of break on
>>> errors, and also removed the "err >= 0" condition from the loop,
>>> expecting that when device==3/7/8/9, try_config might work. In fact, 0
>>> still works (of course) and 1..8 all fail with err=-2, so I assume at
>>> the same place in try_config.
>>
>> See my description. It's assumed that the logical devices
>> (hdmi:DEV=<logical_device>) are continous. Does
>> 'aplay -D hdmi:CARD=NVidia_1,DEV=1' work in your system?
>
> Sure, the logical device IDs should be contiguous. But then, I don't see why
> the code would need to calculate max_devices (which is max HW device ID and
> hence something other than logical device ID). Anyway...

There is no way to get the maximum logical device number at the moment.
We can add some variables to the configuration files in future. The code
just assumes that logical numbers does not go above the maximum hw device 
number.

> [swarren@swarren-lx2 ~]$ aplay -D hw:1,7 Shamisen-C4.wav
> Playing WAVE 'Shamisen-C4.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
>
> [swarren@swarren-lx2 ~]$ aplay -D hdmi:CARD=NVidia_1,DEV=1 
> Shamisen-C4.wav ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find 
> definition 
> 'cards.HDA-Intel.pcm.hdmi.1:CARD=NVidia_1,AES0=4,AES1=130,AES2=0,AES3=2'

Have you updated the HDA-Intel.conf file in the /usr/share/alsa/cards 
directory? There should be definition of:

HDA-Intel.pcm.hdmi.1 {
         @args [ CARD AES0 AES1 AES2 AES3 ]
         @args.CARD { type string }
         @args.AES0 { type integer }
         @args.AES1 { type integer }
         @args.AES2 { type integer }
         @args.AES3 { type integer }
         @func refer
         name {

....

}

This addition is recent:

commit e6d5dcf1f625984605d362338d71162de45a6c60
Author: Anssi Hannula <anssi.hannula@iki.fi>
Date:   Tue Aug 3 20:27:49 2010 +0300

     HDA-Intel: present all 4 HDMI outputs instead of just the first one

     Commit 92608badc519a8c1f65d93743396517aaa582b53 in linux kernel added
     the possibility of 3 additional HDMI devices on indexes 7-9.

     Present all those additional devices using the "hdmi" alias as well.

     Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
     Signed-off-by: Takashi Iwai <tiwai@suse.de>

-----
Jaroslav Kysela <perex@perex.cz>
Linux Kernel Sound Maintainer
ALSA Project, Red Hat, Inc.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: aplay -l  vs.  aplay -L: Missing PCMs?
  2010-08-21  5:56         ` Jaroslav Kysela
@ 2010-08-23 16:30           ` Stephen Warren
  0 siblings, 0 replies; 8+ messages in thread
From: Stephen Warren @ 2010-08-23 16:30 UTC (permalink / raw)
  To: 'Jaroslav Kysela'; +Cc: 'alsa-devel@alsa-project.org'

Jaroslav Kysela wrote:
> 
> On Fri, 20 Aug 2010, Stephen Warren wrote:
> 
> > Jaroslav Kysela wrote:
> >>
> >> On Fri, 20 Aug 2010, Stephen Warren wrote:
> >>
> >>> Jaroslav Kysela wrote:
> >>>>
> >>>> On Thu, 19 Aug 2010, Stephen Warren wrote:
> >>>>
> >>>>> The Azalia controller on NVIDIA GPUs gives 4 ALSA hw devices:
> >>>>>
> >>>>> (on card 1):
> >>>>>
> >>>>> [swarren@swarren-lx2 ~]$ sudo aplay -l
> >>>>> << includes hw=1,3 hw=1,7 hw=1,8 hw=1,9 >>
> >>>>> ... all of which appear to work OK.
> >>>>>
> >>>>> However, the list of available "PCMs" from aplay -L doesn't expose them all:
> >>>>>
> >>>>> [swarren@swarren-lx2 ~]$ sudo aplay -L
> >>>>> <<card 0 "Nvidia" elided>>
> >>>>> hdmi:CARD=NVidia_1
> >>>>>    HDA NVidia, NVIDIA HDMI
> >>>>>    HDMI Audio Output
> >>>>>
> >>>>> Instead, I imagined that I'd see 4 PCMs listed by "aplay -L"; one for each
> >>>>> converter. Is this an incorrect assumption? How would I make that happen?
> >>>>
> >>>> There is a bug in alsa-lib to namehint.c. The code assumes that hw device
> >>>> number is similar to logical device numbers which is not true in case of
> >>>> your HDMI devices:
> >>>>
> >>>> 3, 7, 8, 9
> >>>>
> >>>> The fallback code is used and only first logical device 0 is created.
> >>>>
> >>>> Could you test this patch?
> >>>>
> >>>> http://git.alsa-project.org/?p=alsa-
> lib.git;a=commitdiff;h=97d25c0766405453d3c298bd51dd4916121a4f6a
> >>>
> >>> I tested that, and unfortunately it doesn't seem to work; I get the exact same
> >>> aplay -L output.
> >>>
> >>> I debugged this a little, and see that add_card() is calculating the correct
> >>> max_devices value for card=1 str=hdmi. However, in the loop that right after
> >>> that calls try_config, when device=0, it returns 0, but when device=1, it
> >>> returns -2 (-ENOENT). This happens inside try_config where it calls
> >>> snd_config_search_definition (line 244 in latest git). At that point, buf is:
> >>>
> >>> hdmi:CARD=NVidia_1,DEV=1
> >>>
> >>> ... which seems reasonable.
> >>>
> >>> I'm a little confused about the device numbering though: The max_devices
> >>> value is counting values "3, 7, 8, 9" and hence gets 9. However, the
> >>> loop that calls try_config loops 0..max_devices-1, but bails out as soon
> >>> as any error is found, thus disallowing "holes" in the numbering. That
> >>> implies that "device" in that loop is a different numbering space? After
> >>> I noticed that, I hacked that loop to continue instead of break on
> >>> errors, and also removed the "err >= 0" condition from the loop,
> >>> expecting that when device==3/7/8/9, try_config might work. In fact, 0
> >>> still works (of course) and 1..8 all fail with err=-2, so I assume at
> >>> the same place in try_config.
> >>
> >> See my description. It's assumed that the logical devices
> >> (hdmi:DEV=<logical_device>) are continous. Does
> >> 'aplay -D hdmi:CARD=NVidia_1,DEV=1' work in your system?
> >
> > Sure, the logical device IDs should be contiguous. But then, I don't see why
> > the code would need to calculate max_devices (which is max HW device ID and
> > hence something other than logical device ID). Anyway...
> 
> There is no way to get the maximum logical device number at the moment.
> We can add some variables to the configuration files in future. The code
> just assumes that logical numbers does not go above the maximum hw device
> number.
> 
> > [swarren@swarren-lx2 ~]$ aplay -D hw:1,7 Shamisen-C4.wav
> > Playing WAVE 'Shamisen-C4.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
> >
> > [swarren@swarren-lx2 ~]$ aplay -D hdmi:CARD=NVidia_1,DEV=1
> > Shamisen-C4.wav ALSA lib confmisc.c:1286:(snd_func_refer) Unable to find
> > definition
> > 'cards.HDA-Intel.pcm.hdmi.1:CARD=NVidia_1,AES0=4,AES1=130,AES2=0,AES3=2'
> 
> Have you updated the HDA-Intel.conf file in the /usr/share/alsa/cards
> directory? There should be definition of:
> 
> HDA-Intel.pcm.hdmi.1 {
>          @args [ CARD AES0 AES1 AES2 AES3 ]
>          @args.CARD { type string }
>          @args.AES0 { type integer }
>          @args.AES1 { type integer }
>          @args.AES2 { type integer }
>          @args.AES3 { type integer }
>          @func refer
>          name {
> 
> ....
> 
> }

Ah, I has not installed the library, but was just pointing LD_LIBRARY_PATH at
alsa-lib/src/libs/. Once I ran "make install" and picked up that new config
file, "aplay -L" does list everything I expect it to.

Thanks very much.

> This addition is recent:
> 
> commit e6d5dcf1f625984605d362338d71162de45a6c60
> Author: Anssi Hannula <anssi.hannula@iki.fi>
> Date:   Tue Aug 3 20:27:49 2010 +0300
> 
>      HDA-Intel: present all 4 HDMI outputs instead of just the first one
> 
>      Commit 92608badc519a8c1f65d93743396517aaa582b53 in linux kernel added
>      the possibility of 3 additional HDMI devices on indexes 7-9.
> 
>      Present all those additional devices using the "hdmi" alias as well.
> 
>      Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
>      Signed-off-by: Takashi Iwai <tiwai@suse.de>

-- 
nvpublic

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2010-08-23 16:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-19 22:12 aplay -l vs. aplay -L: Missing PCMs? Stephen Warren
2010-08-20  1:28 ` Raymond Yau
2010-08-20  8:34 ` Jaroslav Kysela
2010-08-20 17:08   ` Stephen Warren
2010-08-20 20:21     ` Jaroslav Kysela
2010-08-20 20:35       ` Stephen Warren
2010-08-21  5:56         ` Jaroslav Kysela
2010-08-23 16:30           ` Stephen Warren

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.