thesofproject / linux

Linux kernel source tree
Other
88 stars 128 forks source link

Simultaneous audio capture from branched capture pipelines fail #5030

Open singalsu opened 1 month ago

singalsu commented 1 month ago

To replicate the issue need for SOF the topologies built from https://github.com/thesofproject/sof/pull/9146

The used kernel is topic/sof-dev 550791bb99dc4e08f44b8a2c5549b18745c027b7 build from today.

The platform is UPX-i11, the default topology sof-hda-generic-4ch.tplg is replaced with sof-hda-efx-generic-4ch.tplg. If I run these commands sequentially both DMIC captures work. First capture PCM is 4ch, the second 2ch, while DMIC is 4ch. The channels count conversion is done in TDFB beamformer.

arecord -Dhw:0,6 -f S32_LE -c 4 -r 48000 -d 10 rec1.wav arecord -Dhw:0,200 -f S32_LE -c 2 -r 48000 -d 10 rec2.wav

If I start first capture of rec1.wav, and then launch from other window capture of rec2.wav. I get to latter this error:

singalsu@ekstremisti:~$ arecord -Dhw:0,200 -f S32_LE -c 2 -r 48000 -d 10 rec2.wav
Recording WAVE 'rec2.wav' : Signed 32 bit Little Endian, Rate 48000 Hz, Stereo
arecord: set_params:1416: Unable to install hw params:
ACCESS:  RW_INTERLEAVED
FORMAT:  S32_LE
SUBFORMAT:  STD
SAMPLE_BITS: 32
FRAME_BITS: 64
CHANNELS: 2
RATE: 48000
PERIOD_TIME: 125000
PERIOD_SIZE: 6000
PERIOD_BYTES: 48000
PERIODS: 4
BUFFER_TIME: 500000
BUFFER_SIZE: 24000
BUFFER_BYTES: 192000
TICK_TIME: 0

The kernel log is attached. dmesg_rec06_rec0200_fail_20244005.txt

touko 30 16:39:17 ekstremisti kernel: snd_sof:sof_ipc4_set_copier_sink_format: sof-audio-pci-intel-tgl 0000:00:1f.3: module-copier.12.2 set copier sink 1 format
touko 30 16:39:17 ekstremisti kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Unable to get pin 1 format for tdfb.22.1
touko 30 16:39:17 ekstremisti kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: failed to set sink format for module-copier.12.2 source queue ID 1

The issue can be also replicated with HDA analog capture with topology sof-hda-efx-generic.tplg applied instead of default sof-hda-generic.tplg in non-DMIC systems. In this case both capture PCMs are 2ch. The commands to use are

arecord -Dhw:0,0 -f S32_LE -c 2 -r 48000 -d 10 rec1.wav
arecord -Dhw:0,201 -f S32_LE -c 2 -r 48000 -d 10 rec2.wav

Both work if run sequentially but not when launched with overlap, e.g. rec1.wav first, then rec2.wav, where the latter fails.

touko 30 16:57:38 ekstremisti kernel: snd_sof:sof_ipc4_set_copier_sink_format: sof-audio-pci-intel-tgl 0000:00:1f.3: module-copier.4.2 set copier sink 1 format
touko 30 16:57:38 ekstremisti kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: Unable to get pin 1 format for tdfb.23.1
touko 30 16:57:38 ekstremisti kernel: sof-audio-pci-intel-tgl 0000:00:1f.3: failed to set sink format for module-copier.4.2 source queue ID 1

The full dmesg is attached: dmesg_rec00_rec0201_fail_20244005.txt

In the topologies below, see the branched pipelines for HDA analog and DMIC: sof-hda-efx-generic sof-hda-efx-generic-2ch

singalsu commented 1 month ago

@ujfalusi @kv2019i Here's the issue we discussed this week. This is no more blocking me since I chose to use pipelines without branches, algorithms for multi-purpose endpoint are set to bypass to be set up for processing by ALSA UCM.