alsa/0008-pcm-add-mmap_begin-callback-to-snd_pcm_fast_ops_t-ap.patch
Takashi Iwai 4f970fe93d Accepting request 706089 from home:tiwai:branches:multimedia:libs
- Remove hackish modprobe install scripts for auto-loading OSS and
  sequencer modules (bsc#1136562);
  it's invoked from systemd unit file included in alsa-utils now
- Backport upstream fixes:
  0001-pcm-direct-Add-generic-hw_ptr_alignment-function-for.patch
  0002-pcm-dshare-Added-hw_ptr_alignment-option-in-configur.patch
  0003-pcm-dsnoop-Added-hw_ptr_alignment-option-in-configur.patch
  0004-pcm-file-add-support-for-infile-reading-in-non-inter.patch
  0005-pcm-file-use-snd_pcm_file_areas_read_infile-for-read.patch
  0006-pcm-file-add-missing-unlock-on-early-return.patch
  0007-ucm-Add-UCM-profile-for-CX2072X-codec-on-Baytrail-Ch.patch
  0008-pcm-add-mmap_begin-callback-to-snd_pcm_fast_ops_t-ap.patch
  0009-pcm-file-add-infile-read-support-for-mmap-mode.patch
  0010-aserver-fix-resource-leak-coverity.patch
  0011-src-conf.c-add-missing-va_end-call-coverity.patch
  0012-config-parse_string-fix-the-dynamic-buffer-allocatio.patch
  0013-control_shm-remove-duplicate-code-coverity.patch
  0014-control_shm-add-missing-socket-close-to-the-error-pa.patch
  0015-pcm-fix-memory-leak-in-_snd_pcm_parse_config_chmaps-.patch
  0016-pcm_file-call-pclose-correctly-for-popen-coverity.patch
  0017-pcm_hw-close-file-descriptor-in-the-error-path-in-sn.patch
  0018-rawmidi-use-snd_dlobj_cache_get2-in-rawmidi-open-cov.patch
  0019-rawmidi_hw-add-sanity-check-for-the-invalid-stream-a.patch
  0020-topology-various-coverity-fixes.patch
  0021-ucm-coverity-fixes.patch
  0022-pcm_file-coverity-fixes-including-double-locking.patch
  0023-topology-next-round-of-coverity-fixes.patch
  0024-pcm_file-another-locking-fix-coverity.patch
  0025-ucm-another-coverity-fix-in-uc_mgr_config_load.patch
- Drop the downstream CX2072X UCM profile, which is replaced with

OBS-URL: https://build.opensuse.org/request/show/706089
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=253
2019-05-28 18:54:09 +00:00

61 lines
2.4 KiB
Diff

From e520f454803acfdb9af5cd7224129b37904eef4a Mon Sep 17 00:00:00 2001
From: Adam Miartus <amiartus@de.adit-jv.com>
Date: Thu, 23 May 2019 15:00:39 +0200
Subject: [PATCH 08/25] pcm: add mmap_begin callback to snd_pcm_fast_ops_t api
main motivation for adding the callback is to use it to enable operation
on mmaped buffer before user access for pcm_file plugin
support for MMAP read access with masking by data from input file is not
implemented for pcm_file plugin, by adding this callback implementing
such feature can be done by rewriting next continuous portion of buffer
on each mmap_begin call
plugins like softvol use pcm_plugin interface and overwrite the buffer by
looping around it in avail_update callback, this patch hopes to simplify
the task by adding new api callback, removing the need for rewriting
pcm_file (to use pcm_plugin callbacks) and careful checking when looping
around whole mmaped buffer
Signed-off-by: Adam Miartus <amiartus@de.adit-jv.com>
Reviewed-by: Timo Wischer <twischer@de.adit-jv.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm.c | 6 ++++++
src/pcm/pcm_local.h | 1 +
2 files changed, 7 insertions(+)
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 3a71d79b278e..323926e1fc25 100644
--- a/src/pcm/pcm.c
+++ b/src/pcm/pcm.c
@@ -7129,7 +7129,13 @@ int __snd_pcm_mmap_begin(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas,
snd_pcm_uframes_t f;
snd_pcm_uframes_t avail;
const snd_pcm_channel_area_t *xareas;
+
assert(pcm && areas && offset && frames);
+
+ if (pcm->fast_ops->mmap_begin)
+ return pcm->fast_ops->mmap_begin(pcm->fast_op_arg, areas, offset, frames);
+
+ /* fallback for plugins that do not specify new callback */
xareas = snd_pcm_mmap_areas(pcm);
if (xareas == NULL)
return -EBADFD;
diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h
index d52229d8ddea..d5726eb29242 100644
--- a/src/pcm/pcm_local.h
+++ b/src/pcm/pcm_local.h
@@ -184,6 +184,7 @@ typedef struct {
int (*poll_descriptors)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space); /* locked */
int (*poll_revents)(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); /* locked */
int (*may_wait_for_avail_min)(snd_pcm_t *pcm, snd_pcm_uframes_t avail);
+ int (*mmap_begin)(snd_pcm_t *pcm, const snd_pcm_channel_area_t **areas, snd_pcm_uframes_t *offset, snd_pcm_uframes_t *frames); /* locked */
} snd_pcm_fast_ops_t;
struct _snd_pcm {
--
2.16.4