[Sound-open-firmware] [PATCH] comp: xrun: improve trace output for xruns

Liam Girdwood liam.r.girdwood at linux.intel.com
Wed Sep 6 00:53:58 CEST 2017


Add more data for xrun trace analysis.

Signed-off-by: Liam Girdwood <liam.r.girdwood at linux.intel.com>
---
 src/audio/volume.c                 |  4 ++--
 src/include/reef/audio/component.h | 10 ++++++----
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/audio/volume.c b/src/audio/volume.c
index 6cbd6ff..c88f9d2 100644
--- a/src/audio/volume.c
+++ b/src/audio/volume.c
@@ -479,11 +479,11 @@ static int volume_copy(struct comp_dev *dev)
 
 	/* Run volume if buffers have enough room */
 	if (copy_bytes < cd->source_period_bytes) {
-		comp_underrun(dev, source, cd->source_period_bytes);
+		comp_underrun(dev, source, copy_bytes, cd->source_period_bytes);
 		return 0;
 	}
 	if (copy_bytes < cd->sink_period_bytes) {
-		comp_overrun(dev, source, cd->sink_period_bytes);
+		comp_overrun(dev, sink, copy_bytes, cd->sink_period_bytes);
 		return 0;
 	}
 
diff --git a/src/include/reef/audio/component.h b/src/include/reef/audio/component.h
index 35c80de..9793c36 100644
--- a/src/include/reef/audio/component.h
+++ b/src/include/reef/audio/component.h
@@ -348,19 +348,21 @@ static inline uint32_t comp_frame_bytes(struct comp_dev *dev)
 
 /* XRUN handling */
 static inline void comp_underrun(struct comp_dev *dev, struct comp_buffer *source,
-	uint32_t copy_bytes)
+	uint32_t copy_bytes, uint32_t min_bytes)
 {
 	trace_comp("Xun");
-	trace_value((source->avail << 16) | copy_bytes);
+	trace_value((dev->comp.id << 16) | source->avail);
+	trace_value((min_bytes << 16) | copy_bytes);
 
 	pipeline_xrun(dev->pipeline, dev, (int32_t)source->avail - copy_bytes);
 }
 
 static inline void comp_overrun(struct comp_dev *dev, struct comp_buffer *sink,
-	uint32_t copy_bytes)
+	uint32_t copy_bytes, uint32_t min_bytes)
 {
 	trace_comp("Xov");
-	trace_value((sink->free << 16) | copy_bytes);
+	trace_value((dev->comp.id << 16) | sink->free);
+	trace_value((min_bytes << 16) | copy_bytes);
 
 	pipeline_xrun(dev->pipeline, dev, (int32_t)copy_bytes - sink->free);
 }
-- 
2.11.0



More information about the Sound-open-firmware mailing list