Improve naming

master -> driving
priority_master -> priority_driver
segment_master -> segment_owner
This commit is contained in:
Wim Taymans 2020-08-06 13:49:33 +02:00
parent 98b7dc7c0c
commit e71936f870
14 changed files with 63 additions and 62 deletions

View file

@ -67,7 +67,7 @@ load-module libpipewire-module-session-manager
#create-object spa-device-factory factory.name=api.alsa.seq.bridge node.name=Internal-MIDI-Bridge
#create-object adapter factory.name=audiotestsrc node.name=my-test
#create-object spa-node-factory factory.name=api.vulkan.compute.source node.name=my-compute-source
create-object spa-node-factory factory.name=support.node.driver node.name=Dummy priority.master=8000
create-object spa-node-factory factory.name=support.node.driver node.name=Dummy priority.driver=8000
## exec <program-name>
#

View file

@ -247,8 +247,8 @@ static struct node *alsa_create_node(struct device *device, uint32_t id,
else if (strstr(profile, "iec958-") == profile)
priority += 8;
if (pw_properties_get(node->props, PW_KEY_PRIORITY_MASTER) == NULL) {
pw_properties_setf(node->props, PW_KEY_PRIORITY_MASTER, "%d", priority);
if (pw_properties_get(node->props, PW_KEY_PRIORITY_DRIVER) == NULL) {
pw_properties_setf(node->props, PW_KEY_PRIORITY_DRIVER, "%d", priority);
pw_properties_setf(node->props, PW_KEY_PRIORITY_SESSION, "%d", priority);
}

View file

@ -868,7 +868,7 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
/* start from all drivers and group all nodes that are linked
* to it. Some nodes are not (yet) linked to anything and they
* will end up 'unassigned' to a master. Other nodes are master
* will end up 'unassigned' to a driver. Other nodes are drivers
* and if they have active followers, we can use them to schedule
* the unassigned nodes. */
target = fallback = NULL;
@ -879,12 +879,12 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
if (!n->visited)
collect_nodes(n);
/* from now on we are only interested in active master nodes.
/* from now on we are only interested in active driving nodes.
* We're going to see if there are active followers. */
if (!n->master || !n->active || n->passive)
if (!n->driving || !n->active || n->passive)
continue;
/* first active master node is fallback */
/* first active driving node is fallback */
if (fallback == NULL)
fallback = n;
@ -892,21 +892,21 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
pw_log_debug(NAME" %p: driver %p: follower %p %s: %d",
context, n, s, s->name, s->active);
if (s != n && s->active) {
/* if the master has active followers, it is a target for our
* unassigned nodes */
/* if the driving node has active followers, it
* is a target for our unassigned nodes */
if (target == NULL)
target = n;
break;
}
}
}
/* no active node, use fallback master */
/* no active node, use fallback driving node */
if (target == NULL)
target = fallback;
/* now go through all available nodes. The ones we didn't visit
* in collect_nodes() are not linked to any master. We assign them
* to either an active master of the first master */
* in collect_nodes() are not linked to any driver. We assign them
* to either an active driver of the first driver */
spa_list_for_each(n, &context->node_list, link) {
if (n->exported)
continue;
@ -926,14 +926,14 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
n->visited = false;
}
/* assign final quantum and set state for followers and master */
/* assign final quantum and set state for followers and drivers */
spa_list_for_each(n, &context->driver_list, driver_link) {
bool running = false;
uint32_t max_quantum = 0;
uint32_t min_quantum = 0;
uint32_t quantum;
if (!n->master || n->exported)
if (!n->driving || n->exported)
continue;
/* collect quantum and count active nodes */
@ -964,8 +964,8 @@ int pw_context_recalc_graph(struct pw_context *context, const char *reason)
n->rt.position->clock.duration = quantum;
}
pw_log_debug(NAME" %p: master %p running:%d passive:%d quantum:%u '%s'", context, n,
running, n->passive, quantum, n->name);
pw_log_debug(NAME" %p: driving %p running:%d passive:%d quantum:%u '%s'",
context, n, running, n->passive, quantum, n->name);
spa_list_for_each(s, &n->follower_list, follower_link) {
if (s == n)

View file

@ -575,7 +575,7 @@ static inline void insert_driver(struct pw_context *context, struct pw_impl_node
struct pw_impl_node *n, *t;
spa_list_for_each_safe(n, t, &context->driver_list, driver_link) {
if (n->priority_master < node->priority_master)
if (n->priority_driver < node->priority_driver)
break;
}
spa_list_append(&n->driver_link, &node->driver_link);
@ -616,7 +616,7 @@ int pw_impl_node_register(struct pw_impl_node *this,
PW_KEY_CLIENT_ID,
PW_KEY_DEVICE_ID,
PW_KEY_PRIORITY_SESSION,
PW_KEY_PRIORITY_MASTER,
PW_KEY_PRIORITY_DRIVER,
PW_KEY_APP_NAME,
PW_KEY_NODE_DESCRIPTION,
PW_KEY_NODE_NAME,
@ -706,7 +706,7 @@ do_move_nodes(struct spa_loop *loop,
return 0;
}
static void remove_segment_master(struct pw_impl_node *driver, uint32_t node_id)
static void remove_segment_owner(struct pw_impl_node *driver, uint32_t node_id)
{
struct pw_node_activation *a = driver->rt.activation;
ATOMIC_CAS(a->segment_owner[0], node_id, 0);
@ -729,11 +729,11 @@ int pw_impl_node_set_driver(struct pw_impl_node *node, struct pw_impl_node *driv
if (old == driver)
return 0;
remove_segment_master(old, node->info.id);
remove_segment_owner(old, node->info.id);
node->master = node->driver && driver == node;
pw_log_debug(NAME" %p: driver %p master:%u", node,
driver, node->master);
node->driving = node->driver && driver == node;
pw_log_debug(NAME" %p: driver %p driving:%u", node,
driver, node->driving);
pw_log_info("(%s-%u) -> change driver (%s-%d -> %s-%d)",
node->name, node->info.id,
old->name, old->info.id, driver->name, driver->info.id);
@ -775,9 +775,9 @@ static void check_properties(struct pw_impl_node *node)
const char *str;
bool driver, do_recalc = false;
if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_MASTER))) {
node->priority_master = pw_properties_parse_int(str);
pw_log_debug(NAME" %p: priority master %d", node, node->priority_master);
if ((str = pw_properties_get(node->properties, PW_KEY_PRIORITY_DRIVER))) {
node->priority_driver = pw_properties_parse_int(str);
pw_log_debug(NAME" %p: priority driver %d", node, node->priority_driver);
}
if ((str = pw_properties_get(node->properties, PW_KEY_NODE_NAME)) &&
@ -1122,7 +1122,7 @@ struct pw_impl_node *pw_context_create_node(struct pw_context *context,
this->driver_node = this;
spa_list_append(&this->follower_list, &this->follower_link);
this->master = true;
this->driving = true;
return this;
@ -1474,7 +1474,7 @@ static int node_ready(void *data, int status)
update_position(node, all_ready);
}
if (SPA_UNLIKELY(node->driver && !node->master))
if (SPA_UNLIKELY(node->driver && !node->driving))
return 0;
if (status & SPA_STATUS_HAVE_DATA) {
@ -1602,7 +1602,7 @@ void pw_impl_node_destroy(struct pw_impl_node *node)
/* remove ourself as a follower from the driver node */
spa_list_remove(&node->follower_link);
remove_segment_master(node->driver_node, node->info.id);
remove_segment_owner(node->driver_node, node->info.id);
spa_list_consume(follower, &node->follower_list, follower_link) {
pw_log_debug(NAME" %p: reassign follower %p", impl, follower);

View file

@ -79,7 +79,7 @@ extern "C" {
/* priorities */
#define PW_KEY_PRIORITY_SESSION "priority.session" /**< priority in session manager */
#define PW_KEY_PRIORITY_MASTER "priority.master" /**< priority to be a master */
#define PW_KEY_PRIORITY_DRIVER "priority.driver" /**< priority to be a driver */
/* remote keys */
#define PW_KEY_REMOTE_NAME "remote.name" /**< The name of the remote to connect to,
@ -264,6 +264,9 @@ extern "C" {
#define PW_KEY_VIDEO_FORMAT "video.format" /**< a video format */
#define PW_KEY_VIDEO_SIZE "video.size" /**< a video size as "<width>x<height" */
#ifdef PW_ENABLE_DEPRECATED
#define PW_KEY_PRIORITY_MASTER "priority.master" /**< deprecated */
#endif /* PW_ENABLE_DEPRECATED */
#ifdef __cplusplus
}

View file

@ -535,7 +535,7 @@ struct pw_impl_node {
char *name; /** for debug */
uint32_t priority_master; /** priority for being master driver */
uint32_t priority_driver; /** priority for being driver */
uint32_t spa_flags;
unsigned int registered:1;
@ -544,7 +544,7 @@ struct pw_impl_node {
unsigned int driver:1; /**< if the node can drive the graph */
unsigned int exported:1; /**< if the node is exported */
unsigned int remote:1; /**< if the node is implemented remotely */
unsigned int master:1; /**< a master node is one of the driver nodes that
unsigned int driving:1; /**< a driving node is one of the driver nodes that
* is selected to drive the graph */
unsigned int visited:1; /**< for sorting */
unsigned int want_driver:1; /**< this node wants to be assigned to a driver */