aboutsummaryrefslogtreecommitdiffstats
path: root/meta-pipewire/recipes-multimedia
diff options
context:
space:
mode:
authorWalter Lozano <walter.lozano@collabora.com>2020-08-10 10:45:34 -0300
committerJan-Simon Moeller <jsmoeller@linuxfoundation.org>2020-08-19 09:06:59 +0000
commitcf16ed2c0d2d464a2174fbde764e5ecc3eab3cfb (patch)
tree5e7e9f35565ce0d57d31f0aba10016b796db8bab /meta-pipewire/recipes-multimedia
parent5367184c0335eded285c6da17e87b82392afd40f (diff)
meta-pipewire: improve audio on iMX8MQ
As a an initial step to solve audio issues on iMX8MQ add a patch to reduce the period_size and in that sense have better control about buffers usage. Bug-AGL: SPEC-3410 Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Change-Id: I0125515fc7ef6f0c9dbd6336d56d348d41f9115f Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/25093 Tested-by: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-build: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> ci-image-boot-test: Jenkins Job builder account <agl-jobbuilder@automotivelinux.org> Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Diffstat (limited to 'meta-pipewire/recipes-multimedia')
-rw-r--r--meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-Set-period_size-depending-on-hardware.patch35
-rw-r--r--meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb1
2 files changed, 36 insertions, 0 deletions
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-Set-period_size-depending-on-hardware.patch b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-Set-period_size-depending-on-hardware.patch
new file mode 100644
index 000000000..f9649400e
--- /dev/null
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire/0007-alsa-Set-period_size-depending-on-hardware.patch
@@ -0,0 +1,35 @@
+From bbf9c767d5b353142e03080762bdd805e124d50b Mon Sep 17 00:00:00 2001
+From: Walter Lozano <walter.lozano@collabora.com>
+Date: Fri, 7 Aug 2020 10:58:29 -0300
+Subject: [PATCH] alsa: Set period_size depending on hardware
+
+Currently PipeWire is unable to reproduce audio in systems where DMA
+granularity is not burst.
+
+In order to mitigate this issue, set period_size depending on hardware,
+lowering it when snd_pcm_hw_params_is_batch == 1, to reduce DMA
+transfers size.
+
+Signed-off-by: Walter Lozano <walter.lozano@collabora.com>
+---
+ spa/plugins/alsa/alsa-pcm.c | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
+index 63d75549..2d3850b7 100644
+--- a/spa/plugins/alsa/alsa-pcm.c
++++ b/spa/plugins/alsa/alsa-pcm.c
+@@ -463,6 +463,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
+
+ dir = 0;
+ period_size = 1024;
++ if (snd_pcm_hw_params_is_batch(params)) {
++ period_size = 512;
++ spa_log_warn(state->log, NAME" hardware does double buffering, changing period_size to %ld", period_size);
++ }
+ CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near");
+ CHECK(snd_pcm_hw_params_get_buffer_size_max(params, &state->buffer_frames), "get_buffer_size_max");
+ CHECK(snd_pcm_hw_params_set_buffer_size_near(hndl, params, &state->buffer_frames), "set_buffer_size_near");
+--
+2.20.1
+
diff --git a/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb b/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb
index 1a4e4eb97..7ca4237ff 100644
--- a/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb
+++ b/meta-pipewire/recipes-multimedia/pipewire/pipewire_git.bb
@@ -7,6 +7,7 @@ SRC_URI = "git://gitlab.freedesktop.org/pipewire/pipewire.git;protocol=https;bra
file://0004-audioconvert-always-assume-that-output-ports-are-NOT.patch \
file://0005-module-access-add-same-sec-label-mode.patch \
file://0006-alsa-pcm-call-reuse_buffers-when-resetting-the-state.patch \
+ file://0007-alsa-Set-period_size-depending-on-hardware.patch \
"
SRCREV = "b0932e687fc47e0872ca291531f2291d99042d70"