summaryrefslogtreecommitdiff
path: root/meta/recipes-multimedia
diff options
context:
space:
mode:
authorYuqing Zhu <carol.zhu@nxp.com>2016-05-04 17:46:46 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-05-09 08:03:56 +0100
commitfcd7e439497174256a5c467532aad402f4d19ca1 (patch)
treef08b5a8233e8dc0175bbfb75f64ec8e192365456 /meta/recipes-multimedia
parent9d3d76a43d27c95aac8d7a840c9c38c686b166ec (diff)
downloadopenembedded-core-fcd7e439497174256a5c467532aad402f4d19ca1.tar.gz
openembedded-core-fcd7e439497174256a5c467532aad402f4d19ca1.tar.bz2
openembedded-core-fcd7e439497174256a5c467532aad402f4d19ca1.zip
alsa-lib: Fix incorrect appl pointer when mmap_commit() returns error.
The appl pointer needs to be updated only when snd_pcm_mmap_commit() is successfully returned. Or it shouldn't be updated. This is to fix the avail_update()'s result is incorrect when returns error. Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com> Signed-off-by: Ross Burton <ross.burton@intel.com>
Diffstat (limited to 'meta/recipes-multimedia')
-rwxr-xr-xmeta/recipes-multimedia/alsa/alsa-lib/0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch137
-rw-r--r--meta/recipes-multimedia/alsa/alsa-lib_1.1.0.bb1
2 files changed, 138 insertions, 0 deletions
diff --git a/meta/recipes-multimedia/alsa/alsa-lib/0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch b/meta/recipes-multimedia/alsa/alsa-lib/0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch
new file mode 100755
index 0000000000..9fd69f301d
--- /dev/null
+++ b/meta/recipes-multimedia/alsa/alsa-lib/0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch
@@ -0,0 +1,137 @@
+From 7c424edd116e76eee6218a1e9a6ff6c4daaf2a4d Mon Sep 17 00:00:00 2001
+From: Shengjiu Wang <shengjiu.wang@freescale.com>
+Date: Wed, 6 Apr 2016 19:02:12 +0800
+Subject: [PATCH] pcm_plugin: fix appl pointer not correct when mmap_commit()
+ return error
+
+When snd_pcm_mmap_commit() return error, the appl pointer is also updated.
+which cause the avail_update()'s result wrong.
+This patch move the snd_pcm_mmap_appl_forward() to the place when
+snd_pcm_mmap_commit() is successfully returned.
+
+Upstream-Status: Submitted [https://patchwork.kernel.org/patch/8760881/]
+
+Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
+Signed-off-by: Takashi Iwai <tiwai@suse.de>
+---
+ src/pcm/pcm_plugin.c | 48 ++++++++++++++++++++++++++++++++----------------
+ 1 file changed, 32 insertions(+), 16 deletions(-)
+
+diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
+index d007e8c..940491d 100644
+--- a/src/pcm/pcm_plugin.c
++++ b/src/pcm/pcm_plugin.c
+@@ -279,18 +279,22 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
+ return -EPIPE;
+ }
+ snd_atomic_write_begin(&plugin->watom);
+- snd_pcm_mmap_appl_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+ res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
+- if (res < 0)
++ if (res < 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
++ }
+ frames -= res;
+ }
+- snd_atomic_write_end(&plugin->watom);
+- if (result <= 0)
++ if (result <= 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
++ }
++ snd_pcm_mmap_appl_forward(pcm, frames);
++ snd_atomic_write_end(&plugin->watom);
+ offset += frames;
+ xfer += frames;
+ size -= frames;
+@@ -325,19 +329,23 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
+ return -EPIPE;
+ }
+ snd_atomic_write_begin(&plugin->watom);
+- snd_pcm_mmap_appl_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+
+ res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result);
+- if (res < 0)
++ if (res < 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
++ }
+ frames -= res;
+ }
+- snd_atomic_write_end(&plugin->watom);
+- if (result <= 0)
++ if (result <= 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
++ }
++ snd_pcm_mmap_appl_forward(pcm, frames);
++ snd_atomic_write_end(&plugin->watom);
+ offset += frames;
+ xfer += frames;
+ size -= frames;
+@@ -423,19 +431,23 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm,
+ frames = plugin->write(pcm, areas, appl_offset, frames,
+ slave_areas, slave_offset, &slave_frames);
+ snd_atomic_write_begin(&plugin->watom);
+- snd_pcm_mmap_appl_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+- snd_atomic_write_end(&plugin->watom);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+
+ res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result);
+- if (res < 0)
++ if (res < 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? xfer : res;
++ }
+ frames -= res;
+ }
+- if (result <= 0)
++ if (result <= 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? xfer : result;
++ }
++ snd_pcm_mmap_appl_forward(pcm, frames);
++ snd_atomic_write_end(&plugin->watom);
+ if (frames == cont)
+ appl_offset = 0;
+ else
+@@ -490,19 +502,23 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
+ frames = (plugin->read)(pcm, areas, hw_offset, frames,
+ slave_areas, slave_offset, &slave_frames);
+ snd_atomic_write_begin(&plugin->watom);
+- snd_pcm_mmap_hw_forward(pcm, frames);
+ result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames);
+- snd_atomic_write_end(&plugin->watom);
+ if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) {
+ snd_pcm_sframes_t res;
+
+ res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result);
+- if (res < 0)
++ if (res < 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : res;
++ }
+ frames -= res;
+ }
+- if (result <= 0)
++ if (result <= 0) {
++ snd_atomic_write_end(&plugin->watom);
+ return xfer > 0 ? (snd_pcm_sframes_t)xfer : result;
++ }
++ snd_pcm_mmap_hw_forward(pcm, frames);
++ snd_atomic_write_end(&plugin->watom);
+ if (frames == cont)
+ hw_offset = 0;
+ else
+--
+1.9.1
+
diff --git a/meta/recipes-multimedia/alsa/alsa-lib_1.1.0.bb b/meta/recipes-multimedia/alsa/alsa-lib_1.1.0.bb
index a73da28828..296a7bb0ac 100644
--- a/meta/recipes-multimedia/alsa/alsa-lib_1.1.0.bb
+++ b/meta/recipes-multimedia/alsa/alsa-lib_1.1.0.bb
@@ -18,6 +18,7 @@ SRC_URI = "ftp://ftp.alsa-project.org/pub/lib/${BP}.tar.bz2 \
file://Check-if-wordexp-function-is-supported.patch \
file://avoid-including-sys-poll.h-directly.patch \
file://0001-topology-Add-missing-include-sys-stat.h.patch \
+ file://0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch \
"
SRC_URI[md5sum] = "69515ca73c3c4a212ef45160dea846c1"
SRC_URI[sha256sum] = "dfde65d11e82b68f82e562ab6228c1fb7c78854345d3c57e2c68a9dd3dae1f15"