alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: "Pharaoh ." <pharaoh137@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: alsa-devel@alsa-project.org
Subject: Re: Query regarding snd_pcm_lib_preallocate_pages_for_all()
Date: Wed, 14 Nov 2007 17:43:21 +0530	[thread overview]
Message-ID: <61445c750711140413m74c1a136q42044275d9c8a293@mail.gmail.com> (raw)
In-Reply-To: <s5hd4udfdla.wl%tiwai@suse.de>

On Nov 14, 2007 1:44 PM, Takashi Iwai <tiwai@suse.de> wrote:

> At Wed, 14 Nov 2007 00:12:07 +0530,
> Pharaoh . wrote:
> >
> > Hi,
> >
> > I am trying to use snd_pcm_lib_preallocate_pages_for_all() on an arm
> based
> > platform for preallocating the DMA buffer.
> > I am using it as
> >
> > snd_pcm_lib_preallocate_pages_for_all(pcm,
> >             SNDRV_DMA_TYPE_DEV,
> >             NULL,
> >             64 * 1024, 64 * 1024);
> >
> > since I dont know what should be passed as the 3'rd param. I tried
> passing
> > my device pointer i.e. card->dev after
> > correctly populating it but I get an error as 'DMA coherent mask in not
> set'
> > and buffer is not allocated.
>
> For ARM, avoid the present buffer-preallocation and mmap functions in
> ALSA core.  Instead you can allocate the buffers directly via normal
> dma_alloc_coherent() in your driver.  And, mmap it via
> dma_mmap_coherent() by defining the own mmap callback for PCM ops.
>
> See other arm/* drivers for rerecence.
>
>
> Takashi
>

Yes, I am using my own buffer preallocation scheme now. I allocate a 128K
buffer using dma_alloc_coherent in probe and free it only in remove i.e. at
rmmod time.

I dont think keeping a huge buffer like this till driver removal is a good
idea but when I allocate/deallocate it in hw_params/hw_free respectively, it
is causing fragmentation and sometimes the allocation fails. Do you think
anything better can
be done?

-pharaoh.

  reply	other threads:[~2007-11-14 12:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-13 18:42 Query regarding snd_pcm_lib_preallocate_pages_for_all() Pharaoh .
2007-11-13 20:31 ` Mitac 8252D hda_intel glv
2007-11-14  8:14 ` Query regarding snd_pcm_lib_preallocate_pages_for_all() Takashi Iwai
2007-11-14 12:13   ` Pharaoh . [this message]
2007-11-14  9:10     ` 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=61445c750711140413m74c1a136q42044275d9c8a293@mail.gmail.com \
    --to=pharaoh137@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=tiwai@suse.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).