* Re: snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ???
@ 2010-01-21 10:18 Clemens Ladisch
2010-01-24 3:30 ` Raymond Yau
0 siblings, 1 reply; 6+ messages in thread
From: Clemens Ladisch @ 2010-01-21 10:18 UTC (permalink / raw)
To: Raymond Yau; +Cc: alsa-devel
Raymond Yau wrote:
> Is there any flags in substream which can indicate snd_xxx_hw_params() was
> called at first time since snd_xxx_hw_params() were called many times
> during OSS emulation (probing the supported rates , channels , .... ) ?
There is no such flag. It is the responsibility of the driver to track
the resources it has allocated.
If a resource does not depend on the hardware parameters, it might be
a better idea to allocate/free it in the open/close callbacks.
Best regards,
Clemens
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ???
2010-01-21 10:18 snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ??? Clemens Ladisch
@ 2010-01-24 3:30 ` Raymond Yau
2010-01-24 10:29 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Raymond Yau @ 2010-01-24 3:30 UTC (permalink / raw)
To: alsa-devel
2010/1/21 Clemens Ladisch <clemens@ladisch.de>
> Raymond Yau wrote:
> > Is there any flags in substream which can indicate snd_xxx_hw_params()
> was
> > called at first time since snd_xxx_hw_params() were called many times
> > during OSS emulation (probing the supported rates , channels , .... ) ?
>
> There is no such flag. It is the responsibility of the driver to track
> the resources it has allocated.
>
> If a resource does not depend on the hardware parameters, it might be
> a better idea to allocate/free it in the open/close callbacks.
>
>
> Best regards,
> Clemens
>
https://bugzilla.redhat.com/show_bug.cgi?id=497739
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x40
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x2060
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x3641
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x2101
Apr 26 11:20:11 localhost kernel: vortex_adb_delroutes: route not found! 0x3641
Apr 26 11:20:11 localhost kernel: vortex_adb_delroutes: route not found! 0x2101
Apr 26 11:20:11 localhost kernel: mix ALARM 0
Apr 26 11:20:11 localhost kernel: vortex_adb_delroutes: route not found! 0x3593
Apr 26 11:20:11 localhost kernel: mix ALARM 0
Apr 26 11:20:11 localhost kernel: Vortex: vortex_fifo_setadbctrl fail
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x3642
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x3743
Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x2201
Apr 26 11:20:11 localhost kernel: Vortex: vortex_fifo_setadbctrl fail
did the suspend/resume cycle call snd_xxx_hw_params() or snd_xxx_hw_free()
when the driver did not support suspend/resume ?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ???
2010-01-24 3:30 ` Raymond Yau
@ 2010-01-24 10:29 ` Takashi Iwai
0 siblings, 0 replies; 6+ messages in thread
From: Takashi Iwai @ 2010-01-24 10:29 UTC (permalink / raw)
To: Raymond Yau; +Cc: alsa-devel
At Sun, 24 Jan 2010 11:30:04 +0800,
Raymond Yau wrote:
>
> 2010/1/21 Clemens Ladisch <clemens@ladisch.de>
>
> > Raymond Yau wrote:
> > > Is there any flags in substream which can indicate snd_xxx_hw_params()
> > was
> > > called at first time since snd_xxx_hw_params() were called many times
> > > during OSS emulation (probing the supported rates , channels , .... ) ?
> >
> > There is no such flag. It is the responsibility of the driver to track
> > the resources it has allocated.
> >
> > If a resource does not depend on the hardware parameters, it might be
> > a better idea to allocate/free it in the open/close callbacks.
> >
> >
> > Best regards,
> > Clemens
> >
>
> https://bugzilla.redhat.com/show_bug.cgi?id=497739
>
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x40
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x2060
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x3641
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x2101
> Apr 26 11:20:11 localhost kernel: vortex_adb_delroutes: route not found! 0x3641
> Apr 26 11:20:11 localhost kernel: vortex_adb_delroutes: route not found! 0x2101
> Apr 26 11:20:11 localhost kernel: mix ALARM 0
> Apr 26 11:20:11 localhost kernel: vortex_adb_delroutes: route not found! 0x3593
> Apr 26 11:20:11 localhost kernel: mix ALARM 0
> Apr 26 11:20:11 localhost kernel: Vortex: vortex_fifo_setadbctrl fail
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x3642
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x3743
> Apr 26 11:20:11 localhost kernel: vortex_adb_addroutes: unending route! 0x2201
> Apr 26 11:20:11 localhost kernel: Vortex: vortex_fifo_setadbctrl fail
>
>
> did the suspend/resume cycle call snd_xxx_hw_params() or snd_xxx_hw_free()
> when the driver did not support suspend/resume ?
No. It's all driver's responsibility.
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread
* snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ???
@ 2010-01-21 4:32 Raymond Yau
2010-01-21 6:59 ` Takashi Iwai
0 siblings, 1 reply; 6+ messages in thread
From: Raymond Yau @ 2010-01-21 4:32 UTC (permalink / raw)
To: alsa-devel
Refer to
http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s06.html#pcm-interface-operators-hw-free-callback
hw_free callback
static int snd_xxx_hw_free(struct snd_pcm_substream *substream);
This is called to release the resources allocated via
*hw_params*. For example, releasing the
buffer via snd_pcm_lib_malloc_pages() is done by
calling the following:
snd_pcm_lib_free_pages(substream);
This function is always called before the close callback is called.
Also, the callback may be called multiple times, too.
Keep track whether the resource was already released.
Nearly all the examples in those ALSA tutorials in the web sites have the code
if ((err = snd_pcm_hw_params (playback_handle, hw_params)) < 0) {
fprintf (stderr, "cannot set parameters (%s)\n",
snd_strerror (err));
exit (1);
}
snd_pcm_hw_params_free (hw_params);
This seem to violate "This function is always called before the close
callback is called."
and those hardware mixing sound cards (e.g cs46xx , au88x0, ... ) use
snd_xxx_hw_free() to deallocate the hardware mixing path in the DSP.
There are a number of audio package (e.g. gstreamer , wine , .... )
call snd_pcm_hw_params_free immediately after snd_pcm_hw_params()
Is this a bug of snd_pcm_hw_params_free() not change the state of the
PCM stream ?
or
snd_pcm_prepare() did not check the buffer is already released ?
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ???
2010-01-21 4:32 Raymond Yau
@ 2010-01-21 6:59 ` Takashi Iwai
2010-01-21 9:12 ` Raymond Yau
0 siblings, 1 reply; 6+ messages in thread
From: Takashi Iwai @ 2010-01-21 6:59 UTC (permalink / raw)
To: Raymond Yau; +Cc: alsa-devel
At Thu, 21 Jan 2010 12:32:20 +0800,
Raymond Yau wrote:
>
> Refer to
> http://www.alsa-project.org/~tiwai/writing-an-alsa-driver/ch05s06.html#pcm-interface-operators-hw-free-callback
>
> hw_free callback
>
> static int snd_xxx_hw_free(struct snd_pcm_substream *substream);
>
> This is called to release the resources allocated via
> *hw_params*. For example, releasing the
> buffer via snd_pcm_lib_malloc_pages() is done by
> calling the following:
> snd_pcm_lib_free_pages(substream);
>
> This function is always called before the close callback is called.
> Also, the callback may be called multiple times, too.
> Keep track whether the resource was already released.
> Nearly all the examples in those ALSA tutorials in the web sites have the code
>
>
> if ((err = snd_pcm_hw_params (playback_handle, hw_params)) < 0) {
> fprintf (stderr, "cannot set parameters (%s)\n",
> snd_strerror (err));
> exit (1);
> }
>
> snd_pcm_hw_params_free (hw_params);
>
> This seem to violate "This function is always called before the close
> callback is called."
>
> and those hardware mixing sound cards (e.g cs46xx , au88x0, ... ) use
> snd_xxx_hw_free() to deallocate the hardware mixing path in the DSP.
>
> There are a number of audio package (e.g. gstreamer , wine , .... )
> call snd_pcm_hw_params_free immediately after snd_pcm_hw_params()
>
> Is this a bug of snd_pcm_hw_params_free() not change the state of the
> PCM stream ?
Confusingly, snd_pcm_hw_params_free() and snd_pcm_hw_free() are
different.
The former is just to free the malloced snd_pcm_hw_params struct
while the latter corresponds to snd_xxx_hw_free().
Takashi
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ???
2010-01-21 6:59 ` Takashi Iwai
@ 2010-01-21 9:12 ` Raymond Yau
0 siblings, 0 replies; 6+ messages in thread
From: Raymond Yau @ 2010-01-21 9:12 UTC (permalink / raw)
To: alsa-devel
2010/1/21 Takashi Iwai <tiwai@suse.de>
>
>
> Confusingly, snd_pcm_hw_params_free() and snd_pcm_hw_free() are
> different.
>
> The former is just to free the malloced snd_pcm_hw_params struct
> while the latter corresponds to snd_xxx_hw_free().
>
>
> Takashi
>
Is there any flags in substream which can indicate snd_xxx_hw_params() was
called at first time since snd_xxx_hw_params() were called many times
during OSS emulation (probing the supported rates , channels , .... ) ?
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2010-01-24 10:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-21 10:18 snd_pcm_hw_params_free() immediately after snd_pcm_hw_params() ??? Clemens Ladisch
2010-01-24 3:30 ` Raymond Yau
2010-01-24 10:29 ` Takashi Iwai
-- strict thread matches above, loose matches on Subject: below --
2010-01-21 4:32 Raymond Yau
2010-01-21 6:59 ` Takashi Iwai
2010-01-21 9:12 ` Raymond Yau
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.