All of lore.kernel.org
 help / color / mirror / Atom feed
* snd_pcm_hw_params_get_period_size() returning 0
@ 2006-04-01  1:00 Carlos Munoz
  2006-04-01  1:57 ` Lee Revell
  2006-04-01  1:59 ` Lee Revell
  0 siblings, 2 replies; 10+ messages in thread
From: Carlos Munoz @ 2006-04-01  1:00 UTC (permalink / raw)
  To: alsa-devel

Hi all,

I tested my new driver with a simple application I wrote. I can play and 
record pcm files with no problem. However, I'm unable to get aplay to 
work. aplay just hangs. I was able to trace it to aplay.c:playback_go(). 
aplay is stuck in the while loop. After closer examination it turns out 
that the reason is because previously 
snd_pcm_hw_params_get_period_size() had set the period size to 0. Does 
any one know why
snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
something the driver did/didn't do ?

Thanks,


Carlos


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-01  1:00 snd_pcm_hw_params_get_period_size() returning 0 Carlos Munoz
@ 2006-04-01  1:57 ` Lee Revell
  2006-04-01  1:59 ` Lee Revell
  1 sibling, 0 replies; 10+ messages in thread
From: Lee Revell @ 2006-04-01  1:57 UTC (permalink / raw)
  To: Carlos Munoz; +Cc: alsa-devel

On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
> Does 
> any one know why
> snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
> something the driver did/didn't do ?
> 

Your hw_params callback should have set this to a correct value, try
adding printks.

Lee



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-01  1:00 snd_pcm_hw_params_get_period_size() returning 0 Carlos Munoz
  2006-04-01  1:57 ` Lee Revell
@ 2006-04-01  1:59 ` Lee Revell
  2006-04-01  2:20   ` Carlos Munoz
  1 sibling, 1 reply; 10+ messages in thread
From: Lee Revell @ 2006-04-01  1:59 UTC (permalink / raw)
  To: Carlos Munoz; +Cc: alsa-devel

On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
> Does 
> any one know why
> snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
> something the driver did/didn't do ?
> 

Argh, please disregard last message, that's not how the hw_params
callback works :-(

Lee



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-01  1:59 ` Lee Revell
@ 2006-04-01  2:20   ` Carlos Munoz
  2006-04-03 10:22     ` Takashi Iwai
  0 siblings, 1 reply; 10+ messages in thread
From: Carlos Munoz @ 2006-04-01  2:20 UTC (permalink / raw)
  To: Lee Revell; +Cc: alsa-devel

Lee Revell wrote:

>On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
>  
>
>>Does 
>>any one know why
>>snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
>>something the driver did/didn't do ?
>>
>>    
>>
>
>Argh, please disregard last message, that's not how the hw_params
>callback works :-(
>
>Lee
>
>  
>
Hi Lee,

I digged further and this is what I found.

snd_pcm_hw_params_get_period_size(...., int *val) does retrieve the 
correct period size and updates val with it. However, val does not match 
the address passed to it. I mean the caller of 
snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the address of 
where the period size is to be stored as 0x41becc but 
snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's where it 
puts the period size.

This is on the Renesas SH7343 processor. alsa-lib is a dynamic library. 
Should I expect the variable address be the same ?

Thanks,


Carlos


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-01  2:20   ` Carlos Munoz
@ 2006-04-03 10:22     ` Takashi Iwai
  2006-04-03 17:46       ` Carlos Munoz
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2006-04-03 10:22 UTC (permalink / raw)
  To: Carlos Munoz; +Cc: Lee Revell, alsa-devel

At Fri, 31 Mar 2006 18:20:42 -0800,
Carlos Munoz wrote:
> 
> Lee Revell wrote:
> 
> >On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
> >  
> >
> >>Does 
> >>any one know why
> >>snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
> >>something the driver did/didn't do ?
> >>
> >>    
> >>
> >
> >Argh, please disregard last message, that's not how the hw_params
> >callback works :-(
> >
> >Lee
> >
> >  
> >
> Hi Lee,
> 
> I digged further and this is what I found.
> 
> snd_pcm_hw_params_get_period_size(...., int *val) does retrieve the 
> correct period size and updates val with it. However, val does not match 
> the address passed to it. I mean the caller of 
> snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the address of 
> where the period size is to be stored as 0x41becc but 
> snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's where it 
> puts the period size.
> 
> This is on the Renesas SH7343 processor. alsa-lib is a dynamic library. 
> Should I expect the variable address be the same ?

No.  They must be different.  The value is stored to the original
address only when no error returns.  Unless that, a temporary variable
is used.  That's why you see two distinct addresses.


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-03 10:22     ` Takashi Iwai
@ 2006-04-03 17:46       ` Carlos Munoz
  2006-04-03 18:33         ` Takashi Iwai
  0 siblings, 1 reply; 10+ messages in thread
From: Carlos Munoz @ 2006-04-03 17:46 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Lee Revell, alsa-devel

Takashi Iwai wrote:

>At Fri, 31 Mar 2006 18:20:42 -0800,
>Carlos Munoz wrote:
>  
>
>>Lee Revell wrote:
>>
>>    
>>
>>>On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
>>> 
>>>
>>>      
>>>
>>>>Does 
>>>>any one know why
>>>>snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
>>>>something the driver did/didn't do ?
>>>>
>>>>   
>>>>
>>>>        
>>>>
>>>Argh, please disregard last message, that's not how the hw_params
>>>callback works :-(
>>>
>>>Lee
>>>
>>> 
>>>
>>>      
>>>
>>Hi Lee,
>>
>>I digged further and this is what I found.
>>
>>snd_pcm_hw_params_get_period_size(...., int *val) does retrieve the 
>>correct period size and updates val with it. However, val does not match 
>>the address passed to it. I mean the caller of 
>>snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the address of 
>>where the period size is to be stored as 0x41becc but 
>>snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's where it 
>>puts the period size.
>>
>>This is on the Renesas SH7343 processor. alsa-lib is a dynamic library. 
>>Should I expect the variable address be the same ?
>>    
>>
>
>No.  They must be different.  The value is stored to the original
>address only when no error returns.  Unless that, a temporary variable
>is used.  That's why you see two distinct addresses.
>
>
>Takashi
>
>
>  
>
Hi Takashi,

I understand what you are saying. However, this is not the case here. 
The original address is wrong. I print the value of val (not _val) 
passed to snd_pcm_hw_params_get_period_size() and it is wrong. See the code:

#ifndef DOXYGEN
int INTERNAL(snd_pcm_hw_params_get_period_size)(const 
snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
#else
int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, 
snd_pcm_uframes_t *val, int *dir)
#endif
{
    unsigned int _val;
    printf("alsa-lib:snd_pcm_hw_params_get_period_size() - params=%p 
val=%p dir=%p\n",
           params, val, dir);
    int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, 
&_val, dir);
    if (err >= 0)
        *val = _val;

    return err;
}


This printf shows val has an incorrect value (dir is also incorrect). I 
don't think it's related to the alsa-lib but maybe a problem with our 
build tool chain.

Thanks,


Carlos Munoz


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-03 17:46       ` Carlos Munoz
@ 2006-04-03 18:33         ` Takashi Iwai
  2006-04-03 18:38           ` Jaroslav Kysela
  0 siblings, 1 reply; 10+ messages in thread
From: Takashi Iwai @ 2006-04-03 18:33 UTC (permalink / raw)
  To: Carlos Munoz; +Cc: Lee Revell, alsa-devel

At Mon, 03 Apr 2006 10:46:34 -0700,
Carlos Munoz wrote:
> 
> Takashi Iwai wrote:
> 
> >At Fri, 31 Mar 2006 18:20:42 -0800,
> >Carlos Munoz wrote:
> >  
> >
> >>Lee Revell wrote:
> >>
> >>    
> >>
> >>>On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
> >>> 
> >>>
> >>>      
> >>>
> >>>>Does 
> >>>>any one know why
> >>>>snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
> >>>>something the driver did/didn't do ?
> >>>>
> >>>>   
> >>>>
> >>>>        
> >>>>
> >>>Argh, please disregard last message, that's not how the hw_params
> >>>callback works :-(
> >>>
> >>>Lee
> >>>
> >>> 
> >>>
> >>>      
> >>>
> >>Hi Lee,
> >>
> >>I digged further and this is what I found.
> >>
> >>snd_pcm_hw_params_get_period_size(...., int *val) does retrieve the 
> >>correct period size and updates val with it. However, val does not match 
> >>the address passed to it. I mean the caller of 
> >>snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the address of 
> >>where the period size is to be stored as 0x41becc but 
> >>snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's where it 
> >>puts the period size.
> >>
> >>This is on the Renesas SH7343 processor. alsa-lib is a dynamic library. 
> >>Should I expect the variable address be the same ?
> >>    
> >>
> >
> >No.  They must be different.  The value is stored to the original
> >address only when no error returns.  Unless that, a temporary variable
> >is used.  That's why you see two distinct addresses.
> >
> >
> >Takashi
> >
> >
> >  
> >
> Hi Takashi,
> 
> I understand what you are saying. However, this is not the case here. 
> The original address is wrong. I print the value of val (not _val) 
> passed to snd_pcm_hw_params_get_period_size() and it is wrong. See the code:
> 
> #ifndef DOXYGEN
> int INTERNAL(snd_pcm_hw_params_get_period_size)(const 
> snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
> #else
> int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, 
> snd_pcm_uframes_t *val, int *dir)
> #endif
> {
>     unsigned int _val;
>     printf("alsa-lib:snd_pcm_hw_params_get_period_size() - params=%p 
> val=%p dir=%p\n",
>            params, val, dir);
>     int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, 
> &_val, dir);
>     if (err >= 0)
>         *val = _val;
> 
>     return err;
> }
> 
> 
> This printf shows val has an incorrect value (dir is also incorrect). I 
> don't think it's related to the alsa-lib but maybe a problem with our 
> build tool chain.

OK, let me know if it turnes out to be a bug in alsa-lib :)


Takashi


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-03 18:33         ` Takashi Iwai
@ 2006-04-03 18:38           ` Jaroslav Kysela
  2006-04-03 19:37             ` Carlos Munoz
  0 siblings, 1 reply; 10+ messages in thread
From: Jaroslav Kysela @ 2006-04-03 18:38 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Carlos Munoz, Lee Revell, alsa-devel

On Mon, 3 Apr 2006, Takashi Iwai wrote:

> At Mon, 03 Apr 2006 10:46:34 -0700,
> Carlos Munoz wrote:
> > 
> > Takashi Iwai wrote:
> > 
> > >At Fri, 31 Mar 2006 18:20:42 -0800,
> > >Carlos Munoz wrote:
> > >  
> > >
> > >>Lee Revell wrote:
> > >>
> > >>    
> > >>
> > >>>On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
> > >>> 
> > >>>
> > >>>      
> > >>>
> > >>>>Does 
> > >>>>any one know why
> > >>>>snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
> > >>>>something the driver did/didn't do ?
> > >>>>
> > >>>>   
> > >>>>
> > >>>>        
> > >>>>
> > >>>Argh, please disregard last message, that's not how the hw_params
> > >>>callback works :-(
> > >>>
> > >>>Lee
> > >>>
> > >>> 
> > >>>
> > >>>      
> > >>>
> > >>Hi Lee,
> > >>
> > >>I digged further and this is what I found.
> > >>
> > >>snd_pcm_hw_params_get_period_size(...., int *val) does retrieve the 
> > >>correct period size and updates val with it. However, val does not match 
> > >>the address passed to it. I mean the caller of 
> > >>snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the address of 
> > >>where the period size is to be stored as 0x41becc but 
> > >>snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's where it 
> > >>puts the period size.
> > >>
> > >>This is on the Renesas SH7343 processor. alsa-lib is a dynamic library. 
> > >>Should I expect the variable address be the same ?
> > >>    
> > >>
> > >
> > >No.  They must be different.  The value is stored to the original
> > >address only when no error returns.  Unless that, a temporary variable
> > >is used.  That's why you see two distinct addresses.
> > >
> > >
> > >Takashi
> > >
> > >
> > >  
> > >
> > Hi Takashi,
> > 
> > I understand what you are saying. However, this is not the case here. 
> > The original address is wrong. I print the value of val (not _val) 
> > passed to snd_pcm_hw_params_get_period_size() and it is wrong. See the code:
> > 
> > #ifndef DOXYGEN
> > int INTERNAL(snd_pcm_hw_params_get_period_size)(const 
> > snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
> > #else
> > int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, 
> > snd_pcm_uframes_t *val, int *dir)
> > #endif
> > {
> >     unsigned int _val;
> >     printf("alsa-lib:snd_pcm_hw_params_get_period_size() - params=%p 
> > val=%p dir=%p\n",
> >            params, val, dir);
> >     int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, 
> > &_val, dir);
> >     if (err >= 0)
> >         *val = _val;
> > 
> >     return err;
> > }
> > 
> > 
> > This printf shows val has an incorrect value (dir is also incorrect). I 
> > don't think it's related to the alsa-lib but maybe a problem with our 
> > build tool chain.
> 
> OK, let me know if it turnes out to be a bug in alsa-lib :)

Or binutils. What does 'nm aplay | grep snd_pcm_hw_params_get_period_size' 
show? Also, you might try to configure alsa-lib with --with-versioned=no .

						Jaroslav

-----
Jaroslav Kysela <perex@suse.cz>
Linux Kernel Sound Maintainer
ALSA Project, SUSE Labs


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-03 18:38           ` Jaroslav Kysela
@ 2006-04-03 19:37             ` Carlos Munoz
  2006-04-05 17:53               ` Carlos Munoz
  0 siblings, 1 reply; 10+ messages in thread
From: Carlos Munoz @ 2006-04-03 19:37 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, Lee Revell, alsa-devel

Jaroslav Kysela wrote:

>On Mon, 3 Apr 2006, Takashi Iwai wrote:
>
>  
>
>>At Mon, 03 Apr 2006 10:46:34 -0700,
>>Carlos Munoz wrote:
>>    
>>
>>>Takashi Iwai wrote:
>>>
>>>      
>>>
>>>>At Fri, 31 Mar 2006 18:20:42 -0800,
>>>>Carlos Munoz wrote:
>>>> 
>>>>
>>>>        
>>>>
>>>>>Lee Revell wrote:
>>>>>
>>>>>   
>>>>>
>>>>>          
>>>>>
>>>>>>On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
>>>>>>
>>>>>>
>>>>>>     
>>>>>>
>>>>>>            
>>>>>>
>>>>>>>Does 
>>>>>>>any one know why
>>>>>>>snd_pcm_hw_params_get_period_size() would be returning 0 ? Is it 
>>>>>>>something the driver did/didn't do ?
>>>>>>>
>>>>>>>  
>>>>>>>
>>>>>>>       
>>>>>>>
>>>>>>>              
>>>>>>>
>>>>>>Argh, please disregard last message, that's not how the hw_params
>>>>>>callback works :-(
>>>>>>
>>>>>>Lee
>>>>>>
>>>>>>
>>>>>>
>>>>>>     
>>>>>>
>>>>>>            
>>>>>>
>>>>>Hi Lee,
>>>>>
>>>>>I digged further and this is what I found.
>>>>>
>>>>>snd_pcm_hw_params_get_period_size(...., int *val) does retrieve the 
>>>>>correct period size and updates val with it. However, val does not match 
>>>>>the address passed to it. I mean the caller of 
>>>>>snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the address of 
>>>>>where the period size is to be stored as 0x41becc but 
>>>>>snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's where it 
>>>>>puts the period size.
>>>>>
>>>>>This is on the Renesas SH7343 processor. alsa-lib is a dynamic library. 
>>>>>Should I expect the variable address be the same ?
>>>>>   
>>>>>
>>>>>          
>>>>>
>>>>No.  They must be different.  The value is stored to the original
>>>>address only when no error returns.  Unless that, a temporary variable
>>>>is used.  That's why you see two distinct addresses.
>>>>
>>>>
>>>>Takashi
>>>>
>>>>
>>>> 
>>>>
>>>>        
>>>>
>>>Hi Takashi,
>>>
>>>I understand what you are saying. However, this is not the case here. 
>>>The original address is wrong. I print the value of val (not _val) 
>>>passed to snd_pcm_hw_params_get_period_size() and it is wrong. See the code:
>>>
>>>#ifndef DOXYGEN
>>>int INTERNAL(snd_pcm_hw_params_get_period_size)(const 
>>>snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
>>>#else
>>>int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t *params, 
>>>snd_pcm_uframes_t *val, int *dir)
>>>#endif
>>>{
>>>    unsigned int _val;
>>>    printf("alsa-lib:snd_pcm_hw_params_get_period_size() - params=%p 
>>>val=%p dir=%p\n",
>>>           params, val, dir);
>>>    int err = snd_pcm_hw_param_get(params, SND_PCM_HW_PARAM_PERIOD_SIZE, 
>>>&_val, dir);
>>>    if (err >= 0)
>>>        *val = _val;
>>>
>>>    return err;
>>>}
>>>
>>>
>>>This printf shows val has an incorrect value (dir is also incorrect). I 
>>>don't think it's related to the alsa-lib but maybe a problem with our 
>>>build tool chain.
>>>      
>>>
>>OK, let me know if it turnes out to be a bug in alsa-lib :)
>>    
>>
>
>Or binutils. What does 'nm aplay | grep snd_pcm_hw_params_get_period_size' 
>show? Also, you might try to configure alsa-lib with --with-versioned=no .
>
>  
>
Hi Jaroslav,

Yes, using --with-versioned=no solved the problem. Now everything works. 
What does --with-versioned=no do ?

By the way the output of nm is the same for alsa-lib built  with and 
without the --with-versioned=no switch.

nm aplay | grep snd_pcm_hw_params_get_period_size
         U snd_pcm_hw_params_get_period_size@@ALSA_0.9.0rc4

Thanks,


Carlos


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

* Re: snd_pcm_hw_params_get_period_size() returning 0
  2006-04-03 19:37             ` Carlos Munoz
@ 2006-04-05 17:53               ` Carlos Munoz
  0 siblings, 0 replies; 10+ messages in thread
From: Carlos Munoz @ 2006-04-05 17:53 UTC (permalink / raw)
  To: Jaroslav Kysela; +Cc: Takashi Iwai, Lee Revell, alsa-devel

Carlos Munoz wrote:

> Jaroslav Kysela wrote:
>
>> On Mon, 3 Apr 2006, Takashi Iwai wrote:
>>
>>  
>>
>>> At Mon, 03 Apr 2006 10:46:34 -0700,
>>> Carlos Munoz wrote:
>>>   
>>>
>>>> Takashi Iwai wrote:
>>>>
>>>>     
>>>>
>>>>> At Fri, 31 Mar 2006 18:20:42 -0800,
>>>>> Carlos Munoz wrote:
>>>>>
>>>>>
>>>>>       
>>>>>
>>>>>> Lee Revell wrote:
>>>>>>
>>>>>>  
>>>>>>         
>>>>>>
>>>>>>> On Fri, 2006-03-31 at 17:00 -0800, Carlos Munoz wrote:
>>>>>>>
>>>>>>>
>>>>>>>    
>>>>>>>           
>>>>>>>
>>>>>>>> Does any one know why
>>>>>>>> snd_pcm_hw_params_get_period_size() would be returning 0 ? Is 
>>>>>>>> it something the driver did/didn't do ?
>>>>>>>>
>>>>>>>>  
>>>>>>>>
>>>>>>>>      
>>>>>>>>             
>>>>>>>
>>>>>>> Argh, please disregard last message, that's not how the hw_params
>>>>>>> callback works :-(
>>>>>>>
>>>>>>> Lee
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>    
>>>>>>>           
>>>>>>
>>>>>> Hi Lee,
>>>>>>
>>>>>> I digged further and this is what I found.
>>>>>>
>>>>>> snd_pcm_hw_params_get_period_size(...., int *val) does retrieve 
>>>>>> the correct period size and updates val with it. However, val 
>>>>>> does not match the address passed to it. I mean the caller of 
>>>>>> snd_pcm_hw_params_get_period_size(.... 0x41becc) passes the 
>>>>>> address of where the period size is to be stored as 0x41becc but 
>>>>>> snd_pcm_hw_params_get_period_size() gets 0x7b83c0d8 and that's 
>>>>>> where it puts the period size.
>>>>>>
>>>>>> This is on the Renesas SH7343 processor. alsa-lib is a dynamic 
>>>>>> library. Should I expect the variable address be the same ?
>>>>>>  
>>>>>>         
>>>>>
>>>>> No.  They must be different.  The value is stored to the original
>>>>> address only when no error returns.  Unless that, a temporary 
>>>>> variable
>>>>> is used.  That's why you see two distinct addresses.
>>>>>
>>>>>
>>>>> Takashi
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>       
>>>>
>>>> Hi Takashi,
>>>>
>>>> I understand what you are saying. However, this is not the case 
>>>> here. The original address is wrong. I print the value of val (not 
>>>> _val) passed to snd_pcm_hw_params_get_period_size() and it is 
>>>> wrong. See the code:
>>>>
>>>> #ifndef DOXYGEN
>>>> int INTERNAL(snd_pcm_hw_params_get_period_size)(const 
>>>> snd_pcm_hw_params_t *params, snd_pcm_uframes_t *val, int *dir)
>>>> #else
>>>> int snd_pcm_hw_params_get_period_size(const snd_pcm_hw_params_t 
>>>> *params, snd_pcm_uframes_t *val, int *dir)
>>>> #endif
>>>> {
>>>>    unsigned int _val;
>>>>    printf("alsa-lib:snd_pcm_hw_params_get_period_size() - params=%p 
>>>> val=%p dir=%p\n",
>>>>           params, val, dir);
>>>>    int err = snd_pcm_hw_param_get(params, 
>>>> SND_PCM_HW_PARAM_PERIOD_SIZE, &_val, dir);
>>>>    if (err >= 0)
>>>>        *val = _val;
>>>>
>>>>    return err;
>>>> }
>>>>
>>>>
>>>> This printf shows val has an incorrect value (dir is also 
>>>> incorrect). I don't think it's related to the alsa-lib but maybe a 
>>>> problem with our build tool chain.
>>>>     
>>>
>>> OK, let me know if it turnes out to be a bug in alsa-lib :)
>>>   
>>
>>
>> Or binutils. What does 'nm aplay | grep 
>> snd_pcm_hw_params_get_period_size' show? Also, you might try to 
>> configure alsa-lib with --with-versioned=no .
>>
>>  
>>
> Hi Jaroslav,
>
> Yes, using --with-versioned=no solved the problem. Now everything 
> works. What does --with-versioned=no do ?
>
> By the way the output of nm is the same for alsa-lib built  with and 
> without the --with-versioned=no switch.
>
> nm aplay | grep snd_pcm_hw_params_get_period_size
>         U snd_pcm_hw_params_get_period_size@@ALSA_0.9.0rc4
>
Well... it's not as perfect as I thought. To get it to work, I need to 
link the alsa-utils (aplay) with an alsa-lib that has versioned enabled 
(--with-versioned=no is not passed to configure). But then, the run time 
alsa-lib must be one compiled with '--with-versioned=no'. Does anyone 
know what's going on ?

Thanks,


Carlos


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642

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

end of thread, other threads:[~2006-04-05 17:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-01  1:00 snd_pcm_hw_params_get_period_size() returning 0 Carlos Munoz
2006-04-01  1:57 ` Lee Revell
2006-04-01  1:59 ` Lee Revell
2006-04-01  2:20   ` Carlos Munoz
2006-04-03 10:22     ` Takashi Iwai
2006-04-03 17:46       ` Carlos Munoz
2006-04-03 18:33         ` Takashi Iwai
2006-04-03 18:38           ` Jaroslav Kysela
2006-04-03 19:37             ` Carlos Munoz
2006-04-05 17:53               ` Carlos Munoz

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.