All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Harsha, Priya" <priya.harsha@intel.com>
Cc: "alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>
Subject: Re: clarification on mmap
Date: Tue, 24 Feb 2009 07:46:11 +0100	[thread overview]
Message-ID: <s5hwsbgqqmk.wl%tiwai@suse.de> (raw)
In-Reply-To: <98769532B4BB14429434178695419EAE31FD01A2@bgsmsx501.gar.corp.intel.com>

At Tue, 24 Feb 2009 10:24:19 +0530,
Harsha, Priya wrote:
> 
> Thanks Takashi. Then what would be the best way to know when the
> mmaped buffer has been filled. So that I can take action to send it
> to the hardware? 

In the current ALSA design, mmap transfer is completely asynchronous.
The driver doesn't take care when app_ptr is updated.  It's checked
only when the hw_ptr is updated in snd_pcm_period_elapsed().  So, in
general, what the card driver needs is to provide the ISR calling
snd_pcm_period_elapsed() appropriately and, if possible, to provide
the accurate PCM pointer callback to give the updated hw_ptr.

In mmap mode, other any transfer to the hardware is supposed to be
done by the hardware (DMA) more or less automatically.  If you need to
do it by yourself, mmap isn't always the right answer.

> Should I use the runtime->control->appl_ptr or
> runtime->status->appl_ptr to get the position the app has filled? 

appl_ptr exists only in runtime->control.


HTH,

Takashi

> -----Original Message-----
> From: Takashi Iwai [mailto:tiwai@suse.de] 
> Sent: Tuesday, February 24, 2009 12:55 AM
> To: Harsha, Priya
> Cc: alsa-devel@alsa-project.org
> Subject: Re: clarification on mmap
> 
> At Mon, 23 Feb 2009 22:21:24 +0530,
> Harsha, Priya wrote:
> > 
> > Thank you. Can I use .ack callback to know that the mmaped buffer
> > has been filled by the user?
> 
> Not really.  It's just for explicit read/write modes.
> 
> > How would I know how much the user has
> > written into the buffer that time?
> 
> You can check appl_ptr at any time.  This corresponds to the position
> the app has filled.
> 
> 
> Takashi
> 
> > Would I need to have the pointers
> > calculated and tracked myself or is there a field in the structures
> > that I can read and find out? 
> > 
> > -----Original Message-----
> > From: Takashi Iwai [mailto:tiwai@suse.de] 
> > Sent: Monday, February 23, 2009 8:57 PM
> > To: Harsha, Priya
> > Cc: alsa-devel@alsa-project.org
> > Subject: Re: clarification on mmap
> > 
> > At Mon, 23 Feb 2009 18:59:11 +0530,
> > Harsha, Priya wrote:
> > > 
> > > Hi,
> > > 
> > > I have a question on mmap. If I give my .info to be _MMAP and
> > > _MMAP_VALID. Will ALSA framework internally take care of mmap-ing
> > > the kernel buffer that has been pre-allocated in the .probe call? Do
> > > I need to do anything special to mmap a kernel buffer into user
> > > space? Just accessing the runtime->dma_area would allow me to access
> > > user data right? 
> > 
> > Yes.  The buffers allocated via preallocator are supposed to be
> > mmappable, so you can simply pass _MMAP* flag there.
> > 
> > 
> > Takashi
> > 
> 

  parent reply	other threads:[~2009-02-24  6:46 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-21 16:59 [PATCH 0/2] Arcam AV Control Plugin Updates Peter Stokes
2009-02-23  9:35 ` Takashi Iwai
2009-02-23 13:29   ` clarification on mmap Harsha, Priya
2009-02-23 15:27     ` Takashi Iwai
2009-02-23 16:51       ` Harsha, Priya
2009-02-23 19:25         ` Takashi Iwai
2009-02-24  4:54           ` Harsha, Priya
2009-02-24  5:13             ` Harsha, Priya
2009-02-24  6:49               ` Takashi Iwai
2009-02-24  6:46             ` Takashi Iwai [this message]
2009-02-24  7:45               ` Harsha, Priya
2009-02-24 11:04                 ` Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5hwsbgqqmk.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=priya.harsha@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.