On-the-fly AC3 and DTS encoding is incompatible with UCM
(Reporting this on behalf of Mark Korenberg, I do not have the affected hardware)
- PipeWire version (
pipewire --version
): pipewire-0.3.70-1.fc37.x86_64 - Distribution and distribution version (
PRETTY_NAME
from/etc/os-release
): Fedora 37 - Desktop Environment: Does not matter
- Kernel version (
uname -r
): 6.2.15-200.fc37.x86_64
Description of Problem:
On legacy HDA platforms, PipeWire could encode AC3 via SPDIF, and DTS via SPDIF and HDMI on the fly using ALSA plugins ("ac3" and "dca"/"dcahdmi"). On SOF platforms using UCM, this functionality is lost, please reimplement it in a compatible way.
On legacy platforms, the chain of ALSA plugins is defined by files in /usr/share/alsa/cards
, /usr/share/alsa/pcm
, and /usr/share/alsa-card-profile/mixer/profile-sets
. This was enough to convince PipeWire to use the encoder. However, on UCM platforms, including SOF, none of that is used, and there is no place to ask PipeWire to use an ALSA plugin. Even worse, the needed dcahdmi
device simply does not exist, because HDMI devices are supposed to be opened using the hw:
plugin according to the information from UCM, and there is no configuration that instructs ALSA that encoders are possible to run on top of this.
I guess that the best course of action is to import a software AC3 encoder directly into PipeWire (e.g. copy Aften) and automatically provide an option to run it on top of anything that accepts AC3. Personally, and also for patent reasons, I think that it would be unwise to support DTS this way because I no longer officially support the encoder (dcaenc) that I wrote - but I know that it still has users.
How Reproducible:
Always.
Steps to Reproduce:
- Buy an old desktop PC, which still uses snd-hda-intel
- Buy a TV or a projector that supports ARC
- Buy a Samsung HW-T650 HDMI soundbar
- Notice that 5.1 PCM audio does not work (only front-left and front-right channels work even if a 5.1 profile is selected, this is #3094, already diagnosed as an issue with the soundbar itself)
- Try to install dcaenc and encode everything to DTS by selecting the "Digital Surround 5.1 (HDMI/DTS)" profile - all channels work then
- Try to replace the old desktop PC with a new shiny ASUS Zenbook UX3402ZA laptop
- Reinstall dcaenc on the laptop, try to configure the "Digital Surround 5.1 (HDMI/DTS)" profile - oops, it doesn't exist on the new laptop.
Actual Results:
The profile is not selectable. Worse, there are no dcahdmi
devices in aplay -l
, that are the prerequisite for this profile to be available. There are actually no hdmi
ALSA PCMs either, because now it is all handled via hw
devices and UCM.
Expected Results:
One should still be able to use all the 5.1 channels of the soundbar, even though it means that all sounds have to be encoded to AC3 or DTS in real time.
Additional Info:
$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
pipewire
PipeWire Sound Server
default
Default ALSA Output (currently PipeWire Media Server)
sysdefault:CARD=sofhdadsp
sof-hda-dsp,
Default Audio Device
sysdefault:CARD=Device
USB Audio Device, USB Audio
Default Audio Device
front:CARD=Device,DEV=0
USB Audio Device, USB Audio
Front output / input
surround21:CARD=Device,DEV=0
USB Audio Device, USB Audio
2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=Device,DEV=0
USB Audio Device, USB Audio
4.0 Surround output to Front and Rear speakers
surround41:CARD=Device,DEV=0
USB Audio Device, USB Audio
4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=Device,DEV=0
USB Audio Device, USB Audio
5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=Device,DEV=0
USB Audio Device, USB Audio
5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=Device,DEV=0
USB Audio Device, USB Audio
7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=Device,DEV=0
USB Audio Device, USB Audio
IEC958 (S/PDIF) Digital Audio Output
dca:CARD=Device,DEV=0
USB Audio Device, USB Audio
DTS Encoding through IEC958 (S/PDIF)
(please ignore the USB Audio Device "Device")
$ lspci -nn
0000:00:00.0 Host bridge [0600]: Intel Corporation Device [8086:4621] (rev 02)
0000:00:02.0 VGA compatible controller [0300]: Intel Corporation Alder Lake-P Integrated Graphics Controller [8086:46a6] (rev 0c)
0000:00:04.0 Signal processing controller [1180]: Intel Corporation Alder Lake Innovation Platform Framework Processor Participant [8086:461d] (rev 02)
0000:00:06.0 System peripheral [0880]: Intel Corporation RST VMD Managed Controller [8086:09ab]
0000:00:07.0 PCI bridge [0604]: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #0 [8086:466e] (rev 02)
0000:00:07.2 PCI bridge [0604]: Intel Corporation Alder Lake-P Thunderbolt 4 PCI Express Root Port #2 [8086:462f] (rev 02)
0000:00:08.0 System peripheral [0880]: Intel Corporation 12th Gen Core Processor Gaussian & Neural Accelerator [8086:464f] (rev 02)
0000:00:0a.0 Signal processing controller [1180]: Intel Corporation Platform Monitoring Technology [8086:467d] (rev 01)
0000:00:0d.0 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 USB Controller [8086:461e] (rev 02)
0000:00:0d.2 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #0 [8086:463e] (rev 02)
0000:00:0d.3 USB controller [0c03]: Intel Corporation Alder Lake-P Thunderbolt 4 NHI #1 [8086:466d] (rev 02)
0000:00:0e.0 RAID bus controller [0104]: Intel Corporation Volume Management Device NVMe RAID Controller [8086:467f]
0000:00:14.0 USB controller [0c03]: Intel Corporation Alder Lake PCH USB 3.2 xHCI Host Controller [8086:51ed] (rev 01)
0000:00:14.2 RAM memory [0500]: Intel Corporation Alder Lake PCH Shared SRAM [8086:51ef] (rev 01)
0000:00:14.3 Network controller [0280]: Intel Corporation Alder Lake-P PCH CNVi WiFi [8086:51f0] (rev 01)
0000:00:15.0 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #0 [8086:51e8] (rev 01)
0000:00:15.1 Serial bus controller [0c80]: Intel Corporation Alder Lake PCH Serial IO I2C Controller #1 [8086:51e9] (rev 01)
0000:00:16.0 Communication controller [0780]: Intel Corporation Alder Lake PCH HECI Controller [8086:51e0] (rev 01)
0000:00:1c.0 PCI bridge [0604]: Intel Corporation Alder Lake PCH-P PCI Express Root Port #9 [8086:51bf] (rev 01)
0000:00:1e.0 Communication controller [0780]: Intel Corporation Alder Lake PCH UART #0 [8086:51a8] (rev 01)
0000:00:1e.2 Serial bus controller [0c80]: Intel Corporation Device [8086:51aa] (rev 01)
0000:00:1f.0 ISA bridge [0601]: Intel Corporation Alder Lake PCH eSPI Controller [8086:5182] (rev 01)
0000:00:1f.3 Multimedia audio controller [0401]: Intel Corporation Alder Lake PCH-P High Definition Audio Controller [8086:51c8] (rev 01)
0000:00:1f.4 SMBus [0c05]: Intel Corporation Alder Lake PCH-P SMBus Host Controller [8086:51a3] (rev 01)
0000:00:1f.5 Serial bus controller [0c80]: Intel Corporation Alder Lake-P PCH SPI Controller [8086:51a4] (rev 01)
0000:55:00.0 SD Host controller [0805]: O2 Micro, Inc. SD/MMC Card Reader Controller [1217:8621] (rev 01)
10000:e0:06.0 PCI bridge [0604]: Intel Corporation 12th Gen Core Processor PCI Express x4 Controller #0 [8086:464d] (rev 02)
10000:e1:00.0 Non-Volatile memory controller [0108]: Micron Technology Inc Device [1344:5407]