alistair23-linux/sound
Takashi Iwai 0dba808eae ALSA: pcm: Introduce managed buffer allocation mode
This patch adds the support for the feature to automatically allocate
and free PCM buffers, so called "managed buffer allocation" mode.
It's set up via new PCM helpers, snd_pcm_set_managed_buffer() and
snd_pcm_set_managed_buffer_all(), both of which correspond to the
existing preallocator helpers, snd_pcm_lib_preallocate_pages() and
snd_pcm_lib_preallocate_pages_for_all().  When the new helper is used,
it not only performs the pre-allocation of buffers, but also it
manages to call snd_pcm_lib_malloc_pages() before the PCM hw_params
ops and snd_lib_pcm_free() after the PCM hw_free ops inside PCM core,
respectively.  This allows drivers to drop the explicit calls of the
memory allocation / release functions, and it will be a good amount of
code reduction in the end of this patch series.

When the PCM substream is set to the managed buffer allocation mode,
the managed_buffer_alloc flag is set in the substream object.  Since
some drivers want to know when a buffer is newly allocated or
re-allocated at hw_params callback (e.g. want to set up the additional
stuff for the given buffer only at allocation time), now PCM core
turns on buffer_changed flag when the buffer has changed.

The standard conversions to use the new API will be straightforward:
- Replace snd_pcm_lib_preallocate*() calls with the corresponding
  snd_pcm_set_managed_buffer*(); the arguments should be unchanged
- Drop superfluous snd_pcm_lib_malloc() and snd_pcm_lib_free() calls;
  the check of snd_pcm_lib_malloc() returns should be replaced with
  the check of runtime->buffer_changed flag.
- If hw_params or hw_free becomes empty, drop them from PCM ops

Link: https://lore.kernel.org/r/20191117085308.23915-2-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2019-11-20 19:39:54 +01:00
..
ac97
aoa ALSA: aoa: Avoid non-standard macro usage 2019-11-06 15:47:43 +01:00
arm ASoC: pxa: remove snd_pcm_ops 2019-10-08 13:47:20 +01:00
atmel
core ALSA: pcm: Introduce managed buffer allocation mode 2019-11-20 19:39:54 +01:00
drivers ALSA: aloop: Support runtime change of snd_timer via info interface 2019-11-20 19:38:30 +01:00
firewire Merge branch 'for-linus' into for-next 2019-11-07 16:27:55 +01:00
hda ALSA: hda: Disable regmap internal locking 2019-11-05 12:54:53 +01:00
i2c
isa sound: Fix Kconfig indentation 2019-10-07 03:53:03 +02:00
mips ALSA: mips: Convert to the common vmalloc memalloc 2019-11-06 15:47:43 +01:00
oss
parisc
pci ALSA: hda - Add mute led support for HP ProBook 645 G4 2019-11-20 09:42:52 +01:00
pcmcia ALSA: pdaudiocf: Convert to the common vmalloc memalloc 2019-11-06 15:47:42 +01:00
ppc
sh ALSA: sh: Remove superfluous snd_dma_continuous_data() 2019-11-06 15:47:41 +01:00
soc ASoC: cros_ec_codec: Convert to the common vmalloc memalloc 2019-11-09 18:02:53 +01:00
sparc ALSA: sparc: Remove superfluous snd_dma_continuous_data() 2019-11-06 15:47:41 +01:00
spi
synth
usb ALSA: usb-audio: Add skip_validation option 2019-11-14 18:02:38 +01:00
x86 ALSA: intel_hdmi: Remove dev_err() on platform_get_irq() failure 2019-10-25 14:43:23 +02:00
xen
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c