Bug 96272

Summary: PulseAudio does not set up all outputs on a soundcard as separate output devices by default
Product: PulseAudio Reporter: N. W. <nw9165-3201>
Component: coreAssignee: pulseaudio-bugs
Status: RESOLVED MOVED QA Contact: pulseaudio-bugs
Severity: normal    
Priority: medium CC: lennart
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description N. W. 2016-05-30 00:07:43 UTC
Hi,

PulseAudio unfortunately does not set up all outputs on a soundcard as separate output devices by default.

By default, each soundcard is only listed as one output device in the pavucontrol "Output Devices" tab, even if the soundcard has more than one output.

So, you have to switch between each output via the "Configuration" tab in pavucontrol, as shown in the following screenshot for example:

https://www.maketecheasier.com/assets/uploads/2010/12/hdmi-pavucontrol.png

And it is not possible to tell one app to use the "Analog Stereo Output" and another app to use the "Digital Stereo (HDMI) Output".

Why aren't "Analog Stereo Output" and "Digital Stereo (HDMI) Output" listed as separate output devices on the "Output Devices" tab in pavucontrol by default?

As far as I understand, the user has to add each output himself via:

load-module module-alsa-sink device=hw:x,x

?

But why?

Why isn't this being done by default?

And could you please change it?

Regards
Comment 1 Raymond 2016-05-31 03:26:33 UTC
only hda-intel support multistreaming and multiple HDMI , display port

ttps://cgit.freedesktop.org/pulseaudio/pulseaudio/commit/src/modules/alsa/mixer/profile-sets/default.conf?id=afbe9605c64ae896e7ebf1dc259976fecd5b2628

most sound card don't support multi-streaming (e.g. usb audio)


http://www.intel.com/content/www/us/en/support/boards-and-kits/desktop-boards/000007156.html

http://www.intel.com/content/www/us/en/chipsets/high-definition-audio-multi-stream.html
Comment 2 N. W. 2016-05-31 08:46:58 UTC
(In reply to Raymond from comment #1)
> most soundcard don't support multi-streaming (e.g. usb audio)

And what happens when trying to use multistreaming on a soundcard that does not support multistreaming?

Would it damage anything?

(In reply to Raymond from comment #1)
> only hda-intel support multistreaming and multiple HDMI , display port

Hm, but the links that you provided mentions Realtek as well, see:

http://www.intel.com/content/dam/support/us/en/documents/motherboards/desktop/sb/multistreamingplaybackforrealtek_v3.pdf
http://www.intel.com/content/www/us/en/support/boards-and-kits/desktop-boards/000007156.html

So, when Intel and Realtek soundcards are supported, that would cover pretty much all soundcards that are being sold today, since almost every mainboard has those on-board.
Comment 3 Raymond 2016-05-31 12:44:08 UTC
For alsa driver , only ADI and VIA codecs support independent HP

you need to use hint if you are using Realtek or IDT codecs


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/log/sound/pci/hda?qt=grep&q=independent+hp


for display port 1.2 multi-stream transport (MST) over single DP port

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=f1aa06847506d5b88f5eb41fae6a24a7128097e7


seem not fully support using dasiy chain of three display port monitors
Comment 4 Raymond 2016-05-31 13:13:33 UTC
if the number of playback stream cannot read from GCAP register, it is hardcode

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/plain/sound/pci/hda/hda_intel.c

	/* read number of streams from GCAP register instead of using
	 * hardcoded value
	 */
	chip->capture_streams = (gcap >> 8) & 0x0f;
	chip->playback_streams = (gcap >> 12) & 0x0f;
	if (!chip->playback_streams && !chip->capture_streams) {
		/* gcap didn't give any info, switching to old method */

		switch (chip->driver_type) {
		case AZX_DRIVER_ULI:
			chip->playback_streams = ULI_NUM_PLAYBACK;
			chip->capture_streams = ULI_NUM_CAPTURE;
			break;
		case AZX_DRIVER_ATIHDMI:
		case AZX_DRIVER_ATIHDMI_NS:
			chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
			chip->capture_streams = ATIHDMI_NUM_CAPTURE;
			break;
		case AZX_DRIVER_GENERIC:
		default:
			chip->playback_streams = ICH6_NUM_PLAYBACK;
			chip->capture_streams = ICH6_NUM_CAPTURE;
			break;
		}
	}
Comment 5 Raymond 2016-05-31 14:33:08 UTC
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_codec.c?id=9a08160bdbe3148a405f72798f76e2a5d30bd243


When "IEC958 Default PCM" switch is on, the PCM stream is routed both to analog and SPDIF outputs.

the driver also allow HDA_DIG_ANALOG_DUP change to HDA_DIG_EXCLUSIVE

https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/hda_codec.c?id=5930ca41857f57e130b4438a9a261b2ab91f6fcf
Comment 6 N. W. 2016-05-31 23:28:46 UTC
And what does that mean in layman's terms?
Comment 7 Raymond 2016-06-01 00:32:38 UTC
the number of playback streams is limited by the capability of hda controllers

this does not mean all playback streams can use the maximum sampling rate of the codec

if you have more than one stream playing
Comment 8 Raymond 2016-06-01 00:45:44 UTC
when your hda codec have both analog and digital pin, the driver allow pcm send to both analog and digital output when playing pcm to device 0 ( HDA_DIG_ANALOG_DUP)

but it also allow application open device 1 to send AC3 to digital output ( HDA_DIG_EXCLUSIVE)
Comment 9 Raymond 2016-06-01 02:14:53 UTC
can you post the output of alsa-info.sh


http://www.intel.com/content/dam/support/us/en/documents/boardsandkits/wizards/NUC_multi-display/
Comment 10 Raymond 2016-06-01 03:28:56 UTC
http://www.intel.com/content/www/us/en/support/graphics-drivers/000005556.html


How many audio streams do Intel® Core™ Processors support in multiple display configurations?

3rd Generation Intel® Core™ Processor Family with Intel® 7 Series Chipset	Three simultaneous audio streams are supported, with one premium audio.

3rd Generation Intel® Core™ Processor Family with Intel® 6 Series Chipset	Two simultaneous audio streams are supported, with one premium audio.

4th Generation Intel® Core™ Processor Family	Two simultaneous audio streams are supported, with one premium audio.
Comment 11 Raymond 2016-06-01 07:46:28 UTC
(In reply to nw9165-3201 from comment #2)
> (In reply to Raymond from comment #1)
> > most soundcard don't support multi-streaming (e.g. usb audio)
> 
> And what happens when trying to use multistreaming on a soundcard that does
> not support multistreaming?
> 


http://git.alsa-project.org/?p=alsa-lib.git&a=search&h=HEAD&st=commit&s=hdmi

only snd-hda-intel use HDMI device 

only a few sound cards support multiple playback streams (e.g. emu10k1 which have front, rear, .side pcm devices )

http://git.alsa-project.org/?p=alsa-lib.git;a=blob;f=src/conf/cards/EMU10K1.conf;hb=HEAD
Comment 12 N. W. 2016-06-01 23:39:06 UTC
(In reply to Raymond from comment #7)
> the number of playback streams is limited by the capability of hda
> controllers

Well, I'd say the number of playback streams rather is limited by PulseAudio.

Because PulseAudio does not set up all outputs on a soundcard as separate output devices by default, even if the soundcard has several outputs and even if the soundcard supports several playback streams.

As far as I can tell, the only way for a user to actually know if his soundcard supports several playback streams is by  fiddling around with the terminal and/or config files using things like "load-module module-alsa-sink device=hw:x,x" to enable the other outputs.

Why doesn't PulseAudio simply set up all outputs on a soundcard as separate output devices by default to save the usera from all this trouble?

That way a user could check out the limitations of his soundcard himself and could use it to it's full potential.

Regards
Comment 13 Raymond 2016-06-02 03:45:53 UTC
the playback SDOs are not only used bu HDA audio codec, those HDA modem codec also need 

if alsa driver add "Alt Analog" playback device for those notebook, it will needt to check whether HDA controller have enough playback streams since some HDA controller only support two SDO

**** List of PLAYBACK Hardware Devices ****
card 0: VT82xx [HDA VIA VT82xx], device 0: VT1708 Analog [VT1708 Analog]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 0: VT82xx [HDA VIA VT82xx], device 6: Si3054 Modem [Si3054 Modem]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Comment 14 Raymond 2016-06-02 11:34:05 UTC
> As far as I understand, the user has to add each output himself via:

> load-module module-alsa-sink device=hw:x,x



https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/tree/Documentation/sound/alsa/HD-Audio-Controls.txt

* Independent HP
  When this enum control is enabled, the headphone output is routed
  from an individual stream (the third PCM such as hw:0,2) instead of
  the primary stream.

you need to turn on "Independent HP" before pulseaudio probe the alt analog device since it is disabled by default


https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=d1f15e06b2af57228d11e33e06a172ff58f5bc1c


APLAY

**** List of PLAYBACK Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD1988 Analog [AD1988 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: AD1988 Digital [AD1988 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: AD1988 Alt Analog [AD1988 Alt Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0

ARECORD

**** List of CAPTURE Hardware Devices ****
card 0: Intel [HDA Intel], device 0: AD1988 Analog [AD1988 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 1: AD1988 Digital [AD1988 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: Intel [HDA Intel], device 2: AD1988 Alt Analog [AD1988 Alt Analog]
  Subdevices: 2/2
  Subdevice #0: subdevice #0
  Subdevice #1: subdevice #1



you need to add new mapping 


https://cgit.freedesktop.org/pulseaudio/pulseaudio/tree/src/modules/alsa/mixer/profile-sets/default.conf


[Mapping alt-analog-stereo]
device-strings = hw:%f,2
channel-map = left,right
paths-output = analog-output-headphones
paths-input = analog-input-front-mic
priority = 10
Comment 15 GitLab Migration User 2018-07-30 10:29:40 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/pulseaudio/pulseaudio/issues/462.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.