diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2015-01-29 12:36:00 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@osg.samsung.com> | 2015-04-10 09:12:31 -0400 |
commit | 9a1a8f9953f3f101ce769878fc7bbbc43a4fd2dc (patch) | |
tree | 0125a883989b58eb2fa29d4b4ddbf2dfae99734f /drivers/media | |
parent | 8191919bff678ae16050c60e1f86355d7731ac73 (diff) |
[media] coda: Add tracing support
This patch adds tracepoints to the coda driver that can be used together
with the v4l2:v4l2_qbuf and v4l2:v4l2_dqbuf tracepoints to to follow video
frames through the mem2mem device.
For encoding with the BIT processor:
coda:coda_enc_pic_run
coda:coda_enc_pic_done
For decoding with the BIT processor:
coda:coda_bit_queue
coda:coda_dec_pic_run
coda:coda_dec_pic_done
coda:coda_dec_rot_done
Additionally, two low level tracepoints register whenever the BIT processor
is started and returns:
coda:coda_bit_run
coda:coda_bit_done
Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Kamil Debski <k.debski@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/platform/coda/Makefile | 2 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 24 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda-jpeg.c | 1 | ||||
-rw-r--r-- | drivers/media/platform/coda/coda.h | 5 | ||||
-rw-r--r-- | drivers/media/platform/coda/trace.h | 203 |
5 files changed, 234 insertions, 1 deletions
diff --git a/drivers/media/platform/coda/Makefile b/drivers/media/platform/coda/Makefile index 25ce15561695..834e504bf085 100644 --- a/drivers/media/platform/coda/Makefile +++ b/drivers/media/platform/coda/Makefile | |||
@@ -1,3 +1,5 @@ | |||
1 | ccflags-y += -I$(src) | ||
2 | |||
1 | coda-objs := coda-common.o coda-bit.o coda-h264.o coda-jpeg.o | 3 | coda-objs := coda-common.o coda-bit.o coda-h264.o coda-jpeg.o |
2 | 4 | ||
3 | obj-$(CONFIG_VIDEO_CODA) += coda.o | 5 | obj-$(CONFIG_VIDEO_CODA) += coda.o |
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index d336cb66b42b..d0430071d2ee 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c | |||
@@ -30,6 +30,8 @@ | |||
30 | #include <media/videobuf2-vmalloc.h> | 30 | #include <media/videobuf2-vmalloc.h> |
31 | 31 | ||
32 | #include "coda.h" | 32 | #include "coda.h" |
33 | #define CREATE_TRACE_POINTS | ||
34 | #include "trace.h" | ||
33 | 35 | ||
34 | #define CODA_PARA_BUF_SIZE (10 * 1024) | 36 | #define CODA_PARA_BUF_SIZE (10 * 1024) |
35 | #define CODA7_PS_BUF_SIZE 0x28000 | 37 | #define CODA7_PS_BUF_SIZE 0x28000 |
@@ -88,15 +90,21 @@ static void coda_command_async(struct coda_ctx *ctx, int cmd) | |||
88 | coda_write(dev, ctx->params.codec_mode, CODA_REG_BIT_RUN_COD_STD); | 90 | coda_write(dev, ctx->params.codec_mode, CODA_REG_BIT_RUN_COD_STD); |
89 | coda_write(dev, ctx->params.codec_mode_aux, CODA7_REG_BIT_RUN_AUX_STD); | 91 | coda_write(dev, ctx->params.codec_mode_aux, CODA7_REG_BIT_RUN_AUX_STD); |
90 | 92 | ||
93 | trace_coda_bit_run(ctx, cmd); | ||
94 | |||
91 | coda_write(dev, cmd, CODA_REG_BIT_RUN_COMMAND); | 95 | coda_write(dev, cmd, CODA_REG_BIT_RUN_COMMAND); |
92 | } | 96 | } |
93 | 97 | ||
94 | static int coda_command_sync(struct coda_ctx *ctx, int cmd) | 98 | static int coda_command_sync(struct coda_ctx *ctx, int cmd) |
95 | { | 99 | { |
96 | struct coda_dev *dev = ctx->dev; | 100 | struct coda_dev *dev = ctx->dev; |
101 | int ret; | ||
97 | 102 | ||
98 | coda_command_async(ctx, cmd); | 103 | coda_command_async(ctx, cmd); |
99 | return coda_wait_timeout(dev); | 104 | ret = coda_wait_timeout(dev); |
105 | trace_coda_bit_done(ctx); | ||
106 | |||
107 | return ret; | ||
100 | } | 108 | } |
101 | 109 | ||
102 | int coda_hw_reset(struct coda_ctx *ctx) | 110 | int coda_hw_reset(struct coda_ctx *ctx) |
@@ -265,6 +273,8 @@ void coda_fill_bitstream(struct coda_ctx *ctx, bool streaming) | |||
265 | ctx->bitstream_fifo.kfifo.mask; | 273 | ctx->bitstream_fifo.kfifo.mask; |
266 | list_add_tail(&meta->list, | 274 | list_add_tail(&meta->list, |
267 | &ctx->buffer_meta_list); | 275 | &ctx->buffer_meta_list); |
276 | |||
277 | trace_coda_bit_queue(ctx, src_buf, meta); | ||
268 | } | 278 | } |
269 | 279 | ||
270 | v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); | 280 | v4l2_m2m_buf_done(src_buf, VB2_BUF_STATE_DONE); |
@@ -1240,6 +1250,8 @@ static int coda_prepare_encode(struct coda_ctx *ctx) | |||
1240 | coda_write(dev, ctx->iram_info.axi_sram_use, | 1250 | coda_write(dev, ctx->iram_info.axi_sram_use, |
1241 | CODA7_REG_BIT_AXI_SRAM_USE); | 1251 | CODA7_REG_BIT_AXI_SRAM_USE); |
1242 | 1252 | ||
1253 | trace_coda_enc_pic_run(ctx, src_buf); | ||
1254 | |||
1243 | coda_command_async(ctx, CODA_COMMAND_PIC_RUN); | 1255 | coda_command_async(ctx, CODA_COMMAND_PIC_RUN); |
1244 | 1256 | ||
1245 | return 0; | 1257 | return 0; |
@@ -1254,6 +1266,8 @@ static void coda_finish_encode(struct coda_ctx *ctx) | |||
1254 | src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); | 1266 | src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); |
1255 | dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); | 1267 | dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); |
1256 | 1268 | ||
1269 | trace_coda_enc_pic_done(ctx, dst_buf); | ||
1270 | |||
1257 | /* Get results from the coda */ | 1271 | /* Get results from the coda */ |
1258 | start_ptr = coda_read(dev, CODA_CMD_ENC_PIC_BB_START); | 1272 | start_ptr = coda_read(dev, CODA_CMD_ENC_PIC_BB_START); |
1259 | wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx)); | 1273 | wr_ptr = coda_read(dev, CODA_REG_BIT_WR_PTR(ctx->reg_idx)); |
@@ -1743,6 +1757,8 @@ static int coda_prepare_decode(struct coda_ctx *ctx) | |||
1743 | /* Clear decode success flag */ | 1757 | /* Clear decode success flag */ |
1744 | coda_write(dev, 0, CODA_RET_DEC_PIC_SUCCESS); | 1758 | coda_write(dev, 0, CODA_RET_DEC_PIC_SUCCESS); |
1745 | 1759 | ||
1760 | trace_coda_dec_pic_run(ctx, meta); | ||
1761 | |||
1746 | coda_command_async(ctx, CODA_COMMAND_PIC_RUN); | 1762 | coda_command_async(ctx, CODA_COMMAND_PIC_RUN); |
1747 | 1763 | ||
1748 | return 0; | 1764 | return 0; |
@@ -1903,6 +1919,8 @@ static void coda_finish_decode(struct coda_ctx *ctx) | |||
1903 | } | 1919 | } |
1904 | mutex_unlock(&ctx->bitstream_mutex); | 1920 | mutex_unlock(&ctx->bitstream_mutex); |
1905 | 1921 | ||
1922 | trace_coda_dec_pic_done(ctx, &ctx->frame_metas[decoded_idx]); | ||
1923 | |||
1906 | val = coda_read(dev, CODA_RET_DEC_PIC_TYPE) & 0x7; | 1924 | val = coda_read(dev, CODA_RET_DEC_PIC_TYPE) & 0x7; |
1907 | if (val == 0) | 1925 | if (val == 0) |
1908 | ctx->frame_types[decoded_idx] = V4L2_BUF_FLAG_KEYFRAME; | 1926 | ctx->frame_types[decoded_idx] = V4L2_BUF_FLAG_KEYFRAME; |
@@ -1942,6 +1960,8 @@ static void coda_finish_decode(struct coda_ctx *ctx) | |||
1942 | dst_buf->v4l2_buf.timecode = meta->timecode; | 1960 | dst_buf->v4l2_buf.timecode = meta->timecode; |
1943 | dst_buf->v4l2_buf.timestamp = meta->timestamp; | 1961 | dst_buf->v4l2_buf.timestamp = meta->timestamp; |
1944 | 1962 | ||
1963 | trace_coda_dec_rot_done(ctx, meta, dst_buf); | ||
1964 | |||
1945 | switch (q_data_dst->fourcc) { | 1965 | switch (q_data_dst->fourcc) { |
1946 | case V4L2_PIX_FMT_YUV420: | 1966 | case V4L2_PIX_FMT_YUV420: |
1947 | case V4L2_PIX_FMT_YVU420: | 1967 | case V4L2_PIX_FMT_YVU420: |
@@ -2000,6 +2020,8 @@ irqreturn_t coda_irq_handler(int irq, void *data) | |||
2000 | return IRQ_HANDLED; | 2020 | return IRQ_HANDLED; |
2001 | } | 2021 | } |
2002 | 2022 | ||
2023 | trace_coda_bit_done(ctx); | ||
2024 | |||
2003 | if (ctx->aborting) { | 2025 | if (ctx->aborting) { |
2004 | v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, | 2026 | v4l2_dbg(1, coda_debug, &ctx->dev->v4l2_dev, |
2005 | "task has been aborted\n"); | 2027 | "task has been aborted\n"); |
diff --git a/drivers/media/platform/coda/coda-jpeg.c b/drivers/media/platform/coda/coda-jpeg.c index 8fa3e353f9e2..11e734bc2cbd 100644 --- a/drivers/media/platform/coda/coda-jpeg.c +++ b/drivers/media/platform/coda/coda-jpeg.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/swab.h> | 13 | #include <linux/swab.h> |
14 | 14 | ||
15 | #include "coda.h" | 15 | #include "coda.h" |
16 | #include "trace.h" | ||
16 | 17 | ||
17 | #define SOI_MARKER 0xffd8 | 18 | #define SOI_MARKER 0xffd8 |
18 | #define EOI_MARKER 0xffd9 | 19 | #define EOI_MARKER 0xffd9 |
diff --git a/drivers/media/platform/coda/coda.h b/drivers/media/platform/coda/coda.h index 970f0b345c4e..6a5c8f6c688e 100644 --- a/drivers/media/platform/coda/coda.h +++ b/drivers/media/platform/coda/coda.h | |||
@@ -12,6 +12,9 @@ | |||
12 | * (at your option) any later version. | 12 | * (at your option) any later version. |
13 | */ | 13 | */ |
14 | 14 | ||
15 | #ifndef __CODA_H__ | ||
16 | #define __CODA_H__ | ||
17 | |||
15 | #include <linux/debugfs.h> | 18 | #include <linux/debugfs.h> |
16 | #include <linux/irqreturn.h> | 19 | #include <linux/irqreturn.h> |
17 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
@@ -294,3 +297,5 @@ extern const struct coda_context_ops coda_bit_encode_ops; | |||
294 | extern const struct coda_context_ops coda_bit_decode_ops; | 297 | extern const struct coda_context_ops coda_bit_decode_ops; |
295 | 298 | ||
296 | irqreturn_t coda_irq_handler(int irq, void *data); | 299 | irqreturn_t coda_irq_handler(int irq, void *data); |
300 | |||
301 | #endif /* __CODA_H__ */ | ||
diff --git a/drivers/media/platform/coda/trace.h b/drivers/media/platform/coda/trace.h new file mode 100644 index 000000000000..d1d06cbd1f6a --- /dev/null +++ b/drivers/media/platform/coda/trace.h | |||
@@ -0,0 +1,203 @@ | |||
1 | #undef TRACE_SYSTEM | ||
2 | #define TRACE_SYSTEM coda | ||
3 | |||
4 | #if !defined(__CODA_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ) | ||
5 | #define __CODA_TRACE_H__ | ||
6 | |||
7 | #include <linux/tracepoint.h> | ||
8 | #include <media/videobuf2-core.h> | ||
9 | |||
10 | #include "coda.h" | ||
11 | |||
12 | #define TRACE_SYSTEM_STRING __stringify(TRACE_SYSTEM) | ||
13 | |||
14 | TRACE_EVENT(coda_bit_run, | ||
15 | TP_PROTO(struct coda_ctx *ctx, int cmd), | ||
16 | |||
17 | TP_ARGS(ctx, cmd), | ||
18 | |||
19 | TP_STRUCT__entry( | ||
20 | __field(int, minor) | ||
21 | __field(int, ctx) | ||
22 | __field(int, cmd) | ||
23 | ), | ||
24 | |||
25 | TP_fast_assign( | ||
26 | __entry->minor = ctx->fh.vdev->minor; | ||
27 | __entry->ctx = ctx->idx; | ||
28 | __entry->cmd = cmd; | ||
29 | ), | ||
30 | |||
31 | TP_printk("minor = %d, ctx = %d, cmd = %d", | ||
32 | __entry->minor, __entry->ctx, __entry->cmd) | ||
33 | ); | ||
34 | |||
35 | TRACE_EVENT(coda_bit_done, | ||
36 | TP_PROTO(struct coda_ctx *ctx), | ||
37 | |||
38 | TP_ARGS(ctx), | ||
39 | |||
40 | TP_STRUCT__entry( | ||
41 | __field(int, minor) | ||
42 | __field(int, ctx) | ||
43 | ), | ||
44 | |||
45 | TP_fast_assign( | ||
46 | __entry->minor = ctx->fh.vdev->minor; | ||
47 | __entry->ctx = ctx->idx; | ||
48 | ), | ||
49 | |||
50 | TP_printk("minor = %d, ctx = %d", __entry->minor, __entry->ctx) | ||
51 | ); | ||
52 | |||
53 | TRACE_EVENT(coda_enc_pic_run, | ||
54 | TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf), | ||
55 | |||
56 | TP_ARGS(ctx, buf), | ||
57 | |||
58 | TP_STRUCT__entry( | ||
59 | __field(int, minor) | ||
60 | __field(int, index) | ||
61 | __field(int, ctx) | ||
62 | ), | ||
63 | |||
64 | TP_fast_assign( | ||
65 | __entry->minor = ctx->fh.vdev->minor; | ||
66 | __entry->index = buf->v4l2_buf.index; | ||
67 | __entry->ctx = ctx->idx; | ||
68 | ), | ||
69 | |||
70 | TP_printk("minor = %d, index = %d, ctx = %d", | ||
71 | __entry->minor, __entry->index, __entry->ctx) | ||
72 | ); | ||
73 | |||
74 | TRACE_EVENT(coda_enc_pic_done, | ||
75 | TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf), | ||
76 | |||
77 | TP_ARGS(ctx, buf), | ||
78 | |||
79 | TP_STRUCT__entry( | ||
80 | __field(int, minor) | ||
81 | __field(int, index) | ||
82 | __field(int, ctx) | ||
83 | ), | ||
84 | |||
85 | TP_fast_assign( | ||
86 | __entry->minor = ctx->fh.vdev->minor; | ||
87 | __entry->index = buf->v4l2_buf.index; | ||
88 | __entry->ctx = ctx->idx; | ||
89 | ), | ||
90 | |||
91 | TP_printk("minor = %d, index = %d, ctx = %d", | ||
92 | __entry->minor, __entry->index, __entry->ctx) | ||
93 | ); | ||
94 | |||
95 | TRACE_EVENT(coda_bit_queue, | ||
96 | TP_PROTO(struct coda_ctx *ctx, struct vb2_buffer *buf, | ||
97 | struct coda_buffer_meta *meta), | ||
98 | |||
99 | TP_ARGS(ctx, buf, meta), | ||
100 | |||
101 | TP_STRUCT__entry( | ||
102 | __field(int, minor) | ||
103 | __field(int, index) | ||
104 | __field(int, start) | ||
105 | __field(int, end) | ||
106 | __field(int, ctx) | ||
107 | ), | ||
108 | |||
109 | TP_fast_assign( | ||
110 | __entry->minor = ctx->fh.vdev->minor; | ||
111 | __entry->index = buf->v4l2_buf.index; | ||
112 | __entry->start = meta->start; | ||
113 | __entry->end = meta->end; | ||
114 | __entry->ctx = ctx->idx; | ||
115 | ), | ||
116 | |||
117 | TP_printk("minor = %d, index = %d, start = 0x%x, end = 0x%x, ctx = %d", | ||
118 | __entry->minor, __entry->index, __entry->start, __entry->end, | ||
119 | __entry->ctx) | ||
120 | ); | ||
121 | |||
122 | TRACE_EVENT(coda_dec_pic_run, | ||
123 | TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta), | ||
124 | |||
125 | TP_ARGS(ctx, meta), | ||
126 | |||
127 | TP_STRUCT__entry( | ||
128 | __field(int, minor) | ||
129 | __field(int, start) | ||
130 | __field(int, end) | ||
131 | __field(int, ctx) | ||
132 | ), | ||
133 | |||
134 | TP_fast_assign( | ||
135 | __entry->minor = ctx->fh.vdev->minor; | ||
136 | __entry->start = meta ? meta->start : 0; | ||
137 | __entry->end = meta ? meta->end : 0; | ||
138 | __entry->ctx = ctx->idx; | ||
139 | ), | ||
140 | |||
141 | TP_printk("minor = %d, start = 0x%x, end = 0x%x, ctx = %d", | ||
142 | __entry->minor, __entry->start, __entry->end, __entry->ctx) | ||
143 | ); | ||
144 | |||
145 | TRACE_EVENT(coda_dec_pic_done, | ||
146 | TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta), | ||
147 | |||
148 | TP_ARGS(ctx, meta), | ||
149 | |||
150 | TP_STRUCT__entry( | ||
151 | __field(int, minor) | ||
152 | __field(int, start) | ||
153 | __field(int, end) | ||
154 | __field(int, ctx) | ||
155 | ), | ||
156 | |||
157 | TP_fast_assign( | ||
158 | __entry->minor = ctx->fh.vdev->minor; | ||
159 | __entry->start = meta->start; | ||
160 | __entry->end = meta->end; | ||
161 | __entry->ctx = ctx->idx; | ||
162 | ), | ||
163 | |||
164 | TP_printk("minor = %d, start = 0x%x, end = 0x%x, ctx = %d", | ||
165 | __entry->minor, __entry->start, __entry->end, __entry->ctx) | ||
166 | ); | ||
167 | |||
168 | TRACE_EVENT(coda_dec_rot_done, | ||
169 | TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta, | ||
170 | struct vb2_buffer *buf), | ||
171 | |||
172 | TP_ARGS(ctx, meta, buf), | ||
173 | |||
174 | TP_STRUCT__entry( | ||
175 | __field(int, minor) | ||
176 | __field(int, start) | ||
177 | __field(int, end) | ||
178 | __field(int, index) | ||
179 | __field(int, ctx) | ||
180 | ), | ||
181 | |||
182 | TP_fast_assign( | ||
183 | __entry->minor = ctx->fh.vdev->minor; | ||
184 | __entry->start = meta->start; | ||
185 | __entry->end = meta->end; | ||
186 | __entry->index = buf->v4l2_buf.index; | ||
187 | __entry->ctx = ctx->idx; | ||
188 | ), | ||
189 | |||
190 | TP_printk("minor = %d, start = 0x%x, end = 0x%x, index = %d, ctx = %d", | ||
191 | __entry->minor, __entry->start, __entry->end, __entry->index, | ||
192 | __entry->ctx) | ||
193 | ); | ||
194 | |||
195 | #endif /* __CODA_TRACE_H__ */ | ||
196 | |||
197 | #undef TRACE_INCLUDE_PATH | ||
198 | #define TRACE_INCLUDE_PATH . | ||
199 | #undef TRACE_INCLUDE_FILE | ||
200 | #define TRACE_INCLUDE_FILE trace | ||
201 | |||
202 | /* This part must be outside protection */ | ||
203 | #include <trace/define_trace.h> | ||