linux-stable/include/uapi/sound
Takashi Iwai 42f945970a ALSA: pcm: Add the explicit appl_ptr sync support
Currently x86 platforms use the PCM status/control mmaps for
transferring the PCM status and appl_ptr between kernel and
user-spaces.  The mmap is a most efficient way of communication, but
it has a drawback per its nature, namely, it can't notify the change
explicitly to kernel.

The lack of appl_ptr update notification is a problem on a few
existing drivers, but it's mostly a small issue and negligible.
However, a new type of driver that uses DSP for a deep buffer
management requires the exact position of appl_ptr for calculating the
buffer prefetch size, and the asynchronous appl_ptr update between
kernel and user-spaces becomes a significant problem for it.

How can we enforce user-space to report the appl_ptr update?  The way
is relatively simple.  Just by disabling the PCM control mmap, the
user-space is supposed to fall back to the mode using SYNC_PTR ioctl,
and the kernel gets control over that.  This fallback mode is used in
all non-x86 platforms as default, and also in the 32bit compatible
model on all platforms including x86.  It's been implemented already
over a decade, so we can say it's fairly safe and stably working.

With the help of the knowledge above, this patch introduces a new PCM
info flag SNDRV_PCM_INFO_SYNC_APPLPTR for achieving the appl_ptr sync
from user-space.  When a driver sets this flag at open, the PCM status
/ control mmap is disabled, which effectively switches to SYNC_PTR
mode in user-space side.

In this version, both PCM status and control mmaps are disabled
although only the latter, control mmap, is the target.  It's because
the current alsa-lib implementation supposes that both status and
control mmaps are always coupled, thus it handles a fatal error when
only one of them fails.

Of course, the disablement of the status/control mmaps may bring a
slight performance overhead.  Thus, as of now, this should be used
only for the dedicated devices that deserves.

Note that the disablement of mmap is a sort of workaround.  In the
later patch, we'll introduce the way to identify the protocol version
alsa-lib supports, and keep mmap working while the sync_ptr is
performed together.

Reviewed-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2017-06-23 15:39:47 +02:00
..
asequencer.h ALSA: seq: Provide card number / PID via sequencer client info 2016-03-08 10:52:52 +01:00
asoc.h Merge remote-tracking branches 'asoc/topic/tlv320aic31xx', 'asoc/topic/topology', 'asoc/topic/uda1380', 'asoc/topic/wm2200' and 'asoc/topic/wm8523' into asoc-next 2016-12-12 15:53:25 +00:00
asound.h ALSA: pcm: Add the explicit appl_ptr sync support 2017-06-23 15:39:47 +02:00
asound_fm.h
compress_offload.h ALSA: Fix spelling typo in Documentation/DocBook/alsa-driver-api.xml 2015-03-04 12:12:59 +01:00
compress_params.h ALSA: compress: Add SND_AUDIOCODEC_BESPOKE 2015-12-23 00:20:50 +00:00
emu10k1.h ALSA: emu10k1: added EMU10K1 version of DECLARE_BITMAP macro for UAPI 2015-10-15 10:02:26 +02:00
firewire.h ALSA: fireface: add hwdep interface 2017-04-05 21:31:49 +02:00
hdsp.h
hdspm.h ALSA: hdspm: use __u8, __u32 and __u64 from linux/types.h instead of stdint.h 2015-10-15 10:03:11 +02:00
sb16_csp.h
sfnt_info.h
snd_sst_tokens.h ASoC: Intel: Skylake: Add support for specifying D0i3 configuration 2016-11-03 11:14:41 -06:00
tlv.h ALSA: control: cage TLV_DB_RANGE_HEAD in kernel land because it was obsoleted 2016-09-25 22:16:49 +02:00
usb_stream.h ALSA: usx2y: Move UAPI definition into include/uapi/sound/usb_stream.h 2015-01-28 17:33:49 +01:00