Page MenuHomeFreeBSD

sound: Simplify vchan_getparentchannel()
AbandonedPublic

Authored by christos on Dec 4 2024, 4:57 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jan 4, 10:09 PM
Unknown Object (File)
Thu, Dec 26, 11:50 AM
Unknown Object (File)
Thu, Dec 26, 6:17 AM
Unknown Object (File)
Thu, Dec 26, 1:13 AM
Unknown Object (File)
Sat, Dec 14, 6:37 PM
Unknown Object (File)
Sun, Dec 8, 10:23 PM
Unknown Object (File)
Dec 4 2024, 10:13 PM
Unknown Object (File)
Dec 4 2024, 10:13 PM
Subscribers

Details

Summary

Since FILLME ("sound: Allocate vchans on-demand") introduced the
"primary" channel sub-list, we can use it in vchan_getparentchannel() to
loop only through the primary channels, which is what we are looking for
anyway.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 60957
Build 57841: arc lint + arc unit

Event Timeline

Not a consequence of your changes here, but it seems we only set the vchan settings on the first channel per direction. There could be multiple, right?

IIRC, there's only one or two sound drivers that support multiple channels per direction. Maybe we should evaluate whether that's actually required and worth the complication it causes throughout the sound module.

Not a consequence of your changes here, but it seems we only set the vchan settings on the first channel per direction. There could be multiple, right?

IIRC, there's only one or two sound drivers that support multiple channels per direction. Maybe we should evaluate whether that's actually required and worth the complication it causes throughout the sound module.

There are more places in pcm/ where we always pick the first primary channel. I guess we could implement some heuristics, like choosing the first non-busy channel, or else fall back to the first channel, or the channel with the least vchans, in order to balance things out, but that would require multiple changes throughout sound(4), so we could discuss this further in an email.

Not a consequence of your changes here, but it seems we only set the vchan settings on the first channel per direction. There could be multiple, right?

IIRC, there's only one or two sound drivers that support multiple channels per direction. Maybe we should evaluate whether that's actually required and worth the complication it causes throughout the sound module.

There are more places in pcm/ where we always pick the first primary channel. I guess we could implement some heuristics, like choosing the first non-busy channel, or else fall back to the first channel, or the channel with the least vchans, in order to balance things out, but that would require multiple changes throughout sound(4), so we could discuss this further in an email.

Just to clarify, my general proposal would be to see whether we can limit all drivers to at most one primary channel per direction. If that's possible, the primary channel list reduces to two fields (one per direction), and handling them should become easier in the places you mention. It's a separate discussion though, agreed.

My point regarding the code here is that we change settings for only one of the primary channels, while we should do this for all primary channels to keep them consistent. Which is an example of where it would be easier to have only one primary channel per direction.

Not a consequence of your changes here, but it seems we only set the vchan settings on the first channel per direction. There could be multiple, right?

IIRC, there's only one or two sound drivers that support multiple channels per direction. Maybe we should evaluate whether that's actually required and worth the complication it causes throughout the sound module.

There are more places in pcm/ where we always pick the first primary channel. I guess we could implement some heuristics, like choosing the first non-busy channel, or else fall back to the first channel, or the channel with the least vchans, in order to balance things out, but that would require multiple changes throughout sound(4), so we could discuss this further in an email.

Just to clarify, my general proposal would be to see whether we can limit all drivers to at most one primary channel per direction. If that's possible, the primary channel list reduces to two fields (one per direction), and handling them should become easier in the places you mention. It's a separate discussion though, agreed.

My point regarding the code here is that we change settings for only one of the primary channels, while we should do this for all primary channels to keep them consistent. Which is an example of where it would be easier to have only one primary channel per direction.

I guess one way to go about addressing this would be to actually get rid of vchan_getparentchannel() altogether, and instead wrap the related sysctl codes around a loop through the primary channel list (see D47917). For sysctl_dev_pcm_vchanrate() and sysctl_dev_pcm_vchanformat() this is very trivial to implement. For sysctl_dev_pcm_vchanmode() it's probably trickier, because the code seems to fetch the mode from the primary channel directly; maybe this is something we should store in snddev_info instead, like vchanformat/vchanrate?

Not a consequence of your changes here, but it seems we only set the vchan settings on the first channel per direction. There could be multiple, right?

IIRC, there's only one or two sound drivers that support multiple channels per direction. Maybe we should evaluate whether that's actually required and worth the complication it causes throughout the sound module.

There are more places in pcm/ where we always pick the first primary channel. I guess we could implement some heuristics, like choosing the first non-busy channel, or else fall back to the first channel, or the channel with the least vchans, in order to balance things out, but that would require multiple changes throughout sound(4), so we could discuss this further in an email.

Just to clarify, my general proposal would be to see whether we can limit all drivers to at most one primary channel per direction. If that's possible, the primary channel list reduces to two fields (one per direction), and handling them should become easier in the places you mention. It's a separate discussion though, agreed.

My point regarding the code here is that we change settings for only one of the primary channels, while we should do this for all primary channels to keep them consistent. Which is an example of where it would be easier to have only one primary channel per direction.

I guess one way to go about addressing this would be to actually get rid of vchan_getparentchannel() altogether, and instead wrap the related sysctl codes around a loop through the primary channel list (see D47917). For sysctl_dev_pcm_vchanrate() and sysctl_dev_pcm_vchanformat() this is very trivial to implement. For sysctl_dev_pcm_vchanmode() it's probably trickier, because the code seems to fetch the mode from the primary channel directly; maybe this is something we should store in snddev_info instead, like vchanformat/vchanrate?

D48335 for the vchanmode issue.

And D48336 for the multiple primary channels issue. Closing this.