Accepting request 312533 from home:tiwai:branches:multimedia:libs

- Backport upstream fixes: fix bogus assert() in hw_params, a few
  PCM dmix/dshare/dsnoop fixes, enhacement of amixer, etc:
  0017-test-pcm-Fix-generated-values-with-float-PCM-format.patch
  0018-test-pcm_min-Fix-error-messages.patch
  0019-pcm-Don-t-assert-in-_snd_pcm_hw_params_internal.patch
  0020-pcm-Fix-snd_pcm_status-for-dmix-co.patch
  0021-control-Allow-cset-ing-specific-values-in-the-multi-.patch
  0022-PCM-snd_pcm_xxxx_drain-maybe-blocked-after-suspend-a.patch

OBS-URL: https://build.opensuse.org/request/show/312533
OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=183
This commit is contained in:
Stanislav Brabec 2015-06-18 18:33:24 +00:00 committed by Git OBS Bridge
parent e8e74453bd
commit 8cda421087
8 changed files with 316 additions and 0 deletions

View File

@ -0,0 +1,28 @@
From 9120f2de8608f49ee1cd4501b9eee39a1c71778f Mon Sep 17 00:00:00 2001
From: Christophe Lohr <christophe.lohr@cegetel.net>
Date: Mon, 1 Jun 2015 13:41:49 +0200
Subject: [PATCH] test/pcm: Fix generated values with float PCM format
The float format should be generated [-1.0..1.0].
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
test/pcm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/pcm.c b/test/pcm.c
index abb83e4c3014..18b61762b236 100644
--- a/test/pcm.c
+++ b/test/pcm.c
@@ -68,7 +68,7 @@ static void generate_sine(const snd_pcm_channel_area_t *areas,
} fval;
int res, i;
if (is_float) {
- fval.f = sin(phase) * maxval;
+ fval.f = sin(phase);
res = fval.i;
} else
res = sin(phase) * maxval;
--
2.4.3

View File

@ -0,0 +1,29 @@
From 8551fe258791c165892583006b0aa5142f41b621 Mon Sep 17 00:00:00 2001
From: Christophe Lohr <christophe.lohr@cegetel.net>
Date: Mon, 1 Jun 2015 13:43:36 +0200
Subject: [PATCH] test/pcm_min: Fix error messages
Fix the wrongly referred error code for error messages from
snd_pcm_writei() and other calls.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
test/pcm_min.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/pcm_min.c b/test/pcm_min.c
index e971405ee64f..7462a45fef33 100644
--- a/test/pcm_min.c
+++ b/test/pcm_min.c
@@ -39,7 +39,7 @@ int main(void)
if (frames < 0)
frames = snd_pcm_recover(handle, frames, 0);
if (frames < 0) {
- printf("snd_pcm_writei failed: %s\n", snd_strerror(err));
+ printf("snd_pcm_writei failed: %s\n", snd_strerror(frames));
break;
}
if (frames > 0 && frames < (long)sizeof(buffer))
--
2.4.3

View File

@ -0,0 +1,30 @@
From a5e5e3cd3c85eafcced7a93b1cf37201560f2a28 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 1 Jun 2015 13:45:01 +0200
Subject: [PATCH] pcm: Don't assert in _snd_pcm_hw_params_internal()
It's no fatal error from sw params, and it's really bad habit to use
assert() and abort the operation as a system library.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_params.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/pcm/pcm_params.c b/src/pcm/pcm_params.c
index 1d667a583151..60d99ad96167 100644
--- a/src/pcm/pcm_params.c
+++ b/src/pcm/pcm_params.c
@@ -2361,7 +2361,8 @@ int _snd_pcm_hw_params_internal(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
memset(&sw, 0, sizeof(sw));
snd_pcm_sw_params_default(pcm, &sw);
err = snd_pcm_sw_params(pcm, &sw);
- assert(err >= 0);
+ if (err < 0)
+ return err;
if (pcm->mmap_rw ||
pcm->access == SND_PCM_ACCESS_MMAP_INTERLEAVED ||
--
2.4.3

View File

@ -0,0 +1,78 @@
From 18ce3ec9caa266086c5f364a2bdbab27a8db9d77 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 2 Jun 2015 16:47:50 +0200
Subject: [PATCH] pcm: Fix snd_pcm_status() for dmix & co
Fetch the timestamp and other status fields by issuing
snd_pcm_status() for the slave PCM. Also, fill the delay field
properly. This should fix longstanding PA's complaints.
Reported-by: Dan Hordern <danhordern@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_dmix.c | 3 ++-
src/pcm/pcm_dshare.c | 3 ++-
src/pcm/pcm_dsnoop.c | 3 ++-
3 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
index babde6a15efe..4acbaf0e0265 100644
--- a/src/pcm/pcm_dmix.c
+++ b/src/pcm/pcm_dmix.c
@@ -475,12 +475,13 @@ static int snd_pcm_dmix_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
break;
}
memset(status, 0, sizeof(*status));
+ snd_pcm_status(dmix->spcm, status);
status->state = snd_pcm_dmix_state(pcm);
status->trigger_tstamp = dmix->trigger_tstamp;
- gettimestamp(&status->tstamp, pcm->tstamp_type);
status->avail = snd_pcm_mmap_playback_avail(pcm);
status->avail_max = status->avail > dmix->avail_max ? status->avail : dmix->avail_max;
dmix->avail_max = 0;
+ status->delay = snd_pcm_mmap_playback_delay(pcm);
return 0;
}
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
index 020e6f7d9307..b51758fb22a2 100644
--- a/src/pcm/pcm_dshare.c
+++ b/src/pcm/pcm_dshare.c
@@ -224,12 +224,13 @@ static int snd_pcm_dshare_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
break;
}
memset(status, 0, sizeof(*status));
+ snd_pcm_status(dshare->spcm, status);
status->state = snd_pcm_state(dshare->spcm);
status->trigger_tstamp = dshare->trigger_tstamp;
- gettimestamp(&status->tstamp, pcm->tstamp_type);
status->avail = snd_pcm_mmap_playback_avail(pcm);
status->avail_max = status->avail > dshare->avail_max ? status->avail : dshare->avail_max;
dshare->avail_max = 0;
+ status->delay = snd_pcm_mmap_playback_delay(pcm);
return 0;
}
diff --git a/src/pcm/pcm_dsnoop.c b/src/pcm/pcm_dsnoop.c
index 8333eefdaf4c..8a2e87ad0ae1 100644
--- a/src/pcm/pcm_dsnoop.c
+++ b/src/pcm/pcm_dsnoop.c
@@ -187,13 +187,14 @@ static int snd_pcm_dsnoop_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
break;
}
memset(status, 0, sizeof(*status));
+ snd_pcm_status(dsnoop->spcm, status);
state = snd_pcm_state(dsnoop->spcm);
status->state = state == SND_PCM_STATE_RUNNING ? dsnoop->state : state;
status->trigger_tstamp = dsnoop->trigger_tstamp;
- status->tstamp = dsnoop->update_tstamp;
status->avail = snd_pcm_mmap_capture_avail(pcm);
status->avail_max = status->avail > dsnoop->avail_max ? status->avail : dsnoop->avail_max;
dsnoop->avail_max = 0;
+ status->delay = snd_pcm_mmap_capture_delay(pcm);
return 0;
}
--
2.4.3

View File

@ -0,0 +1,40 @@
From 2fd098b587e8e5137c05ea6248c2aa87294e13c2 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Wed, 10 Jun 2015 11:56:23 +0200
Subject: [PATCH] control: Allow cset'ing specific values in the multi-value
case
Improve the parser to allow empty elements followed by a comma.
Now amixer works like below for setting only the third element.
% amixer cset 'IIR1 Band1' ,,200
Reported-and-tested-by: Arun Raghavan <arun@accosted.net>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/control/ctlparse.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/control/ctlparse.c b/src/control/ctlparse.c
index 8d6c3859bec4..877a05e3a1f1 100644
--- a/src/control/ctlparse.c
+++ b/src/control/ctlparse.c
@@ -325,6 +325,8 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
snd_ctl_elem_value_set_id(dst, myid);
for (idx = 0; idx < count && idx < 128 && ptr && *ptr; idx++) {
+ if (*ptr == ',')
+ goto skip;
switch (type) {
case SND_CTL_ELEM_TYPE_BOOLEAN:
tmp = 0;
@@ -375,6 +377,7 @@ int snd_ctl_ascii_value_parse(snd_ctl_t *handle,
default:
break;
}
+ skip:
if (!strchr(value, ','))
ptr = value;
else if (*ptr == ',')
--
2.4.3

View File

@ -0,0 +1,87 @@
From 9ee6ec80b80268932a372522ca192168e7812ccf Mon Sep 17 00:00:00 2001
From: Shengjiu Wang <shengjiu.wang@freescale.com>
Date: Fri, 12 Jun 2015 16:15:08 +0800
Subject: [PATCH] PCM: snd_pcm_xxxx_drain() maybe blocked after suspend and
resume
After suspend and resume, the alsa driver is stopped. But if alsa-lib run
into snd_pcm_xxxx_drain(), it need to wait avail >= pcm->stop_threshold,
otherwise, it will not exit the loop, so finally it is blocked at poll() of
snd_pcm_wait_nocheck(pcm, -1).
This patch is to add state check after snd_pcm_wait_nocheck(pcm, -1), if
the state is SND_PCM_STATE_SUSPENDED, then return error.
Signed-off-by: Shengjiu Wang <shengjiu.wang@freescale.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/pcm/pcm_dmix.c | 14 ++++++++++++++
src/pcm/pcm_dshare.c | 14 ++++++++++++++
2 files changed, 28 insertions(+)
diff --git a/src/pcm/pcm_dmix.c b/src/pcm/pcm_dmix.c
index 4acbaf0e0265..58e4975d5225 100644
--- a/src/pcm/pcm_dmix.c
+++ b/src/pcm/pcm_dmix.c
@@ -617,6 +617,13 @@ static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
snd_pcm_uframes_t stop_threshold;
int err;
+ switch (snd_pcm_state(dmix->spcm)) {
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
+
if (dmix->state == SND_PCM_STATE_OPEN)
return -EBADFD;
if (pcm->mode & SND_PCM_NONBLOCK)
@@ -649,6 +656,13 @@ static int snd_pcm_dmix_drain(snd_pcm_t *pcm)
snd_pcm_dmix_sync_area(pcm);
snd_pcm_wait_nocheck(pcm, -1);
snd_pcm_direct_clear_timer_queue(dmix); /* force poll to wait */
+
+ switch (snd_pcm_state(dmix->spcm)) {
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
}
} while (dmix->state == SND_PCM_STATE_DRAINING);
pcm->stop_threshold = stop_threshold;
diff --git a/src/pcm/pcm_dshare.c b/src/pcm/pcm_dshare.c
index b51758fb22a2..02370dc7082d 100644
--- a/src/pcm/pcm_dshare.c
+++ b/src/pcm/pcm_dshare.c
@@ -368,6 +368,13 @@ static int snd_pcm_dshare_drain(snd_pcm_t *pcm)
snd_pcm_uframes_t stop_threshold;
int err;
+ switch (snd_pcm_state(dshare->spcm)) {
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
+
if (dshare->state == SND_PCM_STATE_OPEN)
return -EBADFD;
if (pcm->mode & SND_PCM_NONBLOCK)
@@ -400,6 +407,13 @@ static int snd_pcm_dshare_drain(snd_pcm_t *pcm)
snd_pcm_dshare_sync_area(pcm);
snd_pcm_wait_nocheck(pcm, -1);
snd_pcm_direct_clear_timer_queue(dshare); /* force poll to wait */
+
+ switch (snd_pcm_state(dshare->spcm)) {
+ case SND_PCM_STATE_SUSPENDED:
+ return -ESTRPIPE;
+ default:
+ break;
+ }
}
} while (dshare->state == SND_PCM_STATE_DRAINING);
pcm->stop_threshold = stop_threshold;
--
2.4.3

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Thu Jun 18 09:32:07 CEST 2015 - tiwai@suse.de
- Backport upstream fixes: fix bogus assert() in hw_params, a few
PCM dmix/dshare/dsnoop fixes, enhacement of amixer, etc:
0017-test-pcm-Fix-generated-values-with-float-PCM-format.patch
0018-test-pcm_min-Fix-error-messages.patch
0019-pcm-Don-t-assert-in-_snd_pcm_hw_params_internal.patch
0020-pcm-Fix-snd_pcm_status-for-dmix-co.patch
0021-control-Allow-cset-ing-specific-values-in-the-multi-.patch
0022-PCM-snd_pcm_xxxx_drain-maybe-blocked-after-suspend-a.patch
-------------------------------------------------------------------
Fri May 22 14:16:26 CEST 2015 - tiwai@suse.de

View File

@ -65,6 +65,12 @@ Patch13: 0013-conf-Add-hint-descriptions-to-ctl-hwdep-seq-and-time.patch
Patch14: 0014-conf-ucm-broadwell-rt286-change-to-set-capture-volum.patch
Patch15: 0015-ucm-allow-multiple-devices-in-JackHWMute.patch
Patch16: 0016-pcm-Remove-assert-from-snd_pcm_hw_params_slave.patch
Patch17: 0017-test-pcm-Fix-generated-values-with-float-PCM-format.patch
Patch18: 0018-test-pcm_min-Fix-error-messages.patch
Patch19: 0019-pcm-Don-t-assert-in-_snd_pcm_hw_params_internal.patch
Patch20: 0020-pcm-Fix-snd_pcm_status-for-dmix-co.patch
Patch21: 0021-control-Allow-cset-ing-specific-values-in-the-multi-.patch
Patch22: 0022-PCM-snd_pcm_xxxx_drain-maybe-blocked-after-suspend-a.patch
# rest suse patches
Patch99: alsa-lib-doxygen-avoid-crash-for-11.3.diff
# suppress timestamp in documents
@ -151,6 +157,12 @@ Architecture.
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%if 0%{?suse_version} == 1130
%patch99 -p1
%endif