remote-node: only signal graph end when profiling
Add a flag to the activation to mark the node as being profiled. Only wake up the eventfd in remote-node when the profiler is running. This keeps the server sleeping when remote nodes are driving and the profiler is not running.
This commit is contained in:
parent
5fcc0e1181
commit
a5b845650e
|
@ -1170,19 +1170,13 @@ static const struct pw_proxy_events proxy_client_node_events = {
|
|||
.bound_props = client_node_bound_props,
|
||||
};
|
||||
|
||||
static inline uint64_t get_time_ns(struct spa_system *system)
|
||||
{
|
||||
struct timespec ts;
|
||||
spa_system_clock_gettime(system, CLOCK_MONOTONIC, &ts);
|
||||
return SPA_TIMESPEC_TO_NSEC(&ts);
|
||||
}
|
||||
|
||||
static void context_complete(void *data, struct pw_impl_node *node)
|
||||
{
|
||||
struct node_data *d = data;
|
||||
struct spa_system *data_system = d->data_system;
|
||||
|
||||
if (node != d->node || !node->driving)
|
||||
if (node != d->node || !node->driving ||
|
||||
!SPA_FLAG_IS_SET(node->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_PROFILER))
|
||||
return;
|
||||
|
||||
if (SPA_UNLIKELY(spa_system_eventfd_write(data_system, d->rtwritefd, 1) < 0))
|
||||
|
|
|
@ -505,6 +505,10 @@ void pw_context_driver_add_listener(struct pw_context *context,
|
|||
.listener = listener,
|
||||
.events = events,
|
||||
.data = data };
|
||||
struct pw_impl_node *n;
|
||||
spa_list_for_each(n, &context->driver_list, driver_link) {
|
||||
SPA_FLAG_SET(n->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_PROFILER);
|
||||
}
|
||||
pw_loop_invoke(context->data_loop,
|
||||
do_add_listener, SPA_ID_INVALID, &d, sizeof(d), false, context);
|
||||
}
|
||||
|
@ -521,6 +525,10 @@ SPA_EXPORT
|
|||
void pw_context_driver_remove_listener(struct pw_context *context,
|
||||
struct spa_hook *listener)
|
||||
{
|
||||
struct pw_impl_node *n;
|
||||
spa_list_for_each(n, &context->driver_list, driver_link) {
|
||||
SPA_FLAG_CLEAR(n->rt.target.activation->flags, PW_NODE_ACTIVATION_FLAG_PROFILER);
|
||||
}
|
||||
pw_loop_invoke(context->data_loop,
|
||||
do_remove_listener, SPA_ID_INVALID, NULL, 0, true, listener);
|
||||
}
|
||||
|
|
|
@ -635,9 +635,13 @@ struct pw_node_activation {
|
|||
* used when driver segment_owner has this node id */
|
||||
|
||||
/* for drivers, shared with all nodes */
|
||||
uint32_t segment_owner[32]; /* id of owners for each segment info struct.
|
||||
uint32_t segment_owner[16]; /* id of owners for each segment info struct.
|
||||
* nodes that want to update segment info need to
|
||||
* CAS their node id in this array. */
|
||||
uint32_t padding[15];
|
||||
#define PW_NODE_ACTIVATION_FLAG_NONE 0
|
||||
#define PW_NODE_ACTIVATION_FLAG_PROFILER (1<<0) /* the profiler is running */
|
||||
uint32_t flags; /* extra flags */
|
||||
struct spa_io_position position; /* contains current position and segment info.
|
||||
* extra info is updated by nodes that have set
|
||||
* themselves as owner in the segment structs */
|
||||
|
|
Loading…
Reference in New Issue