linux/drivers/media/platform/coda/trace.h
Philipp Zabel 96f6f62c46 media: coda: jpeg: add CODA960 JPEG encoder support
This patch adds JPEG encoding support for CODA960, handling the JPEG
hardware directly. A separate JPEG encoder video device is created due
to the separate hardware unit and different supported pixel formats.
While the hardware can not change subsampling on the fly, it can encode
4:2:2 subsampled images into JPEGs of the same subsampling.

There are two additional tracepoints added 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 when encoding or
decoding with the CODA960 JPEG codec:
    coda:coda_jpeg_run
    coda:coda_jpeg_done

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
Tested-by: Richard Leitner <richard.leitner@skidata.com>
[hverkuil-cisco@xs4all.nl: removed unused k and q_data_dst variables]
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
2019-12-16 10:07:59 +01:00

176 lines
4 KiB
C

/* SPDX-License-Identifier: GPL-2.0 */
#undef TRACE_SYSTEM
#define TRACE_SYSTEM coda
#if !defined(__CODA_TRACE_H__) || defined(TRACE_HEADER_MULTI_READ)
#define __CODA_TRACE_H__
#include <linux/tracepoint.h>
#include <media/videobuf2-v4l2.h>
#include "coda.h"
TRACE_EVENT(coda_bit_run,
TP_PROTO(struct coda_ctx *ctx, int cmd),
TP_ARGS(ctx, cmd),
TP_STRUCT__entry(
__field(int, minor)
__field(int, ctx)
__field(int, cmd)
),
TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor;
__entry->ctx = ctx->idx;
__entry->cmd = cmd;
),
TP_printk("minor = %d, ctx = %d, cmd = %d",
__entry->minor, __entry->ctx, __entry->cmd)
);
TRACE_EVENT(coda_bit_done,
TP_PROTO(struct coda_ctx *ctx),
TP_ARGS(ctx),
TP_STRUCT__entry(
__field(int, minor)
__field(int, ctx)
),
TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor;
__entry->ctx = ctx->idx;
),
TP_printk("minor = %d, ctx = %d", __entry->minor, __entry->ctx)
);
DECLARE_EVENT_CLASS(coda_buf_class,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
TP_ARGS(ctx, buf),
TP_STRUCT__entry(
__field(int, minor)
__field(int, index)
__field(int, ctx)
),
TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor;
__entry->index = buf->vb2_buf.index;
__entry->ctx = ctx->idx;
),
TP_printk("minor = %d, index = %d, ctx = %d",
__entry->minor, __entry->index, __entry->ctx)
);
DEFINE_EVENT(coda_buf_class, coda_enc_pic_run,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
TP_ARGS(ctx, buf)
);
DEFINE_EVENT(coda_buf_class, coda_enc_pic_done,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
TP_ARGS(ctx, buf)
);
DECLARE_EVENT_CLASS(coda_buf_meta_class,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
struct coda_buffer_meta *meta),
TP_ARGS(ctx, buf, meta),
TP_STRUCT__entry(
__field(int, minor)
__field(int, index)
__field(int, start)
__field(int, end)
__field(int, ctx)
),
TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor;
__entry->index = buf->vb2_buf.index;
__entry->start = meta->start & ctx->bitstream_fifo.kfifo.mask;
__entry->end = meta->end & ctx->bitstream_fifo.kfifo.mask;
__entry->ctx = ctx->idx;
),
TP_printk("minor = %d, index = %d, start = 0x%x, end = 0x%x, ctx = %d",
__entry->minor, __entry->index, __entry->start, __entry->end,
__entry->ctx)
);
DEFINE_EVENT(coda_buf_meta_class, coda_bit_queue,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
struct coda_buffer_meta *meta),
TP_ARGS(ctx, buf, meta)
);
DECLARE_EVENT_CLASS(coda_meta_class,
TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta),
TP_ARGS(ctx, meta),
TP_STRUCT__entry(
__field(int, minor)
__field(int, start)
__field(int, end)
__field(int, ctx)
),
TP_fast_assign(
__entry->minor = ctx->fh.vdev->minor;
__entry->start = meta ? (meta->start &
ctx->bitstream_fifo.kfifo.mask) : 0;
__entry->end = meta ? (meta->end &
ctx->bitstream_fifo.kfifo.mask) : 0;
__entry->ctx = ctx->idx;
),
TP_printk("minor = %d, start = 0x%x, end = 0x%x, ctx = %d",
__entry->minor, __entry->start, __entry->end, __entry->ctx)
);
DEFINE_EVENT(coda_meta_class, coda_dec_pic_run,
TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta),
TP_ARGS(ctx, meta)
);
DEFINE_EVENT(coda_meta_class, coda_dec_pic_done,
TP_PROTO(struct coda_ctx *ctx, struct coda_buffer_meta *meta),
TP_ARGS(ctx, meta)
);
DEFINE_EVENT(coda_buf_meta_class, coda_dec_rot_done,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf,
struct coda_buffer_meta *meta),
TP_ARGS(ctx, buf, meta)
);
DEFINE_EVENT(coda_buf_class, coda_jpeg_run,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
TP_ARGS(ctx, buf)
);
DEFINE_EVENT(coda_buf_class, coda_jpeg_done,
TP_PROTO(struct coda_ctx *ctx, struct vb2_v4l2_buffer *buf),
TP_ARGS(ctx, buf)
);
#endif /* __CODA_TRACE_H__ */
#undef TRACE_INCLUDE_PATH
#define TRACE_INCLUDE_PATH ../../drivers/media/platform/coda
#undef TRACE_INCLUDE_FILE
#define TRACE_INCLUDE_FILE trace
/* This part must be outside protection */
#include <trace/define_trace.h>