fix pcm interval regression
This commit is contained in:
parent
76897df30a
commit
4a1704a953
305
alsa-git.patch
Normal file
305
alsa-git.patch
Normal file
@ -0,0 +1,305 @@
|
||||
From 6eced6b4b6dca9f62ea3d13a40c5991231df3c5c Mon Sep 17 00:00:00 2001
|
||||
From: Takashi Iwai <tiwai@suse.de>
|
||||
Date: Thu, 18 Oct 2018 09:38:38 +0200
|
||||
Subject: [PATCH 1/6] conf/ucm/Dell-WD15-Dock: Fix incorrect device names
|
||||
|
||||
The device name string for Dell WD15 (and its variants) dock is set as
|
||||
"WD15Dock", while the actual device name to be used is "Dock".
|
||||
|
||||
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1112292
|
||||
Fixes: 8ebb40c96970 ("conf/ucm: Add a UCM profile for Dell WD15 Dock USB-audio")
|
||||
Signed-off-by: Takashi Iwai <tiwai@suse.de>
|
||||
---
|
||||
src/conf/ucm/Dell-WD15-Dock/HiFi.conf | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf
|
||||
index b07f3440..1b6bd212 100644
|
||||
--- a/src/conf/ucm/Dell-WD15-Dock/HiFi.conf
|
||||
+++ b/src/conf/ucm/Dell-WD15-Dock/HiFi.conf
|
||||
@@ -3,7 +3,7 @@ SectionDevice."Headphone" {
|
||||
|
||||
Value {
|
||||
PlaybackChannels "2"
|
||||
- PlaybackPCM "hw:WD15Dock,0"
|
||||
+ PlaybackPCM "hw:Dock,0"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ SectionDevice."LineOut" {
|
||||
|
||||
Value {
|
||||
PlaybackChannels "2"
|
||||
- PlaybackPCM "hw:WD15Dock,1"
|
||||
+ PlaybackPCM "hw:Dock,1"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,6 @@ SectionDevice."Mic" {
|
||||
|
||||
Value {
|
||||
CaptureChannels "2"
|
||||
- CapturePCM "hw:WD15Dock,0"
|
||||
+ CapturePCM "hw:Dock,0"
|
||||
}
|
||||
}
|
||||
--
|
||||
2.13.6
|
||||
|
||||
|
||||
From 6852f88e80e442ba5d7f2044cf0fbbe72d46fefa Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Tue, 23 Oct 2018 10:03:17 +0200
|
||||
Subject: [PATCH 2/6] test/latecy: fix typo in tstamp compare
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
test/latency.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/test/latency.c b/test/latency.c
|
||||
index f3590b3f..e926856b 100644
|
||||
--- a/test/latency.c
|
||||
+++ b/test/latency.c
|
||||
@@ -673,7 +673,7 @@ int main(int argc, char *argv[])
|
||||
printf("Capture:\n");
|
||||
showstat(chandle, frames_in);
|
||||
showinmax(in_max);
|
||||
- if (p_tstamp.tv_sec == p_tstamp.tv_sec &&
|
||||
+ if (p_tstamp.tv_sec == c_tstamp.tv_sec &&
|
||||
p_tstamp.tv_usec == c_tstamp.tv_usec)
|
||||
printf("Hardware sync\n");
|
||||
snd_pcm_drop(chandle);
|
||||
--
|
||||
2.13.6
|
||||
|
||||
|
||||
From 82ae026f49e6e22f4775ae23e33324535025a5c6 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Tue, 23 Oct 2018 10:17:12 +0200
|
||||
Subject: [PATCH 3/6] test/code: make it work again
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
test/code.c | 40 +++++++++++++++++++++-------------------
|
||||
1 file changed, 21 insertions(+), 19 deletions(-)
|
||||
|
||||
diff --git a/test/code.c b/test/code.c
|
||||
index e2032de5..3706243e 100644
|
||||
--- a/test/code.c
|
||||
+++ b/test/code.c
|
||||
@@ -3,11 +3,7 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <sched.h>
|
||||
-#include <sys/time.h>
|
||||
-
|
||||
-#ifndef __builtin_expect
|
||||
-#include <linux/compiler.h>
|
||||
-#endif
|
||||
+#include <time.h>
|
||||
|
||||
#define rdtscll(val) \
|
||||
__asm__ __volatile__("rdtsc" : "=A" (val))
|
||||
@@ -72,21 +68,21 @@ static inline void atomic_add(volatile int *dst, int v)
|
||||
|
||||
static double detect_cpu_clock()
|
||||
{
|
||||
- struct timeval tm_begin, tm_end;
|
||||
+ struct timespec tm_begin, tm_end;
|
||||
unsigned long long tsc_begin, tsc_end;
|
||||
|
||||
/* Warm cache */
|
||||
- gettimeofday(&tm_begin, 0);
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &tm_begin);
|
||||
|
||||
rdtscll(tsc_begin);
|
||||
- gettimeofday(&tm_begin, 0);
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &tm_begin);
|
||||
|
||||
usleep(1000000);
|
||||
|
||||
rdtscll(tsc_end);
|
||||
- gettimeofday(&tm_end, 0);
|
||||
+ clock_gettime(CLOCK_MONOTONIC, &tm_end);
|
||||
|
||||
- return (tsc_end - tsc_begin) / (tm_end.tv_sec - tm_begin.tv_sec + (tm_end.tv_usec - tm_begin.tv_usec) / 1e6);
|
||||
+ return (tsc_end - tsc_begin) / (tm_end.tv_sec - tm_begin.tv_sec + (tm_end.tv_nsec - tm_begin.tv_nsec) / 1e9);
|
||||
}
|
||||
|
||||
void mix_areas_srv(unsigned int size,
|
||||
@@ -146,11 +142,17 @@ void mix_areas0(unsigned int size,
|
||||
}
|
||||
}
|
||||
|
||||
-#define MIX_AREAS1 mix_areas1
|
||||
-#define MIX_AREAS1_MMX mix_areas1_mmx
|
||||
+#define MIX_AREAS_16 mix_areas1
|
||||
+#define MIX_AREAS_16_MMX mix_areas1_mmx
|
||||
+#define MIX_AREAS_32 mix_areas1_32
|
||||
+#define MIX_AREAS_24 mix_areas1_24
|
||||
+#define MIX_AREAS_24_CMOV mix_areas1_24_cmov
|
||||
+#define XADD "addl"
|
||||
+#define XSUB "subl"
|
||||
#include "../src/pcm/pcm_dmix_i386.h"
|
||||
-#undef MIX_AREAS1
|
||||
-#undef MIX_AREAS1_MMX
|
||||
+static void *ptr_mix_areas1_32 __attribute__((unused)) = &mix_areas1_32;
|
||||
+static void *ptr_mix_areas1_24 __attribute__((unused)) = &mix_areas1_24;
|
||||
+static void *ptr_mix_areas1_24_cmov __attribute__((unused)) = &mix_areas1_24_cmov;
|
||||
|
||||
void mix_areas2(unsigned int size,
|
||||
volatile s16 *dst, const s16 *src,
|
||||
@@ -319,11 +321,11 @@ int main(int argc, char **argv)
|
||||
|
||||
printf(" \r");
|
||||
printf("Summary (the best times):\n");
|
||||
- printf("mix_areas_srv : %lld %f%%\n", diffS, 100*2*44100.0*diffS/(size*n*cpu_clock));
|
||||
- printf("mix_areas0 : %lld %f%%\n", diff0, 100*2*44100.0*diff0/(size*n*cpu_clock));
|
||||
- printf("mix_areas1 : %lld %f%%\n", diff1, 100*2*44100.0*diff1/(size*n*cpu_clock));
|
||||
- printf("mix_areas1_mmx: %lld %f%%\n", diff1_mmx, 100*2*44100.0*diff1_mmx/(size*n*cpu_clock));
|
||||
- printf("mix_areas2 : %lld %f%%\n", diff2, 100*2*44100.0*diff2/(size*n*cpu_clock));
|
||||
+ printf("mix_areas_srv : %8lld %f%%\n", diffS, 100*2*44100.0*diffS/(size*n*cpu_clock));
|
||||
+ printf("mix_areas0 : %8lld %f%%\n", diff0, 100*2*44100.0*diff0/(size*n*cpu_clock));
|
||||
+ printf("mix_areas1 : %8lld %f%%\n", diff1, 100*2*44100.0*diff1/(size*n*cpu_clock));
|
||||
+ printf("mix_areas1_mmx : %8lld %f%%\n", diff1_mmx, 100*2*44100.0*diff1_mmx/(size*n*cpu_clock));
|
||||
+ printf("mix_areas2 : %8lld %f%%\n", diff2, 100*2*44100.0*diff2/(size*n*cpu_clock));
|
||||
|
||||
printf("\n");
|
||||
printf("areas1/srv ratio : %f\n", (double)diff1 / diffS);
|
||||
--
|
||||
2.13.6
|
||||
|
||||
|
||||
From 956bc152e7f77714a3be58dccf91ef8542c34556 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Tue, 23 Oct 2018 10:18:24 +0200
|
||||
Subject: [PATCH 4/6] test: rename code to more approriate mixtest
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
test/Makefile.am | 2 +-
|
||||
test/{code.c => mixtest.c} | 0
|
||||
2 files changed, 1 insertion(+), 1 deletion(-)
|
||||
rename test/{code.c => mixtest.c} (100%)
|
||||
|
||||
diff --git a/test/Makefile.am b/test/Makefile.am
|
||||
index 5f35159a..99c2c4ff 100644
|
||||
--- a/test/Makefile.am
|
||||
+++ b/test/Makefile.am
|
||||
@@ -20,7 +20,7 @@ oldapi_LDADD=../src/libasound.la
|
||||
queue_timer_LDADD=../src/libasound.la
|
||||
namehint_LDADD=../src/libasound.la
|
||||
client_event_filter_LDADD=../src/libasound.la
|
||||
-code_CFLAGS=-Wall -pipe -g -O2
|
||||
+mixtest_CFLAGS=-Wall -pipe -g -O2
|
||||
chmap_LDADD=../src/libasound.la
|
||||
audio_time_LDADD=../src/libasound.la
|
||||
pcm_multi_thread_LDADD=../src/libasound.la
|
||||
diff --git a/test/code.c b/test/mixtest.c
|
||||
similarity index 100%
|
||||
rename from test/code.c
|
||||
rename to test/mixtest.c
|
||||
--
|
||||
2.13.6
|
||||
|
||||
|
||||
From 92172adb0b733de5a52f1671a279b3079cf0a657 Mon Sep 17 00:00:00 2001
|
||||
From: Jaroslav Kysela <perex@perex.cz>
|
||||
Date: Tue, 23 Oct 2018 10:20:20 +0200
|
||||
Subject: [PATCH 5/6] test/audio_time: remove unused variables
|
||||
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
test/audio_time.c | 2 --
|
||||
1 file changed, 2 deletions(-)
|
||||
|
||||
diff --git a/test/audio_time.c b/test/audio_time.c
|
||||
index a54c10dc..530922d9 100644
|
||||
--- a/test/audio_time.c
|
||||
+++ b/test/audio_time.c
|
||||
@@ -115,9 +115,7 @@ int main(int argc, char *argv[])
|
||||
snd_pcm_sw_params_t *swparams_p;
|
||||
snd_pcm_sw_params_t *swparams_c;
|
||||
|
||||
- snd_pcm_uframes_t curr_count_c;
|
||||
snd_pcm_uframes_t frame_count_c = 0;
|
||||
- snd_pcm_uframes_t curr_count_p;
|
||||
snd_pcm_uframes_t frame_count_p = 0;
|
||||
|
||||
snd_pcm_sframes_t delay_p, delay_c;
|
||||
--
|
||||
2.13.6
|
||||
|
||||
|
||||
From b420056604f06117c967b65d43d01536c5ffcbc9 Mon Sep 17 00:00:00 2001
|
||||
From: Timo Wischer <twischer@de.adit-jv.com>
|
||||
Date: Thu, 18 Oct 2018 13:33:24 +0200
|
||||
Subject: [PATCH 6/6] pcm: interval: Interpret (x x+1] correctly and return x+1
|
||||
|
||||
Without this change an interval of (x x+1] will be interpreted as an
|
||||
empty interval but the right value would be x+1.
|
||||
This leads to a failing snd_pcm_hw_params() call which returns -EINVAL.
|
||||
|
||||
An example issue log is given in the following:
|
||||
snd_pcm_hw_params failed with err -22 (Invalid argument)
|
||||
ACCESS: MMAP_NONINTERLEAVED
|
||||
FORMAT: S16_LE
|
||||
SUBFORMAT: STD
|
||||
SAMPLE_BITS: 16
|
||||
FRAME_BITS: 16
|
||||
CHANNELS: 1
|
||||
RATE: 16000
|
||||
PERIOD_TIME: (15999 16000]
|
||||
PERIOD_SIZE: (255 256]
|
||||
PERIOD_BYTES: (510 512]
|
||||
PERIODS: [2 3)
|
||||
BUFFER_TIME: 32000
|
||||
BUFFER_SIZE: 512
|
||||
BUFFER_BYTES: 1024
|
||||
|
||||
In case of (x x+1) we have to interpret it anyway as a single value of x to
|
||||
compensate rounding issues.
|
||||
For example the period size will result in an interval of (352 353) when
|
||||
the period time is 16ms and the sample rate 22050 Hz
|
||||
(16ms * 22,05 kHz = 352,8 frames). But 352 has to be chosen to allow a
|
||||
buffer size of 705 (32ms * 22,05 kHz = 705,6 frames) which has to be >= 2x
|
||||
period size to avoid Xruns. The buffer size will not end up with an
|
||||
interval of (705 706) simular to the period size because
|
||||
snd_pcm_rate_hw_refine_cchange() calls snd_interval_floor() for the buffer
|
||||
size. Therefore this value will be interpreted as an integer interval
|
||||
instead of a real interval further on.
|
||||
|
||||
This issue seems to exist since the change of 9bb985c38 ("pcm:
|
||||
snd_interval_refine_first/last: exclude value only if also excluded
|
||||
before")
|
||||
|
||||
Signed-off-by: Timo Wischer <twischer@de.adit-jv.com>
|
||||
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
|
||||
---
|
||||
src/pcm/interval_inline.h | 4 +++-
|
||||
1 file changed, 3 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/pcm/interval_inline.h b/src/pcm/interval_inline.h
|
||||
index a68e292b..d9a30b2a 100644
|
||||
--- a/src/pcm/interval_inline.h
|
||||
+++ b/src/pcm/interval_inline.h
|
||||
@@ -51,12 +51,14 @@ INTERVAL_INLINE int snd_interval_single(const snd_interval_t *i)
|
||||
{
|
||||
assert(!snd_interval_empty(i));
|
||||
return (i->min == i->max ||
|
||||
- (i->min + 1 == i->max && i->openmax));
|
||||
+ (i->min + 1 == i->max && (i->openmin || i->openmax)));
|
||||
}
|
||||
|
||||
INTERVAL_INLINE int snd_interval_value(const snd_interval_t *i)
|
||||
{
|
||||
assert(snd_interval_single(i));
|
||||
+ if (i->openmin && !i->openmax)
|
||||
+ return i->max;
|
||||
return i->min;
|
||||
}
|
||||
|
||||
--
|
||||
2.13.6
|
||||
|
@ -5,7 +5,7 @@
|
||||
Summary: The Advanced Linux Sound Architecture (ALSA) library
|
||||
Name: alsa-lib
|
||||
Version: 1.1.7
|
||||
Release: 1%{?prever_dot}%{?dist}
|
||||
Release: 2%{?prever_dot}%{?dist}
|
||||
License: LGPLv2+
|
||||
Group: System Environment/Libraries
|
||||
URL: http://www.alsa-project.org/
|
||||
@ -14,8 +14,9 @@ Source: ftp://ftp.alsa-project.org/pub/lib/%{name}-%{version}%{?prever}%{?post
|
||||
Source10: asound.conf
|
||||
Source11: modprobe-dist-alsa.conf
|
||||
Source12: modprobe-dist-oss.conf
|
||||
Patch0: alsa-lib-1.0.24-config.patch
|
||||
Patch1: alsa-lib-1.0.14-glibc-open.patch
|
||||
Patch0: alsa-git.patch
|
||||
Patch1: alsa-lib-1.0.24-config.patch
|
||||
Patch2: alsa-lib-1.0.14-glibc-open.patch
|
||||
|
||||
BuildRequires: doxygen
|
||||
BuildRequires: autoconf automake libtool
|
||||
@ -64,8 +65,9 @@ contains alsa-lib configuration of SoC topology
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?prever}%{?postver}
|
||||
%patch0 -p1 -b .config
|
||||
%patch1 -p1 -b .glibc-open
|
||||
%patch0 -p1 -b .alsa-git
|
||||
%patch1 -p1 -b .config
|
||||
%patch2 -p1 -b .glibc-open
|
||||
|
||||
%build
|
||||
autoreconf -vif
|
||||
@ -139,7 +141,7 @@ find %{buildroot} -name '*.la' -delete
|
||||
%{_datadir}/alsa/topology
|
||||
|
||||
%changelog
|
||||
* Tue Oct 16 2018 Jaroslav Kysela <perex@perex.cz> - 1.1.7-1
|
||||
* Wed Oct 24 2018 Jaroslav Kysela <perex@perex.cz> - 1.1.7-2
|
||||
- Moved topology files to alsa-topology
|
||||
- Updated to 1.1.7
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user