From 9cd9339c2a34d15090129468fe943b53442ed8e1 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 11 Mar 2021 18:37:13 +0100 Subject: [PATCH] alsa-pcm: only disable IRQ when not batch For batch devices we want to keep the IRQ so that the pointers are updated with the period-size. Brings my UMC404HD to 4.8ms roundtrip times with IRQ at 6 sample and batch enabled. --- spa/plugins/alsa/alsa-pcm.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index a3cbb6de7..90de03525 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -559,9 +559,6 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ } } - /* disable ALSA wakeups, we use a timer */ - if (snd_pcm_hw_params_can_disable_period_wakeup(params)) - CHECK(snd_pcm_hw_params_set_period_wakeup(hndl, params, 0), "set_period_wakeup"); /* set the sample format */ spa_log_debug(state->log, NAME" %p: Stream parameters are %iHz fmt:%s access:%s-%s channels:%i", @@ -616,6 +613,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ period_size /= 2; spa_log_info(state->log, NAME" %s: batch mode, period_size:%ld", state->props.device, period_size); + } else { + /* disable ALSA wakeups, we use a timer */ + if (snd_pcm_hw_params_can_disable_period_wakeup(params)) + CHECK(snd_pcm_hw_params_set_period_wakeup(hndl, params, 0), "set_period_wakeup"); } CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near");