From 1b86cf34603043006368c669d02805347d845c62 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Tue, 12 Jul 2011 17:27:46 +0200 Subject: [PATCH] --- yaml --- r: 257773 b: refs/heads/master c: acfa634f7e199193ec28282e82a5a6dd8edebcb7 h: refs/heads/master i: 257771: 45a538e1edfc9313f1e5b4b3b4ac59f958205c16 v: v3 --- [refs] | 2 +- trunk/sound/pci/hda/Kconfig | 13 +++++++++++++ trunk/sound/pci/hda/hda_intel.c | 8 +++++++- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/[refs] b/[refs] index 397f20c0a980..1af64637ce30 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 30b4503378c976cf66201a1e81820519f6bd79ac +refs/heads/master: acfa634f7e199193ec28282e82a5a6dd8edebcb7 diff --git a/trunk/sound/pci/hda/Kconfig b/trunk/sound/pci/hda/Kconfig index 70762fca57ee..1f1a4ae4b791 100644 --- a/trunk/sound/pci/hda/Kconfig +++ b/trunk/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/trunk/sound/pci/hda/hda_intel.c b/trunk/sound/pci/hda/hda_intel.c index 25619cd18831..5ce9531cba67 100644 --- a/trunk/sound/pci/hda/hda_intel.c +++ b/trunk/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; }