mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Add FASTPATH trace log
Add a trace_fp that can be optimized away when FASTPATH is defined.
This commit is contained in:
		
							parent
							
								
									036ca89c0e
								
							
						
					
					
						commit
						5a2ccee1ff
					
				
					 17 changed files with 98 additions and 87 deletions
				
			
		| 
						 | 
				
			
			@ -870,14 +870,14 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
 | 
			
		||||
	this = SPA_CONTAINER_OF(node, struct impl, node);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: process %d", this, this->n_links);
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: process %d", this, this->n_links);
 | 
			
		||||
 | 
			
		||||
	while (1) {
 | 
			
		||||
		res = SPA_STATUS_OK;
 | 
			
		||||
		ready = 0;
 | 
			
		||||
		for (i = 0; i < this->n_nodes; i++) {
 | 
			
		||||
			r = spa_node_process(this->nodes[i]);
 | 
			
		||||
			spa_log_trace(this->log, NAME " %p: process %d %d", this, i, r);
 | 
			
		||||
			spa_log_trace_fp(this->log, NAME " %p: process %d %d", this, i, r);
 | 
			
		||||
 | 
			
		||||
			if (r < 0)
 | 
			
		||||
				return r;
 | 
			
		||||
| 
						 | 
				
			
			@ -896,7 +896,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
			break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: process result: %d", this, res);
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: process result: %d", this, res);
 | 
			
		||||
 | 
			
		||||
	return res;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1028,7 +1028,7 @@ static void recycle_buffer(struct impl *this, uint32_t id)
 | 
			
		|||
	if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) {
 | 
			
		||||
		spa_list_append(&port->queue, &b->link);
 | 
			
		||||
		SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT);
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: recycle buffer %d", this, id);
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1098,7 +1098,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
	spa_return_val_if_fail(outio != NULL, -EIO);
 | 
			
		||||
	spa_return_val_if_fail(inio != NULL, -EIO);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: status %d %d", this, inio->status, outio->status);
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: status %d %d", this, inio->status, outio->status);
 | 
			
		||||
 | 
			
		||||
	if (outport->control)
 | 
			
		||||
		process_control(this, outport, &outport->control->sequence);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -758,7 +758,7 @@ static void recycle_buffer(struct impl *this, struct port *port, uint32_t id)
 | 
			
		|||
	if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) {
 | 
			
		||||
		spa_list_append(&port->queue, &b->link);
 | 
			
		||||
		SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT);
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: recycle buffer %d", this, id);
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -817,7 +817,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
	inio = inport->io;
 | 
			
		||||
	spa_return_val_if_fail(inio != NULL, -EIO);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: status %p %d %d -> %p %d %d", this,
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: status %p %d %d -> %p %d %d", this,
 | 
			
		||||
			inio, inio->status, inio->buffer_id,
 | 
			
		||||
			outio, outio->status, outio->buffer_id);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -860,7 +860,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
		maxsize = SPA_MIN(outport->ctrl->max_size, maxsize);
 | 
			
		||||
	n_samples = SPA_MIN(n_samples, maxsize / outport->stride);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: n_src:%d n_dst:%d size:%d maxsize:%d n_samples:%d",
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: n_src:%d n_dst:%d size:%d maxsize:%d n_samples:%d",
 | 
			
		||||
			this, n_src_datas, n_dst_datas, size, maxsize, n_samples);
 | 
			
		||||
 | 
			
		||||
	n_datas = SPA_MAX(n_src_datas, n_dst_datas);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -714,7 +714,7 @@ static void queue_buffer(struct impl *this, struct port *port, uint32_t id)
 | 
			
		|||
{
 | 
			
		||||
	struct buffer *b = &port->buffers[id];
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: queue buffer %d on port %d %d",
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: queue buffer %d on port %d %d",
 | 
			
		||||
			this, id, port->id, b->flags);
 | 
			
		||||
	if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_QUEUED))
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -733,7 +733,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port)
 | 
			
		|||
	b = spa_list_first(&port->queue, struct buffer, link);
 | 
			
		||||
	spa_list_remove(&b->link);
 | 
			
		||||
	SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_QUEUED);
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: dequeue buffer %d on port %d %u",
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d on port %d %u",
 | 
			
		||||
			this, b->id, port->id, b->flags);
 | 
			
		||||
 | 
			
		||||
	return b;
 | 
			
		||||
| 
						 | 
				
			
			@ -872,7 +872,7 @@ static inline int get_in_buffer(struct impl *this, struct port *port, struct buf
 | 
			
		|||
	if ((io = port->io) == NULL ||
 | 
			
		||||
	    io->status != SPA_STATUS_HAVE_BUFFER ||
 | 
			
		||||
	    io->buffer_id >= port->n_buffers) {
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: empty port %d %p %d %d %d",
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: empty port %d %p %d %d %d",
 | 
			
		||||
				this, port->id, io, io->status, io->buffer_id,
 | 
			
		||||
				port->n_buffers);
 | 
			
		||||
		return -EPIPE;
 | 
			
		||||
| 
						 | 
				
			
			@ -944,7 +944,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
	spa_return_val_if_fail(outio != NULL, -EIO);
 | 
			
		||||
	spa_return_val_if_fail(this->convert != NULL, -EIO);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: status %d %d", this, outio->status, outio->buffer_id);
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: status %d %d", this, outio->status, outio->buffer_id);
 | 
			
		||||
 | 
			
		||||
	if ((res = get_out_buffer(this, outport, &dbuf)) != 0)
 | 
			
		||||
		return res;
 | 
			
		||||
| 
						 | 
				
			
			@ -977,7 +977,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
 | 
			
		||||
		n_samples = SPA_MIN(n_samples, sd->chunk->size / inport->stride);
 | 
			
		||||
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: %d %d %d %p", this,
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: %d %d %d %p", this,
 | 
			
		||||
				sd->chunk->size, maxsize, n_samples, src_datas[i]);
 | 
			
		||||
 | 
			
		||||
		SPA_FLAG_SET(res, SPA_STATUS_NEED_BUFFER);
 | 
			
		||||
| 
						 | 
				
			
			@ -991,7 +991,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
		dbuf->buf->datas[i].data = dst_datas[i];
 | 
			
		||||
		dbuf->buf->datas[i].chunk->offset = 0;
 | 
			
		||||
		dbuf->buf->datas[i].chunk->size = n_samples * outport->stride;
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p %p %d", this, dst_datas[i],
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p %p %d", this, dst_datas[i],
 | 
			
		||||
				n_samples * outport->stride);
 | 
			
		||||
	}
 | 
			
		||||
	if (!this->is_passthrough)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -669,7 +669,7 @@ static void recycle_buffer(struct impl *this, uint32_t id)
 | 
			
		|||
	if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_OUT)) {
 | 
			
		||||
		spa_list_append(&port->queue, &b->link);
 | 
			
		||||
		SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_OUT);
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: recycle buffer %d", this, id);
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: recycle buffer %d", this, id);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -744,7 +744,8 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
	spa_return_val_if_fail(outio != NULL, -EIO);
 | 
			
		||||
	spa_return_val_if_fail(inio != NULL, -EIO);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: status %d %d %p", this, inio->status, outio->status, outport->io_control);
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: status %d %d %p",
 | 
			
		||||
			this, inio->status, outio->status, outport->io_control);
 | 
			
		||||
 | 
			
		||||
	if (outport->io_control)
 | 
			
		||||
		process_control(this, outport, &outport->io_control->sequence);
 | 
			
		||||
| 
						 | 
				
			
			@ -791,7 +792,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
 | 
			
		||||
		resample_process(&this->resample, i, src, &in_len, dst, &out_len);
 | 
			
		||||
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: in %d/%d %ld %d out %d/%d %ld %d",
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: in %d/%d %ld %d out %d/%d %ld %d",
 | 
			
		||||
				this, pin_len, in_len, size / sizeof(float), inport->offset,
 | 
			
		||||
				pout_len, out_len, maxsize / sizeof(float), outport->offset);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -683,7 +683,7 @@ static void queue_buffer(struct impl *this, struct port *port, uint32_t id)
 | 
			
		|||
{
 | 
			
		||||
	struct buffer *b = &port->buffers[id];
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: queue buffer %d on port %d %d",
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: queue buffer %d on port %d %d",
 | 
			
		||||
			this, id, port->id, b->flags);
 | 
			
		||||
	if (SPA_FLAG_CHECK(b->flags, BUFFER_FLAG_QUEUED))
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -702,7 +702,7 @@ static struct buffer *dequeue_buffer(struct impl *this, struct port *port)
 | 
			
		|||
	b = spa_list_first(&port->queue, struct buffer, link);
 | 
			
		||||
	spa_list_remove(&b->link);
 | 
			
		||||
	SPA_FLAG_UNSET(b->flags, BUFFER_FLAG_QUEUED);
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: dequeue buffer %d on port %d %u",
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: dequeue buffer %d on port %d %u",
 | 
			
		||||
			this, b->id, port->id, b->flags);
 | 
			
		||||
 | 
			
		||||
	return b;
 | 
			
		||||
| 
						 | 
				
			
			@ -848,7 +848,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
	spa_return_val_if_fail(inio != NULL, -EIO);
 | 
			
		||||
	spa_return_val_if_fail(this->convert != NULL, -EIO);
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: status %p %d %d", this,
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: status %p %d %d", this,
 | 
			
		||||
			inio, inio->status, inio->buffer_id);
 | 
			
		||||
 | 
			
		||||
	if (inio->status != SPA_STATUS_HAVE_BUFFER)
 | 
			
		||||
| 
						 | 
				
			
			@ -880,7 +880,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
		if ((outio = outport->io) == NULL)
 | 
			
		||||
			goto empty;
 | 
			
		||||
 | 
			
		||||
		spa_log_trace(this->log, NAME " %p: %d %p %d %d %d", this, i,
 | 
			
		||||
		spa_log_trace_fp(this->log, NAME " %p: %d %p %d %d %d", this, i,
 | 
			
		||||
				outio, outio->status, outio->buffer_id, outport->stride);
 | 
			
		||||
 | 
			
		||||
		if (outio->status == SPA_STATUS_HAVE_BUFFER) {
 | 
			
		||||
| 
						 | 
				
			
			@ -920,7 +920,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
		res |= SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	spa_log_trace(this->log, NAME " %p: %d %d %d %d %d", this,
 | 
			
		||||
	spa_log_trace_fp(this->log, NAME " %p: %d %d %d %d %d", this,
 | 
			
		||||
			n_src_datas, n_dst_datas, n_samples, maxsize, inport->stride);
 | 
			
		||||
 | 
			
		||||
	if (!this->is_passthrough)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue