Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F170752533
D59084.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D59084.diff
View Options
diff --git a/sys/dev/sound/pcm/dsp.c b/sys/dev/sound/pcm/dsp.c
--- a/sys/dev/sound/pcm/dsp.c
+++ b/sys/dev/sound/pcm/dsp.c
@@ -186,18 +186,28 @@
(direction == PCMDIR_REC && d->flags & SD_F_RVCHANS);
*ch = NULL;
+
+ /*
+ * Prefer an idle primary channel, so that devices which provide more
+ * than one of them use them all, instead of stacking every client on
+ * the first one.
+ */
CHN_FOREACH(c, d, channels.pcm.primary) {
CHN_LOCK(c);
- if (c->direction != direction) {
- CHN_UNLOCK(c);
- continue;
- }
- /* Find an available primary channel to use. */
- if ((c->flags & CHN_F_BUSY) == 0 ||
- (vdir_enabled && (c->flags & CHN_F_HAS_VCHAN)))
+ if (c->direction == direction && (c->flags & CHN_F_BUSY) == 0)
break;
CHN_UNLOCK(c);
}
+ /* Fall back to sharing a primary channel that already has vchans. */
+ if (c == NULL && vdir_enabled) {
+ CHN_FOREACH(c, d, channels.pcm.primary) {
+ CHN_LOCK(c);
+ if (c->direction == direction &&
+ (c->flags & CHN_F_HAS_VCHAN))
+ break;
+ CHN_UNLOCK(c);
+ }
+ }
if (c == NULL)
return (EBUSY);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Sep 7, 10:19 AM (6 h, 46 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
37093316
Default Alt Text
D59084.diff (1 KB)
Attached To
Mode
D59084: sound: Prefer idle primary channels when allocating
Attached
Detach File
Event Timeline
Log In to Comment