Skip to contentSkip to conversation

ucm: docs: Add EchoReferenceDev

PATCH In review [email protected] 5 participants 15 messages Aug 24, 2023 – Aug 31, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 ucm: docs: Add EchoReferenceDev

From: Curtis Malainey <[email protected]>

Sometimes userspace may want to use a reference channel to cancel echos when using video chat, this value identifies the device which carries that channel.

---
 include/use-case.h | 9 +++++++++
 1 file changed, 9 insertions(+)
include/use-case.h +9 -0
index e5d4fd68..3c7c0a26 100644
@@ -376,6 +376,15 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
  *   - CaptureMicInfoFile
  *      - json file with the microphone array placement and type description
  *        (e.g. output from nhlt-dmic-info)
+ *   - EchoReferenceDev
+ *	- The name of a section device that provides some sort of reference
+ *	  to the current section device. This can be a echo taken as a
+ *	  reference or as IV data from a smart amp. The device should be
+ *	  opened immediately after this device and closed right before this
+ *	  device. This is meant to support hardware features such as smart
+ *	  amps or hardware offloaded processing where the host still needs
+ *	  to open the channel. The audio server should open the reference
+ *	  device with the same parameters it opens the source device with.
  *   - EDIDFile
  *      - Path to EDID file for HDMI devices
  *   - JackCTL
Signature · 1 line
2.42.0.rc1.204.g551eb34607-goog
#1 lore raw

PATCH 2/2 ucm: docs: Add IVEchoData

From: Curtis Malainey <[email protected]>

Provide a UCM value to mark devices which are needed to be opened only for HW purposes but should not be consumed for userspace.

---
 include/use-case.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/use-case.h +6 -0
index 3c7c0a26..3d629667 100644
@@ -387,6 +387,12 @@ int snd_use_case_get_list(snd_use_case_mgr_t *uc_mgr,
  *	  device with the same parameters it opens the source device with.
  *   - EDIDFile
  *      - Path to EDID file for HDMI devices
+ *   - IVDataEcho
+ *      - Used only on devices pointed to by EchoReferenceDev. Used to mark
+ *        references that might be lower quality (e.g. reduced bit depth) as
+ *        they are intended for a HW feature and not userspace consumption.
+ *        These PCMs still need to be opened by userspace but are not
+ *        recommended for consumption.
  *   - JackCTL
  *      - jack control device name
  *   - JackControl
Signature · 1 line
2.42.0.rc1.204.g551eb34607-goog
#2 lore raw

Re: [PATCH 2/2] ucm: docs: Add IVEchoData

Quoted 4 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Provide a UCM value to mark devices which are needed to be opened only for HW purposes but should not be consumed for userspace.

It would be probably better to describe this in the standard ALSA PCM API than UCM. If the device is special, applications without UCM should be also allowed to identify them.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#3 lore raw

Re: [PATCH 2/2] ucm: docs: Add IVEchoData

Curtis Malainey | Chrome OS Audio Senior Software Engineer | [email protected] | Sound Open Firmware Lead

Quoted 4 lines · Jaroslav Kysela
Quoted 2 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Quoted 8 lines
Quoted 2 lines

Provide a UCM value to mark devices which are needed to be opened only for HW purposes but should not be consumed for userspace.

It would be probably better to describe this in the standard ALSA PCM API than UCM. If the device is special, applications without UCM should be also allowed to identify them.

Jaroslav

Would something like an additional device class and a format subclass be acceptable?

Curtis

#4 lore raw

Re: [PATCH 2/2] ucm: docs: Add IVEchoData

Quoted 12 lines · Curtis Malainey

Curtis Malainey | Chrome OS Audio Senior Software Engineer | [email protected] | Sound Open Firmware Lead

Quoted 7 lines · Jaroslav Kysela
Quoted 4 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Provide a UCM value to mark devices which are needed to be opened only for HW purposes but should not be consumed for userspace.

Quoted 8 lines
Quoted 5 lines

It would be probably better to describe this in the standard ALSA PCM API than UCM. If the device is special, applications without UCM should be also allowed to identify them.

Jaroslav

Would something like an additional device class and a format subclass be acceptable?

The device class extension sounds good.

I don't know details for the format extension - does app require to set hw_params ? If yes, is the goal to prevent standard applications to set the hw_params ? If no, the format bitmask may be set to zero, thus hw_params will always fail.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#5 lore raw
In reply to [email protected]
Quoted 5 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Sometimes userspace may want to use a reference channel to cancel echos when using video chat, this value identifies the device which carries that channel.

The UCM modifier should be used for this - see "Echo Reference" comments in use-case.h.

Note that this allows additional setup (in Sequences) for this stream.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#6 lore raw
Quoted 8 lines · Jaroslav Kysela
Quoted 5 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Sometimes userspace may want to use a reference channel to cancel echos when using video chat, this value identifies the device which carries that channel.

Quoted 6 lines

The UCM modifier should be used for this - see "Echo Reference" comments in use-case.h.

Note that this allows additional setup (in Sequences) for this stream.

Jaroslav

I was under the impression modifiers were state manipulators that acted upon existing devices/pcms and did not designate their own PCM. That is at least how we use them in CRAS.

Are there any examples of how to designate a PCM? I don't see any modifiers at all in ucm-conf repo.

Curtis

Quoted 5 lines

--
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

#7 lore raw
Quoted 14 lines · Curtis Malainey
Quoted 13 lines · Jaroslav Kysela
Quoted 5 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Sometimes userspace may want to use a reference channel to cancel echos when using video chat, this value identifies the device which carries that channel.

The UCM modifier should be used for this - see "Echo Reference" comments in use-case.h.

Note that this allows additional setup (in Sequences) for this stream.

Quoted 8 lines
Quoted 1 line

Jaroslav

I was under the impression modifiers were state manipulators that acted upon existing devices/pcms and did not designate their own PCM. That is at least how we use them in CRAS.

Are there any examples of how to designate a PCM? I don't see any modifiers at all in ucm-conf repo.

I will second Curtis' request for clarifications.

I naively thought that modifiers would be used to e.g. select a 'Deep Buffer' output for low-power playback, or different capture streams based on the needs of the applications. It's not uncommon for capture applications to request different PCM streams for raw, AEC processed, AEC+NS processed data.

Echo reference is not really something that varies based on any qualifiers. And specifically in the Chrome case we want userspace to open the PCM echo reference device whenever the playback is used. So it's not really a use-case dependent thing but more a way to express a dependency between PCM devices.

#8 lore raw

I would triple this for the steamOS case, which has an inversion of this problem (a playback device that has a coupled capture device for speaker management). Coupling PCM devices statically in the UCM file avoids a class of side effects that could occur if one tried to implement the same behavior with exec calls in Enable/DisableSequence.

Quoted 41 lines · Pierre-Louis Bossart
Quoted 10 lines · Curtis Malainey
Quoted 9 lines · Jaroslav Kysela
Quoted 5 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Sometimes userspace may want to use a reference channel to cancel echos when using video chat, this value identifies the device which carries that channel.

The UCM modifier should be used for this - see "Echo Reference"

comments in

Quoted 4 lines
Quoted 4 lines

use-case.h.

Note that this allows additional setup (in Sequences) for this stream.

Quoted 8 lines
Quoted 1 line

Jaroslav

I was under the impression modifiers were state manipulators that acted upon existing devices/pcms and did not designate their own PCM. That is at least how we use them in CRAS.

Are there any examples of how to designate a PCM? I don't see any modifiers at all in ucm-conf repo.

I will second Curtis' request for clarifications.

I naively thought that modifiers would be used to e.g. select a 'Deep Buffer' output for low-power playback, or different capture streams based on the needs of the applications. It's not uncommon for capture applications to request different PCM streams for raw, AEC processed, AEC+NS processed data.

Echo reference is not really something that varies based on any qualifiers. And specifically in the Chrome case we want userspace to open the PCM echo reference device whenever the playback is used. So it's not really a use-case dependent thing but more a way to express a dependency between PCM devices.

Signature · 3 lines
Sincerely,
Ethan Geller <http://ethangeller.com>
LinkedIn <http://www.linkedin.com/pub/ethan-geller/3a/413/768>
#9 lore raw
In reply to Pierre-Louis Bossart
Quoted 34 lines · Pierre-Louis Bossart
Quoted 14 lines · Curtis Malainey
Quoted 13 lines · Jaroslav Kysela
Quoted 5 lines · On 24. 08. 23 23:33, [email protected] wrote:

From: Curtis Malainey <[email protected]>

Sometimes userspace may want to use a reference channel to cancel echos when using video chat, this value identifies the device which carries that channel.

The UCM modifier should be used for this - see "Echo Reference" comments in use-case.h.

Note that this allows additional setup (in Sequences) for this stream.

Quoted 8 lines
Quoted 1 line

Jaroslav

I was under the impression modifiers were state manipulators that acted upon existing devices/pcms and did not designate their own PCM. That is at least how we use them in CRAS.

Are there any examples of how to designate a PCM? I don't see any modifiers at all in ucm-conf repo.

I will second Curtis' request for clarifications.

I naively thought that modifiers would be used to e.g. select a 'Deep Buffer' output for low-power playback, or different capture streams based on the needs of the applications. It's not uncommon for capture applications to request different PCM streams for raw, AEC processed, AEC+NS processed data.

Quoted 5 lines

Echo reference is not really something that varies based on any qualifiers. And specifically in the Chrome case we want userspace to open the PCM echo reference device whenever the playback is used. So it's not really a use-case dependent thing but more a way to express a dependency between PCM devices.

It seems that there are some assumptions. I will try to address some things:

You can enable/use multiple modifiers per device.

The modifiers may define extra PCM streams in the standard Value section - you can use CapturePCM value for the modifier like "Echo Reference". Modifiers may alter the characteristics of the original UCM device stream (using command sequences), too.

Modifiers are an extra layer on top of devices. I don't think that we have any default relation between the modifier PCM device and the original PCM device (from the UCM device definition). A new value to describe this (like "ReplacePlaybackPCM 1") may be introduced. Another issue is when multiple modifiers with this description are active - they conflict, so it should be described somewhere, too. Perhaps, "ConflictingModifier" array may be added to API. But those extensions are not required for the "Echo Reference" modifier.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#10 lore raw
Quoted 6 lines

It seems that there are some assumptions. I will try to address some things:

Quoted 6 lines

You can enable/use multiple modifiers per device.

The modifiers may define extra PCM streams in the standard Value section
- you can use CapturePCM value for the modifier like "Echo Reference". Modifiers may alter the characteristics of the original UCM device stream (using command sequences), too.

Sorry, not following.

The 'modifier' has to be selected by userspace, isn't it? "someone" has to tell UCM that the 'echo reference' is on.

And that's precisely the conceptual issue I have. The echo reference in our cases is ALWAYS available when the speaker output is selected.

In other words, we are asking userspace to select something that is always present and available. Or put differently, a modifier that's always applicable is not really a modifier, is it?

And last, the whole story of the echo reference is that it needs to be opened when the speaker output is opened. How would we model this with the modifier concept?

Quoted 8 lines

Modifiers are an extra layer on top of devices. I don't think that we have any default relation between the modifier PCM device and the original PCM device (from the UCM device definition). A new value to describe this (like "ReplacePlaybackPCM 1") may be introduced. Another issue is when multiple modifiers with this description are active - they conflict, so it should be described somewhere, too. Perhaps, "ConflictingModifier" array may be added to API. But those extensions are not required for the "Echo Reference" modifier.

Right, the main issue here is that the PlaybackPCM and Echo reference PCM are joined and need to be handled at the same time. It's not a conflict, they are a bundle or a set of devices that cannot be used independently.

#11 lore raw
Quoted 13 lines · Pierre-Louis Bossart
Quoted 6 lines

It seems that there are some assumptions. I will try to address some things:

Quoted 6 lines

You can enable/use multiple modifiers per device.

The modifiers may define extra PCM streams in the standard Value section
- you can use CapturePCM value for the modifier like "Echo Reference". Modifiers may alter the characteristics of the original UCM device stream (using command sequences), too.

Quoted 7 lines

Sorry, not following.

The 'modifier' has to be selected by userspace, isn't it? "someone" has to tell UCM that the 'echo reference' is on.

And that's precisely the conceptual issue I have. The echo reference in our cases is ALWAYS available when the speaker output is selected.

The function of modifier is selected by it's name, so an app should know, how to handle the "Echo Reference". And this use is optional.

Quoted 3 lines

In other words, we are asking userspace to select something that is always present and available. Or put differently, a modifier that's always applicable is not really a modifier, is it?

Yes, in this special case, only joined PCM will be provided. But do not forget, that we have command sequences for modifiers, if we need to initialize something else like related controls for this stream in future. It's just more universal than to hardcode this to key/value in the UCM device definition.

Quoted 3 lines

And last, the whole story of the echo reference is that it needs to be opened when the speaker output is opened. How would we model this with the modifier concept?

The modifiers are allowed to be activated only for the active devices. We can refine the use of the "Echo Reference" for applications and define that the playback PCM should be opened at first. If we need to alter this default behaviour in future, we may put a hint to configuration values.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.
#12 lore raw
In reply to Jaroslav Kysela
Quoted 6 lines · Jaroslav Kysela

The modifiers may define extra PCM streams in the standard Value section - you can use CapturePCM value for the modifier like "Echo Reference". Modifiers may alter the characteristics of the original UCM device stream (using command sequences), too.

Thanks for the clarification, that indeed is where the assumption I think for most of us is not as clear. I would have never thought a modifier would carry a PCM.

I will trigger some work internally to convert our value to the modifier syntax.

Curtis

Quoted 15 lines

Modifiers are an extra layer on top of devices. I don't think that we have any default relation between the modifier PCM device and the original PCM device (from the UCM device definition). A new value to describe this (like "ReplacePlaybackPCM 1") may be introduced. Another issue is when multiple modifiers with this description are active - they conflict, so it should be described somewhere, too. Perhaps, "ConflictingModifier" array may be added to API. But those extensions are not required for the "Echo Reference" modifier.

Jaroslav

--
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.

#13 lore raw
Quoted 10 lines · Curtis Malainey
Quoted 8 lines · Jaroslav Kysela

Modifiers are an extra layer on top of devices. I don't think that we have any default relation between the modifier PCM device and the original PCM device (from the UCM device definition). A new value to describe this (like "ReplacePlaybackPCM 1") may be introduced. Another issue is when multiple modifiers with this description are active - they conflict, so it should be described somewhere, too. Perhaps, "ConflictingModifier" array may be added to API. But those extensions are not required for the "Echo Reference" modifier.

What is the expectation for naming and relationship to the devices? Is the Modifier a suffix to the device name to associate it?

Curtis

#14 lore raw
Quoted 13 lines · Curtis Malainey
Quoted 10 lines · Curtis Malainey
Quoted 8 lines · Jaroslav Kysela

Modifiers are an extra layer on top of devices. I don't think that we have any default relation between the modifier PCM device and the original PCM device (from the UCM device definition). A new value to describe this (like "ReplacePlaybackPCM 1") may be introduced. Another issue is when multiple modifiers with this description are active - they conflict, so it should be described somewhere, too. Perhaps, "ConflictingModifier" array may be added to API. But those extensions are not required for the "Echo Reference" modifier.

Quoted 2 lines

What is the expectation for naming and relationship to the devices? Is the Modifier a suffix to the device name to associate it?

Verbs, devices and modifiers should be named according use-case.h:

https://www.alsa-project.org/alsa-doc/alsa-lib/group__ucm.html

The relation is defined using SupportedDevices or ConflictingDevices array. Those arrays are available in modifiers, too.

Jaroslav

Signature · 2 lines
Jaroslav Kysela <[email protected]>
Linux Sound Maintainer; ALSA Project; Red Hat, Inc.