diff options
author | Yuqing Zhu <carol.zhu@nxp.com> | 2016-05-04 17:46:46 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-05-11 10:33:39 +0100 |
commit | 6b0bdd65dab38bc38d62b8f2726c791c8d3ed698 (patch) | |
tree | 3e355e1bcb8a358a9d715e5b715066699e900499 /meta/recipes-multimedia | |
parent | 8c1932e05ed44d975beeb517e469f9a8d15ecfc1 (diff) | |
download | poky-6b0bdd65dab38bc38d62b8f2726c791c8d3ed698.tar.gz |
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.
(From OE-Core rev: fcd7e439497174256a5c467532aad402f4d19ca1)
Signed-off-by: Yuqing Zhu <carol.zhu@nxp.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-multimedia')
-rwxr-xr-x | meta/recipes-multimedia/alsa/alsa-lib/0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch | 137 | ||||
-rw-r--r-- | meta/recipes-multimedia/alsa/alsa-lib_1.1.0.bb | 1 |
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 @@ | |||
1 | From 7c424edd116e76eee6218a1e9a6ff6c4daaf2a4d Mon Sep 17 00:00:00 2001 | ||
2 | From: Shengjiu Wang <shengjiu.wang@freescale.com> | ||
3 | Date: Wed, 6 Apr 2016 19:02:12 +0800 | ||
4 | Subject: [PATCH] pcm_plugin: fix appl pointer not correct when mmap_commit() | ||
5 | return error | ||
6 | |||
7 | When snd_pcm_mmap_commit() return error, the appl pointer is also updated. | ||
8 | which cause the avail_update()'s result wrong. | ||
9 | This patch move the snd_pcm_mmap_appl_forward() to the place when | ||
10 | snd_pcm_mmap_commit() is successfully returned. | ||
11 | |||
12 | Upstream-Status: Submitted [https://patchwork.kernel.org/patch/8760881/] | ||
13 | |||
14 | Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com> | ||
15 | Signed-off-by: Takashi Iwai <tiwai@suse.de> | ||
16 | --- | ||
17 | src/pcm/pcm_plugin.c | 48 ++++++++++++++++++++++++++++++++---------------- | ||
18 | 1 file changed, 32 insertions(+), 16 deletions(-) | ||
19 | |||
20 | diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c | ||
21 | index d007e8c..940491d 100644 | ||
22 | --- a/src/pcm/pcm_plugin.c | ||
23 | +++ b/src/pcm/pcm_plugin.c | ||
24 | @@ -279,18 +279,22 @@ static snd_pcm_sframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm, | ||
25 | return -EPIPE; | ||
26 | } | ||
27 | snd_atomic_write_begin(&plugin->watom); | ||
28 | - snd_pcm_mmap_appl_forward(pcm, frames); | ||
29 | result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); | ||
30 | if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { | ||
31 | snd_pcm_sframes_t res; | ||
32 | res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result); | ||
33 | - if (res < 0) | ||
34 | + if (res < 0) { | ||
35 | + snd_atomic_write_end(&plugin->watom); | ||
36 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : res; | ||
37 | + } | ||
38 | frames -= res; | ||
39 | } | ||
40 | - snd_atomic_write_end(&plugin->watom); | ||
41 | - if (result <= 0) | ||
42 | + if (result <= 0) { | ||
43 | + snd_atomic_write_end(&plugin->watom); | ||
44 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : result; | ||
45 | + } | ||
46 | + snd_pcm_mmap_appl_forward(pcm, frames); | ||
47 | + snd_atomic_write_end(&plugin->watom); | ||
48 | offset += frames; | ||
49 | xfer += frames; | ||
50 | size -= frames; | ||
51 | @@ -325,19 +329,23 @@ static snd_pcm_sframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm, | ||
52 | return -EPIPE; | ||
53 | } | ||
54 | snd_atomic_write_begin(&plugin->watom); | ||
55 | - snd_pcm_mmap_appl_forward(pcm, frames); | ||
56 | result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); | ||
57 | if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { | ||
58 | snd_pcm_sframes_t res; | ||
59 | |||
60 | res = plugin->undo_read(slave, areas, offset, frames, slave_frames - result); | ||
61 | - if (res < 0) | ||
62 | + if (res < 0) { | ||
63 | + snd_atomic_write_end(&plugin->watom); | ||
64 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : res; | ||
65 | + } | ||
66 | frames -= res; | ||
67 | } | ||
68 | - snd_atomic_write_end(&plugin->watom); | ||
69 | - if (result <= 0) | ||
70 | + if (result <= 0) { | ||
71 | + snd_atomic_write_end(&plugin->watom); | ||
72 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : result; | ||
73 | + } | ||
74 | + snd_pcm_mmap_appl_forward(pcm, frames); | ||
75 | + snd_atomic_write_end(&plugin->watom); | ||
76 | offset += frames; | ||
77 | xfer += frames; | ||
78 | size -= frames; | ||
79 | @@ -423,19 +431,23 @@ snd_pcm_plugin_mmap_commit(snd_pcm_t *pcm, | ||
80 | frames = plugin->write(pcm, areas, appl_offset, frames, | ||
81 | slave_areas, slave_offset, &slave_frames); | ||
82 | snd_atomic_write_begin(&plugin->watom); | ||
83 | - snd_pcm_mmap_appl_forward(pcm, frames); | ||
84 | result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); | ||
85 | - snd_atomic_write_end(&plugin->watom); | ||
86 | if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { | ||
87 | snd_pcm_sframes_t res; | ||
88 | |||
89 | res = plugin->undo_write(pcm, slave_areas, slave_offset + result, slave_frames, slave_frames - result); | ||
90 | - if (res < 0) | ||
91 | + if (res < 0) { | ||
92 | + snd_atomic_write_end(&plugin->watom); | ||
93 | return xfer > 0 ? xfer : res; | ||
94 | + } | ||
95 | frames -= res; | ||
96 | } | ||
97 | - if (result <= 0) | ||
98 | + if (result <= 0) { | ||
99 | + snd_atomic_write_end(&plugin->watom); | ||
100 | return xfer > 0 ? xfer : result; | ||
101 | + } | ||
102 | + snd_pcm_mmap_appl_forward(pcm, frames); | ||
103 | + snd_atomic_write_end(&plugin->watom); | ||
104 | if (frames == cont) | ||
105 | appl_offset = 0; | ||
106 | else | ||
107 | @@ -490,19 +502,23 @@ static snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm) | ||
108 | frames = (plugin->read)(pcm, areas, hw_offset, frames, | ||
109 | slave_areas, slave_offset, &slave_frames); | ||
110 | snd_atomic_write_begin(&plugin->watom); | ||
111 | - snd_pcm_mmap_hw_forward(pcm, frames); | ||
112 | result = snd_pcm_mmap_commit(slave, slave_offset, slave_frames); | ||
113 | - snd_atomic_write_end(&plugin->watom); | ||
114 | if (result > 0 && (snd_pcm_uframes_t)result != slave_frames) { | ||
115 | snd_pcm_sframes_t res; | ||
116 | |||
117 | res = plugin->undo_read(slave, areas, hw_offset, frames, slave_frames - result); | ||
118 | - if (res < 0) | ||
119 | + if (res < 0) { | ||
120 | + snd_atomic_write_end(&plugin->watom); | ||
121 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : res; | ||
122 | + } | ||
123 | frames -= res; | ||
124 | } | ||
125 | - if (result <= 0) | ||
126 | + if (result <= 0) { | ||
127 | + snd_atomic_write_end(&plugin->watom); | ||
128 | return xfer > 0 ? (snd_pcm_sframes_t)xfer : result; | ||
129 | + } | ||
130 | + snd_pcm_mmap_hw_forward(pcm, frames); | ||
131 | + snd_atomic_write_end(&plugin->watom); | ||
132 | if (frames == cont) | ||
133 | hw_offset = 0; | ||
134 | else | ||
135 | -- | ||
136 | 1.9.1 | ||
137 | |||
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 \ | |||
18 | file://Check-if-wordexp-function-is-supported.patch \ | 18 | file://Check-if-wordexp-function-is-supported.patch \ |
19 | file://avoid-including-sys-poll.h-directly.patch \ | 19 | file://avoid-including-sys-poll.h-directly.patch \ |
20 | file://0001-topology-Add-missing-include-sys-stat.h.patch \ | 20 | file://0001-topology-Add-missing-include-sys-stat.h.patch \ |
21 | file://0001-pcm_plugin-fix-appl-pointer-not-correct-when-mmap_co.patch \ | ||
21 | " | 22 | " |
22 | SRC_URI[md5sum] = "69515ca73c3c4a212ef45160dea846c1" | 23 | SRC_URI[md5sum] = "69515ca73c3c4a212ef45160dea846c1" |
23 | SRC_URI[sha256sum] = "dfde65d11e82b68f82e562ab6228c1fb7c78854345d3c57e2c68a9dd3dae1f15" | 24 | SRC_URI[sha256sum] = "dfde65d11e82b68f82e562ab6228c1fb7c78854345d3c57e2c68a9dd3dae1f15" |