All of lore.kernel.org
 help / color / mirror / Atom feed
From: Philipp Zabel <p.zabel@pengutronix.de>
To: linux-media@vger.kernel.org
Cc: kernel@pengutronix.de
Subject: [PATCH 03/13] media: coda: add coda_frame_type_char helper
Date: Fri, 12 Apr 2019 17:51:25 +0200	[thread overview]
Message-ID: <20190412155135.13907-3-p.zabel@pengutronix.de> (raw)
In-Reply-To: <20190412155135.13907-1-p.zabel@pengutronix.de>

Add a function to translate from V4L2 buffer flags to 'I'/'P'/'B'
characters for debug output.

Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/media/platform/coda/coda-bit.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c
index eaa86737fa04..a0dbee2262e9 100644
--- a/drivers/media/platform/coda/coda-bit.c
+++ b/drivers/media/platform/coda/coda-bit.c
@@ -1456,6 +1456,13 @@ static int coda_prepare_encode(struct coda_ctx *ctx)
 	return 0;
 }
 
+static char coda_frame_type_char(u32 flags)
+{
+	return (flags & V4L2_BUF_FLAG_KEYFRAME) ? 'I' :
+	       (flags & V4L2_BUF_FLAG_PFRAME) ? 'P' :
+	       (flags & V4L2_BUF_FLAG_BFRAME) ? 'B' : '?';
+}
+
 static void coda_finish_encode(struct coda_ctx *ctx)
 {
 	struct vb2_v4l2_buffer *src_buf, *dst_buf;
@@ -1512,8 +1519,7 @@ static void coda_finish_encode(struct coda_ctx *ctx)
 		ctx->gopcounter = ctx->params.gop_size - 1;
 
 	coda_dbg(1, ctx, "job finished: encoded %c frame (%d)\n",
-		 (dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ? 'I' : 'P',
-		 dst_buf->sequence);
+		 coda_frame_type_char(dst_buf->flags), dst_buf->sequence);
 }
 
 static void coda_seq_end_work(struct work_struct *work)
@@ -2241,8 +2247,7 @@ static void coda_finish_decode(struct coda_ctx *ctx)
 			coda_m2m_buf_done(ctx, dst_buf, VB2_BUF_STATE_DONE);
 
 		coda_dbg(1, ctx, "job finished: decoded %c frame (%u/%u)\n",
-			 (dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ? 'I' :
-			 ((dst_buf->flags & V4L2_BUF_FLAG_PFRAME) ? 'P' : 'B'),
+			 coda_frame_type_char(dst_buf->flags),
 			 dst_buf->sequence, ctx->qsequence);
 	} else {
 		coda_dbg(1, ctx, "job finished: no frame decoded (%u/%u)\n",
-- 
2.20.1


  parent reply	other threads:[~2019-04-12 15:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 15:51 [PATCH 01/13] media: coda: move register debugging to coda_debug level 3 Philipp Zabel
2019-04-12 15:51 ` [PATCH 02/13] media: coda: move job ready message to coda_debug level 2 Philipp Zabel
2019-04-12 15:51 ` Philipp Zabel [this message]
2019-04-12 15:51 ` [PATCH 04/13] media: coda: improve decoder job finished debug message Philipp Zabel
2019-04-12 15:51 ` [PATCH 05/13] media: coda: demote s_ctrl debug messages to level 2 Philipp Zabel
2019-04-12 15:51 ` [PATCH 06/13] media: coda: add menu strings to s_ctrl debug output Philipp Zabel
2019-04-12 15:51 ` [PATCH 07/13] media: coda: update profile and level controls after sequence initialization Philipp Zabel
2019-04-12 15:51 ` [PATCH 08/13] media: coda: add decoder MPEG-4 profile and level controls Philipp Zabel
2019-05-21 11:29   ` Mauro Carvalho Chehab
2019-05-22  9:09     ` [PATCH v2] " Philipp Zabel
2019-05-27 12:19       ` [PATCH v3] " Philipp Zabel
2019-04-12 15:51 ` [PATCH 09/13] media: v4l2-ctrl: add MPEG-2 " Philipp Zabel
2019-04-24  9:29   ` Hans Verkuil
2019-04-24 10:43   ` [PATCH v2] " Philipp Zabel
2019-04-12 15:51 ` [PATCH 10/13] media: coda: add decoder " Philipp Zabel
2019-05-27 12:20   ` [PATCH v2] " Philipp Zabel
2019-04-12 15:51 ` [PATCH 11/13] media: coda: add lockdep asserts Philipp Zabel
2019-04-12 15:51 ` [PATCH 12/13] media: coda: use v4l2_m2m_buf_copy_metadata Philipp Zabel
2019-04-12 15:51 ` [PATCH 13/13] media: coda: fix unset field and fail on invalid field in buf_prepare Philipp Zabel
2019-04-25 18:55   ` Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190412155135.13907-3-p.zabel@pengutronix.de \
    --to=p.zabel@pengutronix.de \
    --cc=kernel@pengutronix.de \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.