[alsa-devel] [PATCH 1/3] ALSA: compress_core: Update calc_avail to use cumulative values

Vinod Koul vinod.koul at intel.com
Tue Apr 9 12:55:05 CEST 2013

On Fri, Apr 05, 2013 at 04:18:45PM +0100, Charles Keepax wrote:
> On Fri, Apr 05, 2013 at 09:51:08AM -0500, Pierre-Louis Bossart wrote:
> > On 4/5/13 3:36 AM, Charles Keepax wrote:
> >> If anything if we were looking to simplify I would be inclined to
> >> keep the cumulative values?
> >
> > That is my proposal as well, app_ptr and hw_ptr are defined as offsets  
> > but can't really be used to make the difference between buffer full and  
> > buffer empty and won't work for your implementation. I believe in the  
> > pcm case only cumulative values are used in the core.
> > Vinod, please chime in...
> Ah ok, I misunderstood. I will start having a look at what this
> would take but wait for Vinod to give some feedback before I
> upstream a new version.
Okay, historical note :)

we can normally use offsets to work and do all the calculation in the core. But
this check fails when app_ptr = hw_ptr. Here we dont know if the buffer is full
or empty :) So we need to look at cummulative values for those checks, hence the
core maintains both of these and IIRC looks at cummulative values when
calucating avail only when we hit the above condition or probably in case when
we wrap over the ring buffer.

In both memory mapped and non mapped these cases are true so I dont see why this
caluclation is specfic for memory maped DSPs. There is nothing in this case
which relies. We only use the values reported by DSP and internal counters...


More information about the Alsa-devel mailing list