summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/sti/delta/delta-debug.c
blob: 4b2eb6b63aa25a5a7ad1663c29ae53d2101982e1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
// SPDX-License-Identifier: GPL-2.0
/*
 * Copyright (C) STMicroelectronics SA 2015
 * Authors: Hugues Fruchet <hugues.fruchet@st.com>
 *          Fabrice Lecoultre <fabrice.lecoultre@st.com>
 *          for STMicroelectronics.
 */

#include "delta.h"
#include "delta-debug.h"

char *delta_streaminfo_str(struct delta_streaminfo *s, char *str,
			   unsigned int len)
{
	if (!s)
		return NULL;

	snprintf(str, len,
		 "%4.4s %dx%d %s %s dpb=%d %s %s %s%dx%d@(%d,%d) %s%d/%d",
		 (char *)&s->streamformat, s->width, s->height,
		 s->profile, s->level, s->dpb,
		 (s->field == V4L2_FIELD_NONE) ? "progressive" : "interlaced",
		 s->other,
		 s->flags & DELTA_STREAMINFO_FLAG_CROP ? "crop=" : "",
		 s->crop.width, s->crop.height,
		 s->crop.left, s->crop.top,
		 s->flags & DELTA_STREAMINFO_FLAG_PIXELASPECT ? "par=" : "",
		 s->pixelaspect.numerator,
		 s->pixelaspect.denominator);

	return str;
}

char *delta_frameinfo_str(struct delta_frameinfo *f, char *str,
			  unsigned int len)
{
	if (!f)
		return NULL;

	snprintf(str, len,
		 "%4.4s %dx%d aligned %dx%d %s %s%dx%d@(%d,%d) %s%d/%d",
		 (char *)&f->pixelformat, f->width, f->height,
		 f->aligned_width, f->aligned_height,
		 (f->field == V4L2_FIELD_NONE) ? "progressive" : "interlaced",
		 f->flags & DELTA_STREAMINFO_FLAG_CROP ? "crop=" : "",
		 f->crop.width, f->crop.height,
		 f->crop.left, f->crop.top,
		 f->flags & DELTA_STREAMINFO_FLAG_PIXELASPECT ? "par=" : "",
		 f->pixelaspect.numerator,
		 f->pixelaspect.denominator);

	return str;
}

void delta_trace_summary(struct delta_ctx *ctx)
{
	struct delta_dev *delta = ctx->dev;
	struct delta_streaminfo *s = &ctx->streaminfo;
	unsigned char str[100] = "";

	if (!(ctx->flags & DELTA_FLAG_STREAMINFO))
		return;

	dev_dbg(delta->dev, "%s %s, %d frames decoded, %d frames output, %d frames dropped, %d stream errors, %d decode errors",
		ctx->name,
		delta_streaminfo_str(s, str, sizeof(str)),
		ctx->decoded_frames,
		ctx->output_frames,
		ctx->dropped_frames,
		ctx->stream_errors,
		ctx->decode_errors);
}