mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
log: add work-queue topic
This commit is contained in:
parent
f562b16706
commit
786cfc44fb
2 changed files with 40 additions and 37 deletions
|
|
@ -49,28 +49,29 @@ struct spa_log_topic *PW_LOG_TOPIC_DEFAULT;
|
||||||
|
|
||||||
PW_LOG_TOPIC_STATIC(log_topic, "pw.log"); /* log topic for this file here */
|
PW_LOG_TOPIC_STATIC(log_topic, "pw.log"); /* log topic for this file here */
|
||||||
PW_LOG_TOPIC(log_buffers, "pw.buffers");
|
PW_LOG_TOPIC(log_buffers, "pw.buffers");
|
||||||
|
PW_LOG_TOPIC(log_client, "pw.client");
|
||||||
PW_LOG_TOPIC(log_conf, "pw.conf");
|
PW_LOG_TOPIC(log_conf, "pw.conf");
|
||||||
PW_LOG_TOPIC(log_context, "pw.context");
|
PW_LOG_TOPIC(log_context, "pw.context");
|
||||||
|
PW_LOG_TOPIC(log_core, "pw.core");
|
||||||
PW_LOG_TOPIC(log_data_loop, "pw.data-loop");
|
PW_LOG_TOPIC(log_data_loop, "pw.data-loop");
|
||||||
|
PW_LOG_TOPIC(log_device, "pw.device");
|
||||||
|
PW_LOG_TOPIC(log_factory, "pw.factory");
|
||||||
PW_LOG_TOPIC(log_filter, "pw.filter");
|
PW_LOG_TOPIC(log_filter, "pw.filter");
|
||||||
PW_LOG_TOPIC(log_metadata, "pw.metadata");
|
PW_LOG_TOPIC(log_global, "pw.global");
|
||||||
PW_LOG_TOPIC(log_node, "pw.node");
|
|
||||||
PW_LOG_TOPIC(log_port, "pw.port");
|
|
||||||
PW_LOG_TOPIC(log_link, "pw.link");
|
PW_LOG_TOPIC(log_link, "pw.link");
|
||||||
PW_LOG_TOPIC(log_loop, "pw.loop");
|
PW_LOG_TOPIC(log_loop, "pw.loop");
|
||||||
PW_LOG_TOPIC(log_main_loop, "pw.main-loop");
|
PW_LOG_TOPIC(log_main_loop, "pw.main-loop");
|
||||||
PW_LOG_TOPIC(log_mem, "pw.mem");
|
PW_LOG_TOPIC(log_mem, "pw.mem");
|
||||||
PW_LOG_TOPIC(log_core, "pw.core");
|
PW_LOG_TOPIC(log_metadata, "pw.metadata");
|
||||||
PW_LOG_TOPIC(log_proxy, "pw.proxy");
|
|
||||||
PW_LOG_TOPIC(log_global, "pw.global");
|
|
||||||
PW_LOG_TOPIC(log_protocol, "pw.protocol");
|
|
||||||
PW_LOG_TOPIC(log_client, "pw.client");
|
|
||||||
PW_LOG_TOPIC(log_factory, "pw.factory");
|
|
||||||
PW_LOG_TOPIC(log_module, "pw.module");
|
PW_LOG_TOPIC(log_module, "pw.module");
|
||||||
PW_LOG_TOPIC(log_device, "pw.device");
|
PW_LOG_TOPIC(log_node, "pw.node");
|
||||||
|
PW_LOG_TOPIC(log_port, "pw.port");
|
||||||
|
PW_LOG_TOPIC(log_protocol, "pw.protocol");
|
||||||
|
PW_LOG_TOPIC(log_proxy, "pw.proxy");
|
||||||
PW_LOG_TOPIC(log_resource, "pw.resource");
|
PW_LOG_TOPIC(log_resource, "pw.resource");
|
||||||
PW_LOG_TOPIC(log_stream, "pw.stream");
|
PW_LOG_TOPIC(log_stream, "pw.stream");
|
||||||
PW_LOG_TOPIC(log_thread_loop, "pw.thread-loop");
|
PW_LOG_TOPIC(log_thread_loop, "pw.thread-loop");
|
||||||
|
PW_LOG_TOPIC(log_work_queue, "pw.work-queue");
|
||||||
|
|
||||||
PW_LOG_TOPIC(PW_LOG_TOPIC_DEFAULT, "default");
|
PW_LOG_TOPIC(PW_LOG_TOPIC_DEFAULT, "default");
|
||||||
|
|
||||||
|
|
@ -427,27 +428,28 @@ pw_log_init(void)
|
||||||
{
|
{
|
||||||
PW_LOG_TOPIC_INIT(PW_LOG_TOPIC_DEFAULT);
|
PW_LOG_TOPIC_INIT(PW_LOG_TOPIC_DEFAULT);
|
||||||
PW_LOG_TOPIC_INIT(log_buffers);
|
PW_LOG_TOPIC_INIT(log_buffers);
|
||||||
|
PW_LOG_TOPIC_INIT(log_client);
|
||||||
PW_LOG_TOPIC_INIT(log_conf);
|
PW_LOG_TOPIC_INIT(log_conf);
|
||||||
PW_LOG_TOPIC_INIT(log_data_loop);
|
|
||||||
PW_LOG_TOPIC_INIT(log_filter);
|
|
||||||
PW_LOG_TOPIC_INIT(log_topic);
|
|
||||||
PW_LOG_TOPIC_INIT(log_context);
|
PW_LOG_TOPIC_INIT(log_context);
|
||||||
PW_LOG_TOPIC_INIT(log_metadata);
|
PW_LOG_TOPIC_INIT(log_core);
|
||||||
PW_LOG_TOPIC_INIT(log_node);
|
PW_LOG_TOPIC_INIT(log_data_loop);
|
||||||
PW_LOG_TOPIC_INIT(log_port);
|
PW_LOG_TOPIC_INIT(log_device);
|
||||||
|
PW_LOG_TOPIC_INIT(log_factory);
|
||||||
|
PW_LOG_TOPIC_INIT(log_filter);
|
||||||
|
PW_LOG_TOPIC_INIT(log_global);
|
||||||
PW_LOG_TOPIC_INIT(log_link);
|
PW_LOG_TOPIC_INIT(log_link);
|
||||||
PW_LOG_TOPIC_INIT(log_loop);
|
PW_LOG_TOPIC_INIT(log_loop);
|
||||||
PW_LOG_TOPIC_INIT(log_main_loop);
|
PW_LOG_TOPIC_INIT(log_main_loop);
|
||||||
PW_LOG_TOPIC_INIT(log_mem);
|
PW_LOG_TOPIC_INIT(log_mem);
|
||||||
PW_LOG_TOPIC_INIT(log_core);
|
PW_LOG_TOPIC_INIT(log_metadata);
|
||||||
PW_LOG_TOPIC_INIT(log_proxy);
|
|
||||||
PW_LOG_TOPIC_INIT(log_global);
|
|
||||||
PW_LOG_TOPIC_INIT(log_protocol);
|
|
||||||
PW_LOG_TOPIC_INIT(log_client);
|
|
||||||
PW_LOG_TOPIC_INIT(log_factory);
|
|
||||||
PW_LOG_TOPIC_INIT(log_module);
|
PW_LOG_TOPIC_INIT(log_module);
|
||||||
PW_LOG_TOPIC_INIT(log_device);
|
PW_LOG_TOPIC_INIT(log_node);
|
||||||
|
PW_LOG_TOPIC_INIT(log_port);
|
||||||
|
PW_LOG_TOPIC_INIT(log_protocol);
|
||||||
|
PW_LOG_TOPIC_INIT(log_proxy);
|
||||||
PW_LOG_TOPIC_INIT(log_resource);
|
PW_LOG_TOPIC_INIT(log_resource);
|
||||||
PW_LOG_TOPIC_INIT(log_stream);
|
PW_LOG_TOPIC_INIT(log_stream);
|
||||||
PW_LOG_TOPIC_INIT(log_thread_loop);
|
PW_LOG_TOPIC_INIT(log_thread_loop);
|
||||||
|
PW_LOG_TOPIC_INIT(log_topic);
|
||||||
|
PW_LOG_TOPIC_INIT(log_work_queue);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,8 @@
|
||||||
#include "pipewire/log.h"
|
#include "pipewire/log.h"
|
||||||
#include "pipewire/work-queue.h"
|
#include "pipewire/work-queue.h"
|
||||||
|
|
||||||
#define NAME "work-queue"
|
PW_LOG_TOPIC_EXTERN(log_work_queue);
|
||||||
|
#define PW_LOG_TOPIC_DEFAULT log_work_queue
|
||||||
|
|
||||||
/** \cond */
|
/** \cond */
|
||||||
struct work_item {
|
struct work_item {
|
||||||
|
|
@ -64,14 +65,14 @@ static void process_work_queue(void *data, uint64_t count)
|
||||||
|
|
||||||
spa_list_for_each_safe(item, tmp, &this->work_list, link) {
|
spa_list_for_each_safe(item, tmp, &this->work_list, link) {
|
||||||
if (item->seq != SPA_ID_INVALID) {
|
if (item->seq != SPA_ID_INVALID) {
|
||||||
pw_log_debug(NAME" %p: %d waiting for item %p seq:%d id:%u", this,
|
pw_log_debug("%p: %d waiting for item %p seq:%d id:%u", this,
|
||||||
this->n_queued, item->obj, item->seq, item->id);
|
this->n_queued, item->obj, item->seq, item->id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->res == -EBUSY &&
|
if (item->res == -EBUSY &&
|
||||||
item != spa_list_first(&this->work_list, struct work_item, link)) {
|
item != spa_list_first(&this->work_list, struct work_item, link)) {
|
||||||
pw_log_debug(NAME" %p: n_queued:%d sync item %p not head id:%u", this,
|
pw_log_debug("%p: n_queued:%d sync item %p not head id:%u", this,
|
||||||
this->n_queued, item->obj, item->id);
|
this->n_queued, item->obj, item->id);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
@ -80,7 +81,7 @@ static void process_work_queue(void *data, uint64_t count)
|
||||||
this->n_queued--;
|
this->n_queued--;
|
||||||
|
|
||||||
if (item->func) {
|
if (item->func) {
|
||||||
pw_log_debug(NAME" %p: n_queued:%d process work item %p seq:%d res:%d id:%u",
|
pw_log_debug("%p: n_queued:%d process work item %p seq:%d res:%d id:%u",
|
||||||
this, this->n_queued, item->obj, item->seq, item->res,
|
this, this->n_queued, item->obj, item->seq, item->res,
|
||||||
item->id);
|
item->id);
|
||||||
item->func(item->obj, item->data, item->res, item->id);
|
item->func(item->obj, item->data, item->res, item->id);
|
||||||
|
|
@ -104,7 +105,7 @@ struct pw_work_queue *pw_work_queue_new(struct pw_loop *loop)
|
||||||
if (this == NULL)
|
if (this == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: new", this);
|
pw_log_debug("%p: new", this);
|
||||||
|
|
||||||
this->loop = loop;
|
this->loop = loop;
|
||||||
|
|
||||||
|
|
@ -133,12 +134,12 @@ void pw_work_queue_destroy(struct pw_work_queue *queue)
|
||||||
{
|
{
|
||||||
struct work_item *item, *tmp;
|
struct work_item *item, *tmp;
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: destroy", queue);
|
pw_log_debug("%p: destroy", queue);
|
||||||
|
|
||||||
pw_loop_destroy_source(queue->loop, queue->wakeup);
|
pw_loop_destroy_source(queue->loop, queue->wakeup);
|
||||||
|
|
||||||
spa_list_for_each_safe(item, tmp, &queue->work_list, link) {
|
spa_list_for_each_safe(item, tmp, &queue->work_list, link) {
|
||||||
pw_log_debug(NAME" %p: cancel work item %p seq:%d res:%d id:%u",
|
pw_log_debug("%p: cancel work item %p seq:%d res:%d id:%u",
|
||||||
queue, item->obj, item->seq, item->res, item->id);
|
queue, item->obj, item->seq, item->res, item->id);
|
||||||
free(item);
|
free(item);
|
||||||
}
|
}
|
||||||
|
|
@ -183,10 +184,10 @@ pw_work_queue_add(struct pw_work_queue *queue, void *obj, int res, pw_work_func_
|
||||||
if (SPA_RESULT_IS_ASYNC(res)) {
|
if (SPA_RESULT_IS_ASYNC(res)) {
|
||||||
item->seq = SPA_RESULT_ASYNC_SEQ(res);
|
item->seq = SPA_RESULT_ASYNC_SEQ(res);
|
||||||
item->res = res;
|
item->res = res;
|
||||||
pw_log_debug(NAME" %p: defer async %d for object %p id:%d",
|
pw_log_debug("%p: defer async %d for object %p id:%d",
|
||||||
queue, item->seq, obj, item->id);
|
queue, item->seq, obj, item->id);
|
||||||
} else if (res == -EBUSY) {
|
} else if (res == -EBUSY) {
|
||||||
pw_log_debug(NAME" %p: wait sync object %p id:%u",
|
pw_log_debug("%p: wait sync object %p id:%u",
|
||||||
queue, obj, item->id);
|
queue, obj, item->id);
|
||||||
item->seq = SPA_ID_INVALID;
|
item->seq = SPA_ID_INVALID;
|
||||||
item->res = res;
|
item->res = res;
|
||||||
|
|
@ -195,7 +196,7 @@ pw_work_queue_add(struct pw_work_queue *queue, void *obj, int res, pw_work_func_
|
||||||
item->seq = SPA_ID_INVALID;
|
item->seq = SPA_ID_INVALID;
|
||||||
item->res = res;
|
item->res = res;
|
||||||
have_work = true;
|
have_work = true;
|
||||||
pw_log_debug(NAME" %p: defer object %p id:%u", queue, obj, item->id);
|
pw_log_debug("%p: defer object %p id:%u", queue, obj, item->id);
|
||||||
}
|
}
|
||||||
spa_list_append(&queue->work_list, &item->link);
|
spa_list_append(&queue->work_list, &item->link);
|
||||||
queue->n_queued++;
|
queue->n_queued++;
|
||||||
|
|
@ -220,7 +221,7 @@ int pw_work_queue_cancel(struct pw_work_queue *queue, void *obj, uint32_t id)
|
||||||
|
|
||||||
spa_list_for_each(item, &queue->work_list, link) {
|
spa_list_for_each(item, &queue->work_list, link) {
|
||||||
if ((id == SPA_ID_INVALID || item->id == id) && (obj == NULL || item->obj == obj)) {
|
if ((id == SPA_ID_INVALID || item->id == id) && (obj == NULL || item->obj == obj)) {
|
||||||
pw_log_debug(NAME" %p: cancel defer %d for object %p id:%u", queue,
|
pw_log_debug("%p: cancel defer %d for object %p id:%u", queue,
|
||||||
item->seq, item->obj, id);
|
item->seq, item->obj, id);
|
||||||
item->seq = SPA_ID_INVALID;
|
item->seq = SPA_ID_INVALID;
|
||||||
item->func = NULL;
|
item->func = NULL;
|
||||||
|
|
@ -228,7 +229,7 @@ int pw_work_queue_cancel(struct pw_work_queue *queue, void *obj, uint32_t id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!have_work) {
|
if (!have_work) {
|
||||||
pw_log_debug(NAME" %p: no deferred found for object %p id:%u", queue, obj, id);
|
pw_log_debug("%p: no deferred found for object %p id:%u", queue, obj, id);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -251,7 +252,7 @@ int pw_work_queue_complete(struct pw_work_queue *queue, void *obj, uint32_t seq,
|
||||||
|
|
||||||
spa_list_for_each(item, &queue->work_list, link) {
|
spa_list_for_each(item, &queue->work_list, link) {
|
||||||
if (item->obj == obj && item->seq == seq) {
|
if (item->obj == obj && item->seq == seq) {
|
||||||
pw_log_debug(NAME" %p: found deferred %d for object %p res:%d id:%u",
|
pw_log_debug("%p: found deferred %d for object %p res:%d id:%u",
|
||||||
queue, seq, obj, res, item->id);
|
queue, seq, obj, res, item->id);
|
||||||
item->seq = SPA_ID_INVALID;
|
item->seq = SPA_ID_INVALID;
|
||||||
item->res = res;
|
item->res = res;
|
||||||
|
|
@ -259,7 +260,7 @@ int pw_work_queue_complete(struct pw_work_queue *queue, void *obj, uint32_t seq,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!have_work) {
|
if (!have_work) {
|
||||||
pw_log_trace(NAME" %p: no deferred %d found for object %p", queue, seq, obj);
|
pw_log_trace("%p: no deferred %d found for object %p", queue, seq, obj);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue