- Fix loopback config

* 0022-Fix-typo-for-surround-PCMs-in-src-conf-cards-Loopbac.patch
- Fix config syntax for hw device
  * 0023-namehint-Fix-hw-device-evaluation-missing-last-devic.patch
  * 0024-namehint-Another-fix-to-properly-evaluate-hw-devices.patch
  * 0025-config-file-processing-rewrite-the-locking-use-one-r.patch
- Fix dB-volume range with mute bit (bnc#648925)
  * 0026-tlv-fix-returned-dB-information-for-min-is-mute-cont.patch

OBS-URL: https://build.opensuse.org/package/show/multimedia:libs/alsa?expand=0&rev=65
This commit is contained in:
Takashi Iwai 2010-10-25 07:41:00 +00:00 committed by Git OBS Bridge
parent 78c3cb05aa
commit 5e256f9e35
7 changed files with 352 additions and 1 deletions

View File

@ -0,0 +1,27 @@
From 9ce25165dd14722cf9ca9e25d486bf79824ea606 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Wed, 15 Sep 2010 08:11:42 +0200
Subject: [PATCH] Fix typo for surround PCMs in src/conf/cards/Loopback.conf
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/conf/cards/Loopback.conf | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/conf/cards/Loopback.conf b/src/conf/cards/Loopback.conf
index 05c48c6..5365fa1 100644
--- a/src/conf/cards/Loopback.conf
+++ b/src/conf/cards/Loopback.conf
@@ -69,6 +69,6 @@ Loopback.pcm.default {
<confdir:pcm/surround51.conf>
<confdir:pcm/surround71.conf>
-Loopback.pcm.surround40.0 cards.HDA-Intel.pcm.front.0
-Loopback.pcm.surround51.0 cards.HDA-Intel.pcm.front.0
-Loopback.pcm.surround71.0 cards.HDA-Intel.pcm.front.0
+Loopback.pcm.surround40.0 cards.Loopback.pcm.front.0
+Loopback.pcm.surround51.0 cards.Loopback.pcm.front.0
+Loopback.pcm.surround71.0 cards.Loopback.pcm.front.0
--
1.7.3.1

View File

@ -0,0 +1,26 @@
From 0244370be695372a05344ac760d624e0b40ec9ea Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 1 Oct 2010 13:31:45 +0200
Subject: [PATCH] namehint: Fix hw device evaluation (missing last device)
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/control/namehint.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/control/namehint.c b/src/control/namehint.c
index e06d240..ab3525e 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -446,7 +446,7 @@ static int add_card(struct hint_list *list, int card)
ok++;
}
ok = 0;
- for (device = 0; err >= 0 && device < max_device; device++) {
+ for (device = 0; err >= 0 && device <= max_device; device++) {
list->device = device;
err = try_config(list, list->siface, str);
if (err < 0)
--
1.7.3.1

View File

@ -0,0 +1,32 @@
From c049d48407ff0459ff15e466edeeee6ecff67fcd Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Fri, 1 Oct 2010 14:08:03 +0200
Subject: [PATCH] namehint: Another fix to properly evaluate hw devices
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/control/namehint.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/control/namehint.c b/src/control/namehint.c
index ab3525e..faaa5d5 100644
--- a/src/control/namehint.c
+++ b/src/control/namehint.c
@@ -439,11 +439,12 @@ static int add_card(struct hint_list *list, int card)
err = next_devices[list->iface](list->ctl, &device);
if (device < 0)
err = -EINVAL;
+ else
+ max_device = device;
while (err >= 0 && device >= 0) {
err = next_devices[list->iface](list->ctl, &device);
- if (device > max_device)
+ if (err >= 0 && device > max_device)
max_device = device;
- ok++;
}
ok = 0;
for (device = 0; err >= 0 && device <= max_device; device++) {
--
1.7.3.1

View File

@ -0,0 +1,159 @@
From c6a81e21c0f566c2cf62ff345eefea857925afa7 Mon Sep 17 00:00:00 2001
From: Jaroslav Kysela <perex@perex.cz>
Date: Mon, 11 Oct 2010 10:34:12 +0200
Subject: [PATCH] config file processing: rewrite the locking - use one recursive mutex
Avoid configuration file processing races when multiple threads call
the *open() functions together (for example using alsaloop with
multiple -T jobs can reproduce this issue).
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
---
src/conf.c | 59 +++++++++++++++++++++++++++++++++++++++--------------------
1 files changed, 39 insertions(+), 20 deletions(-)
diff --git a/src/conf.c b/src/conf.c
index 5d8c5c9..8939d62 100644
--- a/src/conf.c
+++ b/src/conf.c
@@ -425,6 +425,11 @@ beginning:</P>
#ifndef DOC_HIDDEN
+#ifdef HAVE_LIBPTHREAD
+static pthread_mutex_t snd_config_update_mutex =
+ PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+#endif
+
struct _snd_config {
char *id;
snd_config_type_t type;
@@ -464,6 +469,25 @@ typedef struct {
int ch;
} input_t;
+#ifdef HAVE_LIBPTHREAD
+
+static inline void snd_config_lock(void)
+{
+ pthread_mutex_lock(&snd_config_update_mutex);
+}
+
+static inline void snd_config_unlock(void)
+{
+ pthread_mutex_unlock(&snd_config_update_mutex);
+}
+
+#else
+
+static inline void snd_config_lock(void) { }
+static inline void snd_config_unlock(void) { }
+
+#endif
+
static int safe_strtoll(const char *str, long long *val)
{
long long v;
@@ -3318,6 +3342,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
if ((err = snd_config_search(config, "@hooks", &n)) < 0)
return 0;
+ snd_config_lock();
snd_config_remove(n);
do {
hit = 0;
@@ -3334,7 +3359,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
if (i == idx) {
err = snd_config_hooks_call(config, n, private_data);
if (err < 0)
- return err;
+ goto _err;
idx++;
hit = 1;
}
@@ -3343,6 +3368,7 @@ static int snd_config_hooks(snd_config_t *config, snd_config_t *private_data)
err = 0;
_err:
snd_config_delete(n);
+ snd_config_unlock();
return err;
}
@@ -3692,10 +3718,6 @@ int snd_config_update_r(snd_config_t **_top, snd_config_update_t **_update, cons
return 1;
}
-#ifdef HAVE_LIBPTHREAD
-static pthread_mutex_t snd_config_update_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
/**
* \brief Updates #snd_config by rereading the global configuration files (if needed).
* \return 0 if #snd_config was up to date, 1 if #snd_config was
@@ -3716,13 +3738,9 @@ int snd_config_update(void)
{
int err;
-#ifdef HAVE_LIBPTHREAD
- pthread_mutex_lock(&snd_config_update_mutex);
-#endif
+ snd_config_lock();
err = snd_config_update_r(&snd_config, &snd_config_global_update, NULL);
-#ifdef HAVE_LIBPTHREAD
- pthread_mutex_unlock(&snd_config_update_mutex);
-#endif
+ snd_config_unlock();
return err;
}
@@ -3755,18 +3773,14 @@ int snd_config_update_free(snd_config_update_t *update)
*/
int snd_config_update_free_global(void)
{
-#ifdef HAVE_LIBPTHREAD
- pthread_mutex_lock(&snd_config_update_mutex);
-#endif
+ snd_config_lock();
if (snd_config)
snd_config_delete(snd_config);
snd_config = NULL;
if (snd_config_global_update)
snd_config_update_free(snd_config_global_update);
snd_config_global_update = NULL;
-#ifdef HAVE_LIBPTHREAD
- pthread_mutex_unlock(&snd_config_update_mutex);
-#endif
+ snd_config_unlock();
/* FIXME: better to place this in another place... */
snd_dlobj_cache_cleanup();
@@ -4657,7 +4671,7 @@ int snd_config_expand(snd_config_t *config, snd_config_t *root, const char *args
snd_config_delete(subs);
return err;
}
-
+
/**
* \brief Searches for a definition in a configuration tree, using
* aliases and expanding hooks and arguments.
@@ -4707,10 +4721,15 @@ int snd_config_search_definition(snd_config_t *config,
* if key contains dot (.), the implicit base is ignored
* and the key starts from root given by the 'config' parameter
*/
+ snd_config_lock();
err = snd_config_search_alias_hooks(config, strchr(key, '.') ? NULL : base, key, &conf);
- if (err < 0)
+ if (err < 0) {
+ snd_config_unlock();
return err;
- return snd_config_expand(conf, config, args, NULL, result);
+ }
+ err = snd_config_expand(conf, config, args, NULL, result);
+ snd_config_unlock();
+ return err;
}
#ifndef DOC_HIDDEN
--
1.7.3.1

View File

@ -0,0 +1,85 @@
From 2f6206da0c1ff88235e6eca0077343f22a4b43ee Mon Sep 17 00:00:00 2001
From: Clemens Ladisch <clemens@ladisch.de>
Date: Fri, 15 Oct 2010 10:33:20 +0200
Subject: [PATCH] tlv: fix returned dB information for min-is-mute controls
For TLV information that indicates that the minimum value is actually
muted, the returned range used the wrong minimum dB value, and
converting dB values to raw control values did not round up correctly
near the minimum.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
src/control/tlv.c | 26 ++++++++++++++++++++------
1 files changed, 20 insertions(+), 6 deletions(-)
diff --git a/src/control/tlv.c b/src/control/tlv.c
index ba52752..f7c9976 100644
--- a/src/control/tlv.c
+++ b/src/control/tlv.c
@@ -167,17 +167,23 @@ int snd_tlv_get_dB_range(unsigned int *tlv, long rangemin, long rangemax,
}
case SND_CTL_TLVT_DB_SCALE: {
int step;
- *min = (int)tlv[2];
+ if (tlv[3] & 0x10000)
+ *min = SND_CTL_TLV_DB_GAIN_MUTE;
+ else
+ *min = (int)tlv[2];
step = (tlv[3] & 0xffff);
- *max = *min + (long)(step * (rangemax - rangemin));
+ *max = (int)tlv[2] + step * (rangemax - rangemin);
return 0;
}
case SND_CTL_TLVT_DB_MINMAX:
- case SND_CTL_TLVT_DB_MINMAX_MUTE:
case SND_CTL_TLVT_DB_LINEAR:
*min = (int)tlv[2];
*max = (int)tlv[3];
return 0;
+ case SND_CTL_TLVT_DB_MINMAX_MUTE:
+ *min = SND_CTL_TLV_DB_GAIN_MUTE;
+ *max = (int)tlv[3];
+ return 0;
}
return -EINVAL;
}
@@ -217,7 +223,7 @@ int snd_tlv_convert_to_dB(unsigned int *tlv, long rangemin, long rangemax,
min = tlv[2];
step = (tlv[3] & 0xffff);
mute = (tlv[3] >> 16) & 1;
- if (mute && volume == rangemin)
+ if (mute && volume <= rangemin)
*db_gain = SND_CTL_TLV_DB_GAIN_MUTE;
else
*db_gain = (volume - rangemin) * step + min;
@@ -327,7 +333,11 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
step = (tlv[3] & 0xffff);
max = min + (int)(step * (rangemax - rangemin));
if (db_gain <= min)
- *value = rangemin;
+ if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 &&
+ (tlv[3] & 0x10000))
+ *value = rangemin + 1;
+ else
+ *value = rangemin;
else if (db_gain >= max)
*value = rangemax;
else {
@@ -345,7 +355,11 @@ int snd_tlv_convert_from_dB(unsigned int *tlv, long rangemin, long rangemax,
min = tlv[2];
max = tlv[3];
if (db_gain <= min)
- *value = rangemin;
+ if (db_gain > SND_CTL_TLV_DB_GAIN_MUTE && xdir > 0 &&
+ tlv[0] == SND_CTL_TLVT_DB_MINMAX_MUTE)
+ *value = rangemin + 1;
+ else
+ *value = rangemin;
else if (db_gain >= max)
*value = rangemax;
else {
--
1.7.3.1

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Oct 25 09:33:37 CEST 2010 - tiwai@suse.de
- Fix loopback config
* 0022-Fix-typo-for-surround-PCMs-in-src-conf-cards-Loopbac.patch
- Fix config syntax for hw device
* 0023-namehint-Fix-hw-device-evaluation-missing-last-devic.patch
* 0024-namehint-Another-fix-to-properly-evaluate-hw-devices.patch
* 0025-config-file-processing-rewrite-the-locking-use-one-r.patch
- Fix dB-volume range with mute bit (bnc#648925)
* 0026-tlv-fix-returned-dB-information-for-min-is-mute-cont.patch
-------------------------------------------------------------------
Thu Sep 2 15:52:04 CEST 2010 - tiwai@suse.de

View File

@ -73,6 +73,11 @@ Patch18: 0018-namehint-Evaluate-more-possibilities-for-hw-devices.patch
Patch19: 0019-HDA-Intel-do-not-lock-IEC958-Playback-switch.patch
Patch20: 0020-general-recoded-snd_dlobj_-functions.patch
Patch21: 0021-Add-Loopback.conf-to-define-standard-PCM-devices-for.patch
Patch22: 0022-Fix-typo-for-surround-PCMs-in-src-conf-cards-Loopbac.patch
Patch23: 0023-namehint-Fix-hw-device-evaluation-missing-last-devic.patch
Patch24: 0024-namehint-Another-fix-to-properly-evaluate-hw-devices.patch
Patch25: 0025-config-file-processing-rewrite-the-locking-use-one-r.patch
Patch26: 0026-tlv-fix-returned-dB-information-for-min-is-mute-cont.patch
Url: http://www.alsa-project.org/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
@ -169,6 +174,11 @@ Authors:
%patch19 -p1
%patch20 -p1
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
# hack to fix build on older distros
%if %suse_version < 1100
%ifarch %ix86
@ -187,7 +197,7 @@ autoreconf -fi
--disable-aload \
--disable-alisp \
--disable-python
make %{?jobs:-j %jobs}
make V=1 %{?jobs:-j %jobs}
# run doxygen
make -C doc doc