modules: try to document the passive ports better

This commit is contained in:
Wim Taymans 2026-03-12 12:13:43 +01:00
parent f11ab0da3e
commit ad195b289a

View file

@ -105,18 +105,17 @@ static int ensure_state(struct pw_impl_node *node, bool running)
state = PW_NODE_STATE_IDLE; state = PW_NODE_STATE_IDLE;
return pw_impl_node_set_state(node, state); return pw_impl_node_set_state(node, state);
} }
/* Make a node runnable. Peer nodes are also made runnable when the passive_into state
/* make a node runnable. This will automatically also make all non-passive peer nodes * of the port is false, which is only when the port is folow or non-passive.
* runnable and the nodes that belong to the same groups or link_groups. We stop when
* we reach a passive_into port.
* *
* We have 4 cases for the links: * away into
* (p) marks a passive_into port. we don't follow the peer from this port. * false : false false
* true : true true <- passive_into peer ports skipped
* follow : true false
* *
* A -> B ==> B can also be runnable * A (*) -> B if A running -> B set to running
* A p-> B ==> B can also be runnable * A (*) -> (f) B if A running -> B set to running
* A ->p B ==> B can not be runnable * A (*) -> (p) B if A running -> B no change
* A p->p B ==> B can not be runnable
*/ */
static void make_runnable(struct pw_context *context, struct pw_impl_node *node) static void make_runnable(struct pw_context *context, struct pw_impl_node *node)
{ {
@ -188,22 +187,24 @@ static void make_runnable(struct pw_context *context, struct pw_impl_node *node)
} }
} }
/* check if a node and its peer can run. They can both run if there is a non-passive /* check if a node and its peer can run.
* link between them. The passive link is between 1 or more passive ports.
* *
* There are 4 cases: * When looking at a node we only consider the non passive_away links, the
* passive_away links from the node don't make the peer or node runnable.
* *
* (p) marks a passive_away port. we don't follow the peer from this port. * away into
* A can not be a driver * false : false false <- !passive_away ports followed
* true : true true
* follow : true false
* *
* A -> B ==> both nodes can run * A port only has a passive_away link when the port is set to non-passive.
* A ->p B ==> both nodes can run (B is passive so it can't activate A, but * All other port modes don't make A and B runnable.
* A can activate B)
* A p-> B ==> nodes don't run, port A is passive and doesn't activate B
* A p->p B ==> nodes don't run
* *
* Once we decide the two nodes should be made runnable we do make_runnable() * A -> B A + B both set to running
* on both. * A -> (p) B A + B both set to running
* A -> (f) B A + B both set to running
* A (p) -> (*) B A + B no change
* A (f) -> (*) B A + B no change
*/ */
static void check_runnable(struct pw_context *context, struct pw_impl_node *node) static void check_runnable(struct pw_context *context, struct pw_impl_node *node)
{ {