From: Yan Wang yan.wang@linux.intel.com
It will use BUFFER trace class and component DMA trace API. For trace calling of buffer_new(), NULL will be passed into trace API because buffer_dev hasn't been initialized.
Signed-off-by: Yan Wang yan.wang@linux.intel.com --- Test with: CNL nocodec SOF master: c1f2682c210201bbbc96fce7b382b25b90d19775 SOF-Tool master: 86fe688a2b4f68a1ce87e0951686be12a00f1a3c https://github.com/plbossart/sound/tree/topic/sof-v4.14: d09db67c5a9d6dfc85f700669fa2e43c678c8d51 --- src/audio/buffer.c | 12 ++++++------ src/include/sof/audio/buffer.h | 38 +++++++++++++++++++++++++++----------- 2 files changed, 33 insertions(+), 17 deletions(-)
diff --git a/src/audio/buffer.c b/src/audio/buffer.c index 6aeb6a4..50e57dc 100644 --- a/src/audio/buffer.c +++ b/src/audio/buffer.c @@ -50,26 +50,26 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc) { struct comp_buffer *buffer;
- trace_buffer("new"); + trace_buffer(NULL, "new");
/* validate request */ if (desc->size == 0 || desc->size > HEAP_BUFFER_SIZE) { - trace_buffer_error("ebg"); - trace_error_value(desc->size); + trace_buffer_error(NULL, "ebg"); + trace_buffer_value(NULL, desc->size); return NULL; }
/* allocate new buffer */ buffer = rzalloc(RZONE_RUNTIME, SOF_MEM_CAPS_RAM, sizeof(*buffer)); if (buffer == NULL) { - trace_buffer_error("ebN"); + trace_buffer_error(NULL, "ebN"); return NULL; }
buffer->addr = rballoc(RZONE_RUNTIME, desc->caps, desc->size); if (buffer->addr == NULL) { rfree(buffer); - trace_buffer_error("ebm"); + trace_buffer_error(NULL, "ebm"); return NULL; }
@@ -93,7 +93,7 @@ struct comp_buffer *buffer_new(struct sof_ipc_buffer *desc) /* free component in the pipeline */ void buffer_free(struct comp_buffer *buffer) { - trace_buffer("BFr"); + trace_buffer(buffer, "BFr");
list_item_del(&buffer->source_list); list_item_del(&buffer->sink_list); diff --git a/src/include/sof/audio/buffer.h b/src/include/sof/audio/buffer.h index 171f0a4..6109e93 100644 --- a/src/include/sof/audio/buffer.h +++ b/src/include/sof/audio/buffer.h @@ -43,9 +43,18 @@ #include <uapi/ipc.h>
/* pipeline tracing */ -#define trace_buffer(__e) trace_event(TRACE_CLASS_BUFFER, __e) -#define trace_buffer_error(__e) trace_error(TRACE_CLASS_BUFFER, __e) -#define tracev_buffer(__e) tracev_event(TRACE_CLASS_BUFFER, __e) +#define trace_buffer(cb, __e) \ + trace_buf_event(cb, NORMAL_LEVEL, TRACE_CLASS_BUFFER, __e) +#define tracev_buffer(cb, __e) \ + trace_buf_event(cb, VERBOSE_LEVEL, TRACE_CLASS_BUFFER, __e) +#define trace_buffer_error(cb, __e) \ + trace_buf_event_atomic(cb, ERROR_LEVEL, TRACE_CLASS_BUFFER, __e) +#define trace_buffer_value(cb, x) \ + trace_buf_value(cb, NORMAL_LEVEL, x) +#define tracev_buffer_value(cb, x) \ + trace_buf_value(cb, VERBOSE_LEVEL, x) +#define trace_buffer_error_value(cb, x) \ + trace_buf_value_atomic(cb, ERROR_LEVEL, x)
/* audio component buffer - connects 2 audio components together in pipeline */ struct comp_buffer { @@ -109,10 +118,14 @@ static inline void comp_update_buffer_produce(struct comp_buffer *buffer,
spin_unlock_irq(&buffer->lock, flags);
- tracev_buffer("pro"); - tracev_value((buffer->avail << 16) | buffer->free); - tracev_value((buffer->ipc_buffer.comp.id << 16) | buffer->size); - tracev_value((buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)); + tracev_buffer(buffer, "pro"); + tracev_buffer_value(buffer, + (buffer->avail << 16) | buffer->free); + tracev_buffer_value(buffer, + (buffer->ipc_buffer.comp.id << 16) | buffer->size); + tracev_buffer_value(buffer, + (buffer->r_ptr - buffer->addr) << 16 | + (buffer->w_ptr - buffer->addr)); }
/* called by a component after consuming data from this buffer */ @@ -142,10 +155,13 @@ static inline void comp_update_buffer_consume(struct comp_buffer *buffer,
spin_unlock_irq(&buffer->lock, flags);
- tracev_buffer("con"); - tracev_value((buffer->avail << 16) | buffer->free); - tracev_value((buffer->ipc_buffer.comp.id << 16) | buffer->size); - tracev_value((buffer->r_ptr - buffer->addr) << 16 | (buffer->w_ptr - buffer->addr)); + tracev_buffer(buffer, "con"); + tracev_buffer_value(buffer, (buffer->avail << 16) | buffer->free); + tracev_buffer_value(buffer, + (buffer->ipc_buffer.comp.id << 16) | buffer->size); + tracev_buffer_value(buffer, + (buffer->r_ptr - buffer->addr) << 16 | + (buffer->w_ptr - buffer->addr)); }
/* get the max number of bytes that can be copied between sink and source */