[alsa-devel] [PATCH] ALSA: add support for disabling period irq

Takashi Iwai tiwai at suse.de
Tue Nov 2 09:22:37 CET 2010

At Tue, 2 Nov 2010 09:17:33 +0100 (CET),
Jaroslav Kysela wrote:
> On Tue, 2 Nov 2010, Takashi Iwai wrote:
> > At Mon,  1 Nov 2010 17:12:53 -0500,
> > Pierre-Louis Bossart wrote:
> >>
> >> Merged and cleaned patch based on earlier patches posted
> >> on alsa-devel by Clemens Ladisch <clemens at ladisch.de> and
> >> Pierre-Louis Bossart <pierre-louis.bossart at intel.com>
> >>
> >> This patch disables period interrupts which are not
> >> needed when the application relies on a system timer
> >> to wake-up and refill the ring buffer. The behavior of
> >> the driver is left unchanged, and interrupts are only
> >> disabled if the application requests this configuration.
> >> The behavior in case of underruns is slightly different,
> >> instead of being detected during the period interrupts the
> >> underruns are detected when the application calls
> >> snd_pcm_update_avail, which in turns forces a refresh of the
> >> hw pointer and shows the buffer is empty.
> >
> > So, this silently assumes that the applications do call
> > snd_pcm_update_avail() appropriately at the right timing?
> > If so, any sense to check XRUN in the driver at all...?
> >
> > And, even more, any sense to report the incremental position by this
> > approach?  The only reliable information in this case is the offset in
> > the ring buffer.  The linear position as the current ALSA API provides
> > isn't guaranteed without the period irq.
> We can detect the buffer size crossing using jiffies, but I agree, it's 
> something which should be added to the patch to not break hw_ptr in 
> case when the application does not call the update function in time.
> We have both values in runtime->hw_ptr_jiffies and 
> runtime->hw_ptr_buffer_jiffies.

But I thought this patch also disabled the jiffies check?

I feel that some bottom-line check is needed if we keep the linear
position over the buffer size even without the period irq.
If the app doesn't care, OK fine, the driver shouldn't care, too.
But then it doesn't make sense to keep the linear position, either.

> Also, I would remove IRQ or interrupt from the API and use something 
> like "no period ack" or so. IRQ is very hardware specific and some drivers 
> does not use direct interrupts but another timing sources for period 
> acks.
> >> +#define SNDRV_PCM_INFO_NO_PERIOD_IRQ    0x00800000      /* period interrupt can be disabled */
> #define SNDRV_PCM_INFO_NO_PERIOD_ACK	0x00800000	/* period transfer acknowledge can be disabled */

How about "period update"?
I don't mind much how it's called, though...



More information about the Alsa-devel mailing list