On 05/23/2018 07:00 AM, Takashi Sakamoto wrote:
Hi,
On May 14 2018 15:27, Oleksandr Andrushchenko wrote:
diff --git a/sound/xen/xen_snd_front_alsa.c
b/sound/xen/xen_snd_front_alsa.c
new file mode 100644 index 000000000000..5041f83e98d2 --- /dev/null +++ b/sound/xen/xen_snd_front_alsa.c ... +/*
- FIXME: The mmaped data transfer is asynchronous and there is no
- ack signal from user-space when it is done. This is the
- reason it is not implemented in the PV driver as we do need
- to know when the buffer can be transferred to the backend.
- */
...
In ALSA PCM interface v2.0.14 or later, SNDRV_PCM_INFO_SYNC_APPLPTR is available. This flag express that userspace applications are expected to call ioctl(2) with 'SNDRV_PCM_IOCTL_SYNC_PTR' even if they oprate to memory mapped page frames for PCM samples. For detail, please refer to a commit 42f945970af9 ('ALSA: pcm: Add the explicit appl_ptr sync support')[1].
As a supplement, please refer to below commits: * 4b671f577474 ('ALSA: pcm: Add an ioctl to specify the supported protocol version')[2] * b602aa8eb1a0 ('ALSA: pcm: Disable only control mmap for explicit appl_ptr sync')[3]
Alsa-lib v1.1.5 or later supports this flag and existent applications can run transparently.
For developers, a tracepoint may be useful: * fccf53881e9b ('ALSA: pcm: add 'applptr' event of tracepoint')[4]
For your information.
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... [4] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
Oh, this is very useful, thank you so much for such a detailed description. I'll take a close look at the above and see if Xen sound driver can benefit from this.
Regards
Takashi Sakamoto
Thank you very much, Oleksandr