All of lore.kernel.org
 help / color / mirror / Atom feed
* Question about tsched=0 on PulseAudio
       [not found]                           ` <PS1PR0601MB1465F2D28FAA5D1B13A91A54C5E70@PS1PR0601MB1465.apcprd06.prod.outlook.com>
@ 2017-05-17  6:24                             ` Kuninori Morimoto
  2017-05-17  8:46                               ` Takashi Iwai
  0 siblings, 1 reply; 5+ messages in thread
From: Kuninori Morimoto @ 2017-05-17  6:24 UTC (permalink / raw)
  To: Linux-ALSA; +Cc: goda, HARUNOBU KUROKAWA, RYO KODAMA


Hi ALSA ML

We noticed that our PulseAudio has crackling / skipping noise
which doesn't happen on normal aplay.
And it was removed if we do below

	load-module module-hal-detect tsched=0

According to google, it say

	tsched Since 0.9.11. Use system-timer based model (aka glitch-free).
	Defaults to 1 (enabled). If your hardware does not return accurate timing
	information (e.g. Creative sound cards) you can try to set tsched=0 to
	enable the interupt based timing which was used in 0.9.10 and before.

Here, what does this "return accurate timing information" mean ?
Is it struct snd_pcm_ops::pointer ??

Best regards
---
Kuninori Morimoto

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

* Re: Question about tsched=0 on PulseAudio
  2017-05-17  6:24                             ` Question about tsched=0 on PulseAudio Kuninori Morimoto
@ 2017-05-17  8:46                               ` Takashi Iwai
  2017-05-18  5:12                                 ` Kuninori Morimoto
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2017-05-17  8:46 UTC (permalink / raw)
  To: Kuninori Morimoto; +Cc: Linux-ALSA, HARUNOBU KUROKAWA, goda, RYO KODAMA

On Wed, 17 May 2017 08:24:09 +0200,
Kuninori Morimoto wrote:
> 
> 
> Hi ALSA ML
> 
> We noticed that our PulseAudio has crackling / skipping noise
> which doesn't happen on normal aplay.
> And it was removed if we do below
> 
> 	load-module module-hal-detect tsched=0
> 
> According to google, it say
> 
> 	tsched Since 0.9.11. Use system-timer based model (aka glitch-free).
> 	Defaults to 1 (enabled). If your hardware does not return accurate timing
> 	information (e.g. Creative sound cards) you can try to set tsched=0 to
> 	enable the interupt based timing which was used in 0.9.10 and before.
> 
> Here, what does this "return accurate timing information" mean ?
> Is it struct snd_pcm_ops::pointer ??

Yes.  Also runtime->delay is taken into account.

Both information have to be accurate enough.  With tsched=1, the
period update is basically ignored and PA tries to update the buffer
at its own timing.  The samples to be updated are determined by avail
and delay values of snd_pcm_status, which are calculated from hw_ptr,
appl_ptr and delay in the kernel.

Also, such a problem might be some memory coherency issue.


Takashi

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

* Re: Question about tsched=0 on PulseAudio
  2017-05-17  8:46                               ` Takashi Iwai
@ 2017-05-18  5:12                                 ` Kuninori Morimoto
  2017-05-18  6:34                                   ` Takashi Sakamoto
  0 siblings, 1 reply; 5+ messages in thread
From: Kuninori Morimoto @ 2017-05-18  5:12 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Linux-ALSA, HARUNOBU KUROKAWA, goda, RYO KODAMA


Hi Takashi-san

> > We noticed that our PulseAudio has crackling / skipping noise
> > which doesn't happen on normal aplay.
> > And it was removed if we do below
> > 
> > 	load-module module-hal-detect tsched=0
> > 
> > According to google, it say
> > 
> > 	tsched Since 0.9.11. Use system-timer based model (aka glitch-free).
> > 	Defaults to 1 (enabled). If your hardware does not return accurate timing
> > 	information (e.g. Creative sound cards) you can try to set tsched=0 to
> > 	enable the interupt based timing which was used in 0.9.10 and before.
> > 
> > Here, what does this "return accurate timing information" mean ?
> > Is it struct snd_pcm_ops::pointer ??
> 
> Yes.  Also runtime->delay is taken into account.
> 
> Both information have to be accurate enough.  With tsched=1, the
> period update is basically ignored and PA tries to update the buffer
> at its own timing.  The samples to be updated are determined by avail
> and delay values of snd_pcm_status, which are calculated from hw_ptr,
> appl_ptr and delay in the kernel.
> 
> Also, such a problem might be some memory coherency issue.

OK, thank you for your explanation.
My current driver updates snd_pcm_ops::pointer only when DMA transfer was
finished, but I guess it needs to adjust to update it during transfer, too.
I think I can use dmaengine_tx_status() for this purpose.
I don't know how to know about delay, but I will try update pointer as 1st step.

Best regards
---
Kuninori Morimoto

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

* Re: Question about tsched=0 on PulseAudio
  2017-05-18  5:12                                 ` Kuninori Morimoto
@ 2017-05-18  6:34                                   ` Takashi Sakamoto
  2017-05-18  8:16                                     ` Kuninori Morimoto
  0 siblings, 1 reply; 5+ messages in thread
From: Takashi Sakamoto @ 2017-05-18  6:34 UTC (permalink / raw)
  To: Kuninori Morimoto, Takashi Iwai
  Cc: Linux-ALSA, HARUNOBU KUROKAWA, goda, RYO KODAMA

Hi,

On May 18 2017 14:12, Kuninori Morimoto wrote:
>> Both information have to be accurate enough.  With tsched=1, the
>> period update is basically ignored and PA tries to update the buffer
>> at its own timing.  The samples to be updated are determined by avail
>> and delay values of snd_pcm_status, which are calculated from hw_ptr,
>> appl_ptr and delay in the kernel.
>>
>> Also, such a problem might be some memory coherency issue.
> 
> OK, thank you for your explanation.
> My current driver updates snd_pcm_ops::pointer only when DMA transfer was
> finished, but I guess it needs to adjust to update it during transfer, too.
> I think I can use dmaengine_tx_status() for this purpose.
> I don't know how to know about delay, but I will try update pointer as 1st step.

If your driver calls 'snd_pcm_period_elapsed()' in any hw/sw IRQ 
context, it's correct. But 'struct snd_pcm_ops.pointer' callback is not 
only executed by the function, but also in the other contexts such as 
ioctl(2) with HWSYNC.

In design of ALSA PCM core, the callback is expected to return the 
number of PCM frames currently transferred via physical audio serial 
bus, inner PCM period boundary. As long as I know, recent hardwares have 
any register for this purpose and your driver could calculate the number.

The 'accuracy' represents how accurate the returned number is, against 
actual transferring via audio serial bus.


Regards

Takashi Sakamoto

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

* Re: Question about tsched=0 on PulseAudio
  2017-05-18  6:34                                   ` Takashi Sakamoto
@ 2017-05-18  8:16                                     ` Kuninori Morimoto
  0 siblings, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2017-05-18  8:16 UTC (permalink / raw)
  To: Takashi Sakamoto
  Cc: Takashi Iwai, Linux-ALSA, HARUNOBU KUROKAWA, goda, RYO KODAMA


Hi Takashi-san

# Oops !?
# You and Iwai-san are both same name :)

> > OK, thank you for your explanation.
> > My current driver updates snd_pcm_ops::pointer only when DMA transfer was
> > finished, but I guess it needs to adjust to update it during transfer, too.
> > I think I can use dmaengine_tx_status() for this purpose.
> > I don't know how to know about delay, but I will try update pointer as 1st step.
> 
> If your driver calls 'snd_pcm_period_elapsed()' in any hw/sw IRQ
> context, it's correct. But 'struct snd_pcm_ops.pointer' callback is
> not only executed by the function, but also in the other contexts such
> as ioctl(2) with HWSYNC.
> 
> In design of ALSA PCM core, the callback is expected to return the
> number of PCM frames currently transferred via physical audio serial
> bus, inner PCM period boundary. As long as I know, recent hardwares
> have any register for this purpose and your driver could calculate the
> number.
> 
> The 'accuracy' represents how accurate the returned number is, against
> actual transferring via audio serial bus.

Thank you for your detail explanation.
I will adjust my driver

Best regards
---
Kuninori Morimoto

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

end of thread, other threads:[~2017-05-18  8:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <PS1PR0601MB1978795B8EE52CB3A0253554CA100@PS1PR0601MB1978.apcprd06.prod.outlook.com>
     [not found] ` <87d1byqqa5.wl%kuninori.morimoto.gx@renesas.com>
     [not found]   ` <87r300cf02.wl%kuninori.morimoto.gx@renesas.com>
     [not found]     ` <PS1PR06MB1241103FE77F4706D679A235ADEE0@PS1PR06MB1241.apcprd06.prod.outlook.com>
     [not found]       ` <8760harjtm.wl%kuninori.morimoto.gx@renesas.com>
     [not found]         ` <PS1PR06MB124156C9F611D96128825A6BADEF0@PS1PR06MB1241.apcprd06.prod.outlook.com>
     [not found]           ` <PS1PR06MB1241F6959A19BE376A797FA9ADEF0@PS1PR06MB1241.apcprd06.prod.outlook.com>
     [not found]             ` <87vap98ts3.wl%kuninori.morimoto.gx@renesas.com>
     [not found]               ` <87r2zx8rgl.wl%kuninori.morimoto.gx@renesas.com>
     [not found]                 ` <PS1PR0601MB146593D08C0AD21D7D2A12F1C5EC0@PS1PR0601MB1465.apcprd06.prod.outlook.com>
     [not found]                   ` <PS1PR06MB1241467C302DA407BB614AF8ADED0@PS1PR06MB1241.apcprd06.prod.outlook.com>
     [not found]                     ` <PS1PR0601MB1465277CACFBC4551F5C7F6CC5ED0@PS1PR0601MB1465.apcprd06.prod.outlook.com>
     [not found]                       ` <PS1PR06MB1241943FA1439E6AE04286B8ADE20@PS1PR06MB1241.apcprd06.prod.outlook.com>
     [not found]                         ` <87r2zo49qu.wl%kuninori.morimoto.gx@renesas.com>
     [not found]                           ` <PS1PR0601MB1465F2D28FAA5D1B13A91A54C5E70@PS1PR0601MB1465.apcprd06.prod.outlook.com>
2017-05-17  6:24                             ` Question about tsched=0 on PulseAudio Kuninori Morimoto
2017-05-17  8:46                               ` Takashi Iwai
2017-05-18  5:12                                 ` Kuninori Morimoto
2017-05-18  6:34                                   ` Takashi Sakamoto
2017-05-18  8:16                                     ` Kuninori Morimoto

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.