From: Takashi Iwai <tiwai@suse.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH] ALSA: snd-aloop: make preallocated buffer size configurable
Date: Wed, 21 Sep 2011 14:10:21 +0200 [thread overview]
Message-ID: <s5hzkhygkpe.wl%tiwai@suse.de> (raw)
In-Reply-To: <1316545332-2229-1-git-send-email-pierre-louis.bossart@linux.intel.com>
At Tue, 20 Sep 2011 14:02:12 -0500,
Pierre-Louis Bossart wrote:
>
> Default of 2MB of physically-contiguous memory can be
> too high for embedded solutions, make the size configurable.
Hm, maybe better to have an option for global limit of preallocation?
The problem is not necessarily specific to snd-aloop.
thanks,
Takashi
>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> sound/drivers/Kconfig | 15 +++++++++++++++
> sound/drivers/aloop.c | 6 +++---
> 2 files changed, 18 insertions(+), 3 deletions(-)
>
> diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
> index c896116..ad51067 100644
> --- a/sound/drivers/Kconfig
> +++ b/sound/drivers/Kconfig
> @@ -93,6 +93,21 @@ config SND_ALOOP
> To compile this driver as a module, choose M here: the module
> will be called snd-aloop.
>
> +if SND_ALOOP
> +config SND_ALOOP_PREALLOC_SIZE
> + int "Pre-allocated buffer size for aloop driver"
> + range 0 32768
> + default 2048
> + help
> + Specifies the default pre-allocated buffer-size in kB for the
> + snd-aloop driver. The default 2048 is chosen just
> + for compatibility reasons. Some distributions may want to
> + use a smaller size when only one stream is used.
> +
> + Note that the pre-allocation size can be changed dynamically
> + via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too.
> +endif
> +
> config SND_VIRMIDI
> tristate "Virtual MIDI soundcard"
> depends on SND_SEQUENCER
> diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
> index a0da775..f945573 100644
> --- a/sound/drivers/aloop.c
> +++ b/sound/drivers/aloop.c
> @@ -556,11 +556,11 @@ static struct snd_pcm_hardware loopback_pcm_hardware =
> .rate_max = 192000,
> .channels_min = 1,
> .channels_max = 32,
> - .buffer_bytes_max = 2 * 1024 * 1024,
> + .buffer_bytes_max = CONFIG_SND_ALOOP_PREALLOC_SIZE * 1024,
> .period_bytes_min = 64,
> /* note check overflow in frac_pos() using pcm_rate_shift before
> changing period_bytes_max value */
> - .period_bytes_max = 1024 * 1024,
> + .period_bytes_max = CONFIG_SND_ALOOP_PREALLOC_SIZE * 1024,
> .periods_min = 1,
> .periods_max = 1024,
> .fifo_size = 0,
> @@ -774,7 +774,7 @@ static int __devinit loopback_pcm_new(struct loopback *loopback,
>
> snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_CONTINUOUS,
> snd_dma_continuous_data(GFP_KERNEL),
> - 0, 2 * 1024 * 1024);
> + 0, CONFIG_SND_ALOOP_PREALLOC_SIZE * 1024);
> return 0;
> }
>
> --
> 1.7.6
>
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>
next prev parent reply other threads:[~2011-09-21 12:10 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-20 19:02 [PATCH] ALSA: snd-aloop: make preallocated buffer size configurable Pierre-Louis Bossart
2011-09-21 12:10 ` Takashi Iwai [this message]
2011-09-21 13:26 ` Pierre-Louis Bossart
[not found] ` <000901cc7862$115987b0$340c9710$@bossart@linux.intel.com>
2011-09-21 14:38 ` Takashi Iwai
2011-09-21 15:02 ` Pierre-Louis Bossart
[not found] ` <000f01cc786f$7a6fec00$6f4fc400$@bossart@linux.intel.com>
2011-09-21 15:45 ` Takashi Iwai
2011-09-23 21:03 ` Pierre-Louis Bossart
2011-09-24 10:20 ` 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=s5hzkhygkpe.wl%tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=pierre-louis.bossart@linux.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 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).