Skip to contentSkip to conversation

conf: HdmiLpeAudio: remove the "front" pcm definition

PATCH In review Tanu Kaskinen 2 participants 4 messages Oct 4, 2017 – Oct 5, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 conf: HdmiLpeAudio: remove the "front" pcm definition

PulseAudio assumes that the "front" pcm device always refers to an analog device, not HDMI. While that assumption is not really valid, the reality is that without that assumption PulseAudio can't know whether "front" and "hdmi" refer to a different or the same device.

The HDMI LPE driver doesn't allow audio streaming while the HDMI cable is unplugged, so PulseAudio has to know when it's plugged in and when it's not. If both "front" and "hdmi" devices exist, PulseAudio will notice that HDMI is unplugged, but it doesn't know that "front" refers to the same device, and PulseAudio will try to use the "front" device with bad consequences. The kernel driver's refusal to stream any audio makes PulseAudio enter an infinite loop and then the kernel kills PulseAudio, because it consumes too much CPU time in a realtime thread.

While the looping in PulseAudio could probably be fixed, that wouldn't change the fact that PulseAudio thinks that there is an analog device. I believe it's best to avoid having the same device as both "front" and "hdmi" in alsa-lib.

I removed also the surround configuration includes. I don't think they had any effect anyway, so I wonder why they were there in the first place.

---
 src/conf/cards/HdmiLpeAudio.conf | 24 ------------------------
 1 file changed, 24 deletions(-)
src/conf/cards/HdmiLpeAudio.conf +0 -24
index 9fa30da0..a1e493da 100644
@@ -2,30 +2,6 @@
 # Configuration for the Intel HDMI/DP LPE audio
 #
 
-<confdir:pcm/front.conf>
-
-HdmiLpeAudio.pcm.front.0 {
-	@args [ CARD ]
-	@args.CARD {
-		type string
-	}
-	type softvol
-	slave.pcm {
-		type hw
-		card $CARD
-	}
-	control {
-		name "PCM Playback Volume"
-		card $CARD
-	}
-}
-
-<confdir:pcm/surround40.conf>
-<confdir:pcm/surround21.conf>
-<confdir:pcm/surround41.conf>
-<confdir:pcm/surround50.conf>
-<confdir:pcm/surround51.conf>
-
 <confdir:pcm/hdmi.conf>
 
 HdmiLpeAudio.pcm.hdmi.0 {
Signature · 1 line
2.14.2
#1 lore raw
Quoted 15 lines · Tanu Kaskinen

PulseAudio assumes that the "front" pcm device always refers to an analog device, not HDMI. While that assumption is not really valid, the reality is that without that assumption PulseAudio can't know whether "front" and "hdmi" refer to a different or the same device.

The HDMI LPE driver doesn't allow audio streaming while the HDMI cable is unplugged, so PulseAudio has to know when it's plugged in and when it's not. If both "front" and "hdmi" devices exist, PulseAudio will notice that HDMI is unplugged, but it doesn't know that "front" refers to the same device, and PulseAudio will try to use the "front" device with bad consequences. The kernel driver's refusal to stream any audio makes PulseAudio enter an infinite loop and then the kernel kills PulseAudio, because it consumes too much CPU time in a realtime thread.

Quoted 8 lines

While the looping in PulseAudio could probably be fixed, that wouldn't change the fact that PulseAudio thinks that there is an analog device. I believe it's best to avoid having the same device as both "front" and "hdmi" in alsa-lib.

I removed also the surround configuration includes. I don't think they had any effect anyway, so I wonder why they were there in the first place.

These definitions are there for LPCM surround channels.

The biggest problem behind the scene is that we mixed up both logical and physical configurations. The "front" or "surround51" belong to the former, while "hdmi" belongs to the latter.

In the past, there was only SPDIF that has only two stereo channels, so the logical configuration was fixed with that. We copied that config for HDMI/DP, and now we hit the inconsistency more clearly...

I suppose the PA issue gets fixed just by this removal? If yes, I'm willing to apply it, including in the next release.

thanks,

Takashi

Quoted 49 lines
---
 src/conf/cards/HdmiLpeAudio.conf | 24 ------------------------
 1 file changed, 24 deletions(-)
src/conf/cards/HdmiLpeAudio.conf +0 -24
index 9fa30da0..a1e493da 100644
@@ -2,30 +2,6 @@
 # Configuration for the Intel HDMI/DP LPE audio
 #
 
-<confdir:pcm/front.conf>
-
-HdmiLpeAudio.pcm.front.0 {
-	@args [ CARD ]
-	@args.CARD {
-		type string
-	}
-	type softvol
-	slave.pcm {
-		type hw
-		card $CARD
-	}
-	control {
-		name "PCM Playback Volume"
-		card $CARD
-	}
-}
-
-<confdir:pcm/surround40.conf>
-<confdir:pcm/surround21.conf>
-<confdir:pcm/surround41.conf>
-<confdir:pcm/surround50.conf>
-<confdir:pcm/surround51.conf>
-
 <confdir:pcm/hdmi.conf>
 
 HdmiLpeAudio.pcm.hdmi.0 {
Signature · 6 lines
2.14.2

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
#2 lore raw
Quoted 22 lines · Takashi Iwai
Quoted 20 lines · Tanu Kaskinen

PulseAudio assumes that the "front" pcm device always refers to an analog device, not HDMI. While that assumption is not really valid, the reality is that without that assumption PulseAudio can't know whether "front" and "hdmi" refer to a different or the same device.

The HDMI LPE driver doesn't allow audio streaming while the HDMI cable is unplugged, so PulseAudio has to know when it's plugged in and when it's not. If both "front" and "hdmi" devices exist, PulseAudio will notice that HDMI is unplugged, but it doesn't know that "front" refers to the same device, and PulseAudio will try to use the "front" device with bad consequences. The kernel driver's refusal to stream any audio makes PulseAudio enter an infinite loop and then the kernel kills PulseAudio, because it consumes too much CPU time in a realtime thread.

While the looping in PulseAudio could probably be fixed, that wouldn't change the fact that PulseAudio thinks that there is an analog device. I believe it's best to avoid having the same device as both "front" and "hdmi" in alsa-lib.

Quoted 5 lines
Quoted 3 lines

I removed also the surround configuration includes. I don't think they had any effect anyway, so I wonder why they were there in the first place.

These definitions are there for LPCM surround channels.

Are they supposed to do something useful? When PulseAudio probes the surround40:0 device, opening the device fails:

alsa-util.c: Trying surround40:0 with SND_PCM_NO_AUTO_FORMAT ... (alsa-lib)confmisc.c: Unable to find definition 'cards.HdmiLpeAudio.pcm.surround40.0:CARD=0' (alsa-lib)conf.c: function snd_func_refer returned error: No such file or directory (alsa-lib)conf.c: Evaluate error: No such file or directory
(alsa-lib)pcm.c: Unknown PCM surround40:0

Quoted 10 lines

The biggest problem behind the scene is that we mixed up both logical and physical configurations. The "front" or "surround51" belong to the former, while "hdmi" belongs to the latter.

In the past, there was only SPDIF that has only two stereo channels, so the logical configuration was fixed with that. We copied that config for HDMI/DP, and now we hit the inconsistency more clearly...

I suppose the PA issue gets fixed just by this removal? If yes, I'm willing to apply it, including in the next release.

A user reported that removing the "front" definition fixes the PA issue, together with jack detection patches for PA that haven't been merged yet.

Signature · 3 lines
Tanu

https://www.patreon.com/tanuk
#3 lore raw
Quoted 30 lines · Tanu Kaskinen
Quoted 22 lines · Takashi Iwai
Quoted 20 lines · Tanu Kaskinen

PulseAudio assumes that the "front" pcm device always refers to an analog device, not HDMI. While that assumption is not really valid, the reality is that without that assumption PulseAudio can't know whether "front" and "hdmi" refer to a different or the same device.

The HDMI LPE driver doesn't allow audio streaming while the HDMI cable is unplugged, so PulseAudio has to know when it's plugged in and when it's not. If both "front" and "hdmi" devices exist, PulseAudio will notice that HDMI is unplugged, but it doesn't know that "front" refers to the same device, and PulseAudio will try to use the "front" device with bad consequences. The kernel driver's refusal to stream any audio makes PulseAudio enter an infinite loop and then the kernel kills PulseAudio, because it consumes too much CPU time in a realtime thread.

While the looping in PulseAudio could probably be fixed, that wouldn't change the fact that PulseAudio thinks that there is an analog device. I believe it's best to avoid having the same device as both "front" and "hdmi" in alsa-lib.

Quoted 5 lines
Quoted 3 lines

I removed also the surround configuration includes. I don't think they had any effect anyway, so I wonder why they were there in the first place.

These definitions are there for LPCM surround channels.

Quoted 8 lines

Are they supposed to do something useful? When PulseAudio probes the surround40:0 device, opening the device fails:

alsa-util.c: Trying surround40:0 with SND_PCM_NO_AUTO_FORMAT ... (alsa-lib)confmisc.c: Unable to find definition 'cards.HdmiLpeAudio.pcm.surround40.0:CARD=0' (alsa-lib)conf.c: function snd_func_refer returned error: No such file or directory (alsa-lib)conf.c: Evaluate error: No such file or directory
(alsa-lib)pcm.c: Unknown PCM surround40:0

Hm, it might be not well tested, then :)

Quoted 8 lines
Quoted 8 lines

The biggest problem behind the scene is that we mixed up both logical and physical configurations. The "front" or "surround51" belong to the former, while "hdmi" belongs to the latter.

In the past, there was only SPDIF that has only two stereo channels, so the logical configuration was fixed with that. We copied that config for HDMI/DP, and now we hit the inconsistency more clearly...

Quoted 6 lines
Quoted 2 lines

I suppose the PA issue gets fixed just by this removal? If yes, I'm willing to apply it, including in the next release.

A user reported that removing the "front" definition fixes the PA issue, together with jack detection patches for PA that haven't been merged yet.

OK, I applied the patch now.

thanks,

Takashi