mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	move some debug to fastpath
This commit is contained in:
		
							parent
							
								
									2fdd05d568
								
							
						
					
					
						commit
						74da804e97
					
				
					 3 changed files with 24 additions and 24 deletions
				
			
		| 
						 | 
					@ -177,7 +177,7 @@ static void flush_items(struct impl *impl)
 | 
				
			||||||
		item = SPA_PTROFF(impl->buffer_data, index & (DATAS_SIZE - 1), struct invoke_item);
 | 
							item = SPA_PTROFF(impl->buffer_data, index & (DATAS_SIZE - 1), struct invoke_item);
 | 
				
			||||||
		block = item->block;
 | 
							block = item->block;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		spa_log_trace(impl->log, "%p: flush item %p", impl, item);
 | 
							spa_log_trace_fp(impl->log, "%p: flush item %p", impl, item);
 | 
				
			||||||
		item->res = item->func ? item->func(&impl->loop,
 | 
							item->res = item->func ? item->func(&impl->loop,
 | 
				
			||||||
				true, item->seq, item->data, item->size,
 | 
									true, item->seq, item->data, item->size,
 | 
				
			||||||
			   item->user_data) : 0;
 | 
								   item->user_data) : 0;
 | 
				
			||||||
| 
						 | 
					@ -249,7 +249,7 @@ loop_invoke(void *object,
 | 
				
			||||||
	item->user_data = user_data;
 | 
						item->user_data = user_data;
 | 
				
			||||||
	item->item_size = SPA_ROUND_UP_N(sizeof(struct invoke_item) + size, ITEM_ALIGN);
 | 
						item->item_size = SPA_ROUND_UP_N(sizeof(struct invoke_item) + size, ITEM_ALIGN);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_trace(impl->log, "%p: add item %p filled:%d", impl, item, filled);
 | 
						spa_log_trace_fp(impl->log, "%p: add item %p filled:%d", impl, item, filled);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (l0 >= item->item_size) {
 | 
						if (l0 >= item->item_size) {
 | 
				
			||||||
		/* item + size fit in current ringbuffer idx */
 | 
							/* item + size fit in current ringbuffer idx */
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -843,9 +843,9 @@ static int link_signal_func(void *user_data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct link *link = user_data;
 | 
						struct link *link = user_data;
 | 
				
			||||||
	struct spa_system *data_system = link->data->context->data_system;
 | 
						struct spa_system *data_system = link->data->context->data_system;
 | 
				
			||||||
	struct timespec ts;
 | 
						struct timespec ts = { 0, 0 };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("link %p: signal", link);
 | 
						pw_log_trace_fp("link %p: signal", link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
 | 
						spa_system_clock_gettime(data_system, CLOCK_MONOTONIC, &ts);
 | 
				
			||||||
	link->target.activation->status = PW_NODE_ACTIVATION_TRIGGERED;
 | 
						link->target.activation->status = PW_NODE_ACTIVATION_TRIGGERED;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -392,14 +392,14 @@ do_call_process(struct spa_loop *loop,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stream *impl = user_data;
 | 
						struct stream *impl = user_data;
 | 
				
			||||||
	struct pw_stream *stream = &impl->this;
 | 
						struct pw_stream *stream = &impl->this;
 | 
				
			||||||
	pw_log_trace("%p: do process", stream);
 | 
						pw_log_trace_fp("%p: do process", stream);
 | 
				
			||||||
	pw_stream_emit_process(stream);
 | 
						pw_stream_emit_process(stream);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static void call_process(struct stream *impl)
 | 
					static void call_process(struct stream *impl)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_trace("%p: call process rt:%u", impl, impl->process_rt);
 | 
						pw_log_trace_fp("%p: call process rt:%u", impl, impl->process_rt);
 | 
				
			||||||
	if (impl->process_rt)
 | 
						if (impl->process_rt)
 | 
				
			||||||
		spa_callbacks_call(&impl->rt_callbacks, struct pw_stream_events, process, 0);
 | 
							spa_callbacks_call(&impl->rt_callbacks, struct pw_stream_events, process, 0);
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
| 
						 | 
					@ -413,7 +413,7 @@ do_call_drained(struct spa_loop *loop,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stream *impl = user_data;
 | 
						struct stream *impl = user_data;
 | 
				
			||||||
	struct pw_stream *stream = &impl->this;
 | 
						struct pw_stream *stream = &impl->this;
 | 
				
			||||||
	pw_log_trace("%p: drained", stream);
 | 
						pw_log_trace_fp("%p: drained", stream);
 | 
				
			||||||
	pw_stream_emit_drained(stream);
 | 
						pw_stream_emit_drained(stream);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -430,7 +430,7 @@ do_call_trigger_done(struct spa_loop *loop,
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stream *impl = user_data;
 | 
						struct stream *impl = user_data;
 | 
				
			||||||
	struct pw_stream *stream = &impl->this;
 | 
						struct pw_stream *stream = &impl->this;
 | 
				
			||||||
	pw_log_trace("%p: trigger_done", stream);
 | 
						pw_log_trace_fp("%p: trigger_done", stream);
 | 
				
			||||||
	pw_stream_emit_trigger_done(stream);
 | 
						pw_stream_emit_trigger_done(stream);
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -951,7 +951,7 @@ static int impl_node_process_input(void *object)
 | 
				
			||||||
	struct spa_io_buffers *io = impl->io;
 | 
						struct spa_io_buffers *io = impl->io;
 | 
				
			||||||
	struct buffer *b;
 | 
						struct buffer *b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("%p: process in status:%d id:%d ticks:%"PRIu64" delay:%"PRIi64,
 | 
						pw_log_trace_fp("%p: process in status:%d id:%d ticks:%"PRIu64" delay:%"PRIi64,
 | 
				
			||||||
			stream, io->status, io->buffer_id, impl->time.ticks, impl->time.delay);
 | 
								stream, io->status, io->buffer_id, impl->time.ticks, impl->time.delay);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (io->status == SPA_STATUS_HAVE_DATA &&
 | 
						if (io->status == SPA_STATUS_HAVE_DATA &&
 | 
				
			||||||
| 
						 | 
					@ -967,7 +967,7 @@ static int impl_node_process_input(void *object)
 | 
				
			||||||
	if (io->status != SPA_STATUS_NEED_DATA) {
 | 
						if (io->status != SPA_STATUS_NEED_DATA) {
 | 
				
			||||||
		/* pop buffer to recycle */
 | 
							/* pop buffer to recycle */
 | 
				
			||||||
		if ((b = pop_queue(impl, &impl->queued))) {
 | 
							if ((b = pop_queue(impl, &impl->queued))) {
 | 
				
			||||||
			pw_log_trace("%p: recycle buffer %d", stream, b->id);
 | 
								pw_log_trace_fp("%p: recycle buffer %d", stream, b->id);
 | 
				
			||||||
		} else if (io->status == -EPIPE)
 | 
							} else if (io->status == -EPIPE)
 | 
				
			||||||
			return io->status;
 | 
								return io->status;
 | 
				
			||||||
		io->buffer_id = b ? b->id : SPA_ID_INVALID;
 | 
							io->buffer_id = b ? b->id : SPA_ID_INVALID;
 | 
				
			||||||
| 
						 | 
					@ -990,14 +990,14 @@ static int impl_node_process_output(void *object)
 | 
				
			||||||
	bool recycled;
 | 
						bool recycled;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
again:
 | 
					again:
 | 
				
			||||||
	pw_log_trace("%p: process out status:%d id:%d", stream,
 | 
						pw_log_trace_fp("%p: process out status:%d id:%d", stream,
 | 
				
			||||||
			io->status, io->buffer_id);
 | 
								io->status, io->buffer_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	recycled = false;
 | 
						recycled = false;
 | 
				
			||||||
	if ((res = io->status) != SPA_STATUS_HAVE_DATA) {
 | 
						if ((res = io->status) != SPA_STATUS_HAVE_DATA) {
 | 
				
			||||||
		/* recycle old buffer */
 | 
							/* recycle old buffer */
 | 
				
			||||||
		if ((b = get_buffer(stream, io->buffer_id)) != NULL) {
 | 
							if ((b = get_buffer(stream, io->buffer_id)) != NULL) {
 | 
				
			||||||
			pw_log_trace("%p: recycle buffer %d", stream, b->id);
 | 
								pw_log_trace_fp("%p: recycle buffer %d", stream, b->id);
 | 
				
			||||||
			push_queue(impl, &impl->dequeued, b);
 | 
								push_queue(impl, &impl->dequeued, b);
 | 
				
			||||||
			recycled = true;
 | 
								recycled = true;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -1007,17 +1007,17 @@ again:
 | 
				
			||||||
			impl->drained = false;
 | 
								impl->drained = false;
 | 
				
			||||||
			io->buffer_id = b->id;
 | 
								io->buffer_id = b->id;
 | 
				
			||||||
			res = io->status = SPA_STATUS_HAVE_DATA;
 | 
								res = io->status = SPA_STATUS_HAVE_DATA;
 | 
				
			||||||
			pw_log_trace("%p: pop %d %p", stream, b->id, io);
 | 
								pw_log_trace_fp("%p: pop %d %p", stream, b->id, io);
 | 
				
			||||||
		} else if (impl->draining || impl->drained) {
 | 
							} else if (impl->draining || impl->drained) {
 | 
				
			||||||
			impl->draining = true;
 | 
								impl->draining = true;
 | 
				
			||||||
			impl->drained = true;
 | 
								impl->drained = true;
 | 
				
			||||||
			io->buffer_id = SPA_ID_INVALID;
 | 
								io->buffer_id = SPA_ID_INVALID;
 | 
				
			||||||
			res = io->status = SPA_STATUS_DRAINED;
 | 
								res = io->status = SPA_STATUS_DRAINED;
 | 
				
			||||||
			pw_log_trace("%p: draining", stream);
 | 
								pw_log_trace_fp("%p: draining", stream);
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			io->buffer_id = SPA_ID_INVALID;
 | 
								io->buffer_id = SPA_ID_INVALID;
 | 
				
			||||||
			res = io->status = SPA_STATUS_NEED_DATA;
 | 
								res = io->status = SPA_STATUS_NEED_DATA;
 | 
				
			||||||
			pw_log_trace("%p: no more buffers %p", stream, io);
 | 
								pw_log_trace_fp("%p: no more buffers %p", stream, io);
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1041,7 +1041,7 @@ again:
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("%p: res %d", stream, res);
 | 
						pw_log_trace_fp("%p: res %d", stream, res);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (impl->driving && impl->using_trigger && res != SPA_STATUS_HAVE_DATA)
 | 
						if (impl->driving && impl->using_trigger && res != SPA_STATUS_HAVE_DATA)
 | 
				
			||||||
		call_trigger_done(impl);
 | 
							call_trigger_done(impl);
 | 
				
			||||||
| 
						 | 
					@ -2095,7 +2095,7 @@ int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time)
 | 
				
			||||||
	time->delay += (impl->latency.min_rate + impl->latency.max_rate) / 2;
 | 
						time->delay += (impl->latency.min_rate + impl->latency.max_rate) / 2;
 | 
				
			||||||
	time->delay += ((impl->latency.min_ns + impl->latency.max_ns) / 2) * time->rate.denom / SPA_NSEC_PER_SEC;
 | 
						time->delay += ((impl->latency.min_ns + impl->latency.max_ns) / 2) * time->rate.denom / SPA_NSEC_PER_SEC;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("%p: %"PRIi64" %"PRIi64" %"PRIu64" %d/%d %"PRIu64" %"
 | 
						pw_log_trace_fp("%p: %"PRIi64" %"PRIi64" %"PRIu64" %d/%d %"PRIu64" %"
 | 
				
			||||||
			PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, stream,
 | 
								PRIu64" %"PRIu64" %"PRIu64" %"PRIu64, stream,
 | 
				
			||||||
			time->now, time->delay, time->ticks,
 | 
								time->now, time->delay, time->ticks,
 | 
				
			||||||
			time->rate.num, time->rate.denom, time->queued,
 | 
								time->rate.num, time->rate.denom, time->queued,
 | 
				
			||||||
| 
						 | 
					@ -2123,17 +2123,17 @@ struct pw_buffer *pw_stream_dequeue_buffer(struct pw_stream *stream)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((b = pop_queue(impl, &impl->dequeued)) == NULL) {
 | 
						if ((b = pop_queue(impl, &impl->dequeued)) == NULL) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		pw_log_trace("%p: no more buffers: %m", stream);
 | 
							pw_log_trace_fp("%p: no more buffers: %m", stream);
 | 
				
			||||||
		errno = -res;
 | 
							errno = -res;
 | 
				
			||||||
		return NULL;
 | 
							return NULL;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	pw_log_trace("%p: dequeue buffer %d size:%"PRIu64, stream, b->id, b->this.size);
 | 
						pw_log_trace_fp("%p: dequeue buffer %d size:%"PRIu64, stream, b->id, b->this.size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (b->busy && impl->direction == SPA_DIRECTION_OUTPUT) {
 | 
						if (b->busy && impl->direction == SPA_DIRECTION_OUTPUT) {
 | 
				
			||||||
		if (ATOMIC_INC(b->busy->count) > 1) {
 | 
							if (ATOMIC_INC(b->busy->count) > 1) {
 | 
				
			||||||
			ATOMIC_DEC(b->busy->count);
 | 
								ATOMIC_DEC(b->busy->count);
 | 
				
			||||||
			push_queue(impl, &impl->dequeued, b);
 | 
								push_queue(impl, &impl->dequeued, b);
 | 
				
			||||||
			pw_log_trace("%p: buffer busy", stream);
 | 
								pw_log_trace_fp("%p: buffer busy", stream);
 | 
				
			||||||
			errno = EBUSY;
 | 
								errno = EBUSY;
 | 
				
			||||||
			return NULL;
 | 
								return NULL;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
| 
						 | 
					@ -2151,7 +2151,7 @@ int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer)
 | 
				
			||||||
	if (b->busy)
 | 
						if (b->busy)
 | 
				
			||||||
		ATOMIC_DEC(b->busy->count);
 | 
							ATOMIC_DEC(b->busy->count);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("%p: queue buffer %d", stream, b->id);
 | 
						pw_log_trace_fp("%p: queue buffer %d", stream, b->id);
 | 
				
			||||||
	if ((res = push_queue(impl, &impl->queued, b)) < 0)
 | 
						if ((res = push_queue(impl, &impl->queued, b)) < 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -2171,7 +2171,7 @@ do_flush(struct spa_loop *loop,
 | 
				
			||||||
	struct stream *impl = user_data;
 | 
						struct stream *impl = user_data;
 | 
				
			||||||
	struct buffer *b;
 | 
						struct buffer *b;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("%p: flush", impl);
 | 
						pw_log_trace_fp("%p: flush", impl);
 | 
				
			||||||
	do {
 | 
						do {
 | 
				
			||||||
		b = pop_queue(impl, &impl->queued);
 | 
							b = pop_queue(impl, &impl->queued);
 | 
				
			||||||
		if (b != NULL)
 | 
							if (b != NULL)
 | 
				
			||||||
| 
						 | 
					@ -2189,7 +2189,7 @@ do_drain(struct spa_loop *loop,
 | 
				
			||||||
                 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
					                 bool async, uint32_t seq, const void *data, size_t size, void *user_data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct stream *impl = user_data;
 | 
						struct stream *impl = user_data;
 | 
				
			||||||
	pw_log_trace("%p", impl);
 | 
						pw_log_trace_fp("%p", impl);
 | 
				
			||||||
	impl->draining = true;
 | 
						impl->draining = true;
 | 
				
			||||||
	impl->drained = false;
 | 
						impl->drained = false;
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
| 
						 | 
					@ -2248,7 +2248,7 @@ int pw_stream_trigger_process(struct pw_stream *stream)
 | 
				
			||||||
	struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
 | 
						struct stream *impl = SPA_CONTAINER_OF(stream, struct stream, this);
 | 
				
			||||||
	int res = 0;
 | 
						int res = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_trace("%p", impl);
 | 
						pw_log_trace_fp("%p", impl);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* flag to check for old or new behaviour */
 | 
						/* flag to check for old or new behaviour */
 | 
				
			||||||
	impl->using_trigger = true;
 | 
						impl->using_trigger = true;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue