* Specifying the default buffer-size for snd-hda-intel
@ 2011-07-12 16:09 Takashi Iwai
2011-07-12 18:00 ` [PATCH] ALSA: hda - fix up typos in Kconfig help for default buffer size introduced in acfa634f Paul Menzel
0 siblings, 1 reply; 5+ messages in thread
From: Takashi Iwai @ 2011-07-12 16:09 UTC (permalink / raw)
To: alsa-devel
Hi,
this was a feature requested some time ago: changing the default
buffer size of driver, specifically HD-audio.
Now I applied the patch below as a start, found in topic/hda and
master branches of sound git tree. In future, we may increase the
default size once when all distros set larger values than now.
Together with this change, I changed alsa-driver-build.git for
allowing an integer kconfig option via --with-card-options.
You can pass like
--with-card-options=hda-prealloc-size=2048
Takashi
---
From: Takashi Iwai <tiwai@suse.de>
Subject: [PATCH] ALSA: hda - Add Kconfig for the default buffer size
Add a Kconfig entry to specify the default buffer size.
Distros using PulseAudio can choose a larger value here.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/hda/Kconfig | 13 +++++++++++++
sound/pci/hda/hda_intel.c | 8 +++++++-
2 files changed, 20 insertions(+), 1 deletions(-)
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 70762fc..1f1a4ae 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -14,6 +14,19 @@ menuconfig SND_HDA_INTEL
if SND_HDA_INTEL
+config SND_HDA_PREALLOC_SIZE
+ int "Pre-allocated buffer size for HD-audio driver"
+ range 0 32768
+ default 64
+ help
+ Speficies the default pre-allocated buffer-size in kB for
+ HD-audio driver. A larger buffer (e.g. 2048) is preferred
+ for systems with PulseAudio. The default 64 is chosen just
+ from the compatibility reason.
+
+ Note that the pre-allocation size can be changed dynamically
+ via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too.
+
config SND_HDA_HWDEP
bool "Build hwdep interface for HD-audio driver"
select SND_HWDEP
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 25619cd..5ce9531 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -2075,6 +2075,8 @@ static void azx_pcm_free(struct snd_pcm *pcm)
}
}
+#define MAX_PREALLOC_SIZE (32 * 1024 * 1024)
+
static int
azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
struct hda_pcm *cpcm)
@@ -2083,6 +2085,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
struct snd_pcm *pcm;
struct azx_pcm *apcm;
int pcm_dev = cpcm->device;
+ unsigned int size;
int s, err;
if (pcm_dev >= HDA_MAX_PCMS) {
@@ -2118,9 +2121,12 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
snd_pcm_set_ops(pcm, s, &azx_pcm_ops);
}
/* buffer pre-allocation */
+ size = CONFIG_SND_HDA_PREALLOC_SIZE * 1024;
+ if (size > MAX_PREALLOC_SIZE)
+ size = MAX_PREALLOC_SIZE;
snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV_SG,
snd_dma_pci_data(chip->pci),
- 1024 * 64, 32 * 1024 * 1024);
+ size, MAX_PREALLOC_SIZE);
return 0;
}
--
1.7.6
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH] ALSA: hda - fix up typos in Kconfig help for default buffer size introduced in acfa634f
2011-07-12 16:09 Specifying the default buffer-size for snd-hda-intel Takashi Iwai
@ 2011-07-12 18:00 ` Paul Menzel
2011-07-12 18:18 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Paul Menzel @ 2011-07-12 18:00 UTC (permalink / raw)
To: alsa-devel; +Cc: Takashi Iwai
[-- Attachment #1.1: Type: text/plain, Size: 1311 bytes --]
Date: Tue, 12 Jul 2011 19:53:56 +0200
This commit is a fix up for commit acfa634f.
commit acfa634f7e199193ec28282e82a5a6dd8edebcb7
Author: Takashi Iwai <tiwai@suse.de>
Date: Tue Jul 12 17:27:46 2011 +0200
ALSA: hda - Add Kconfig for the default buffer size
Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
---
I am not sure about the singular and plural wording for »driver« and »reasons«.
---
sound/pci/hda/Kconfig | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 1f1a4ae..7489b46 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -19,10 +19,10 @@ config SND_HDA_PREALLOC_SIZE
range 0 32768
default 64
help
- Speficies the default pre-allocated buffer-size in kB for
+ Specifies the default pre-allocated buffer-size in kB for the
HD-audio driver. A larger buffer (e.g. 2048) is preferred
- for systems with PulseAudio. The default 64 is chosen just
- from the compatibility reason.
+ for systems using PulseAudio. The default 64 is chosen just
+ for compatibility reasons.
Note that the pre-allocation size can be changed dynamically
via a proc file (/proc/asound/card*/pcm*/sub*/prealloc), too.
--
1.7.5.4
[-- Attachment #1.2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] ALSA: hda - fix up typos in Kconfig help for default buffer size introduced in acfa634f
2011-07-12 18:00 ` [PATCH] ALSA: hda - fix up typos in Kconfig help for default buffer size introduced in acfa634f Paul Menzel
@ 2011-07-12 18:18 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2011-07-12 18:18 UTC (permalink / raw)
To: Paul Menzel; +Cc: alsa-devel
At Tue, 12 Jul 2011 20:00:47 +0200,
Paul Menzel wrote:
>
> Date: Tue, 12 Jul 2011 19:53:56 +0200
>
> This commit is a fix up for commit acfa634f.
>
> commit acfa634f7e199193ec28282e82a5a6dd8edebcb7
> Author: Takashi Iwai <tiwai@suse.de>
> Date: Tue Jul 12 17:27:46 2011 +0200
>
> ALSA: hda - Add Kconfig for the default buffer size
>
> Signed-off-by: Paul Menzel <paulepanter@users.sourceforge.net>
Thanks, applied now.
> ---
> I am not sure about the singular and plural wording for »driver« and »reasons«.
I leave such things to native speakers...
Takashi
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Specifying the default buffer-size for snd-hda-intel
2011-07-14 6:13 Specifying the default buffer-size for snd-hda-intel Raymond Yau
@ 2011-07-14 7:56 ` Takashi Iwai
0 siblings, 0 replies; 5+ messages in thread
From: Takashi Iwai @ 2011-07-14 7:56 UTC (permalink / raw)
To: Raymond Yau; +Cc: ALSA Development Mailing List
At Thu, 14 Jul 2011 14:13:48 +0800,
Raymond Yau wrote:
>
> > +config SND_HDA_PREALLOC_SIZE
> > + int "Pre-allocated buffer size for HD-audio driver"
> > + range 0 32768
> > + default 64
> > + help
> > + Speficies the default pre-allocated buffer-size in kB for
> > + HD-audio driver. A larger buffer (e.g. 2048) is preferred
> > + for systems with PulseAudio. The default 64 is chosen just
> > + from the compatibility reason.
> > +
>
> + range 0 32768
> - range 64 32768
>
> It seem that the minimum range cannot be zero
Zero is a valid value. Then the buffer isn't pre-allocated but
allocated at each time PCM is opened (more exactly hw_params is
called).
> Does current PA server still work with sound drivers with 64K buffer ?
Yes.
Takashi
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: Specifying the default buffer-size for snd-hda-intel
@ 2011-07-14 6:13 Raymond Yau
2011-07-14 7:56 ` Takashi Iwai
0 siblings, 1 reply; 5+ messages in thread
From: Raymond Yau @ 2011-07-14 6:13 UTC (permalink / raw)
To: ALSA Development Mailing List, Takashi Iwai
> +config SND_HDA_PREALLOC_SIZE
> + int "Pre-allocated buffer size for HD-audio driver"
> + range 0 32768
> + default 64
> + help
> + Speficies the default pre-allocated buffer-size in kB for
> + HD-audio driver. A larger buffer (e.g. 2048) is preferred
> + for systems with PulseAudio. The default 64 is chosen just
> + from the compatibility reason.
> +
+ range 0 32768
- range 64 32768
It seem that the minimum range cannot be zero
Does current PA server still work with sound drivers with 64K buffer ?
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-07-14 7:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-12 16:09 Specifying the default buffer-size for snd-hda-intel Takashi Iwai
2011-07-12 18:00 ` [PATCH] ALSA: hda - fix up typos in Kconfig help for default buffer size introduced in acfa634f Paul Menzel
2011-07-12 18:18 ` Takashi Iwai
2011-07-14 6:13 Specifying the default buffer-size for snd-hda-intel Raymond Yau
2011-07-14 7:56 ` Takashi Iwai
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.