From patchwork Fri Apr 12 15:51:25 2019
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
X-Patchwork-Submitter: Philipp Zabel
X-Patchwork-Id: 10898599
Return-Path:
Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org
[172.30.200.125])
by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 29AA117EF
for ;
Fri, 12 Apr 2019 15:51:45 +0000 (UTC)
Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0B60428E6E
for ;
Fri, 12 Apr 2019 15:51:45 +0000 (UTC)
Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486)
id 09D0128EC3; Fri, 12 Apr 2019 15:51:45 +0000 (UTC)
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on
pdx-wl-mail.web.codeaurora.org
X-Spam-Level:
X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI,
RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1
Received: from vger.kernel.org (vger.kernel.org [209.132.180.67])
by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7EDA928EBB
for ;
Fri, 12 Apr 2019 15:51:44 +0000 (UTC)
Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand
id S1726974AbfDLPvn (ORCPT
);
Fri, 12 Apr 2019 11:51:43 -0400
Received: from metis.ext.pengutronix.de ([85.220.165.71]:47031 "EHLO
metis.ext.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org
with ESMTP id S1726702AbfDLPvn (ORCPT
);
Fri, 12 Apr 2019 11:51:43 -0400
Received: from dude02.hi.pengutronix.de ([2001:67c:670:100:1d::28]
helo=dude02.pengutronix.de.)
by metis.ext.pengutronix.de with esmtp (Exim 4.89)
(envelope-from )
id 1hEySr-0000EY-95; Fri, 12 Apr 2019 17:51:41 +0200
From: Philipp Zabel
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
Message-Id: <20190412155135.13907-3-p.zabel@pengutronix.de>
X-Mailer: git-send-email 2.20.1
In-Reply-To: <20190412155135.13907-1-p.zabel@pengutronix.de>
References: <20190412155135.13907-1-p.zabel@pengutronix.de>
MIME-Version: 1.0
X-SA-Exim-Connect-IP: 2001:67c:670:100:1d::28
X-SA-Exim-Mail-From: p.zabel@pengutronix.de
X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de);
SAEximRunCond expanded to false
X-PTX-Original-Recipient: linux-media@vger.kernel.org
Sender: linux-media-owner@vger.kernel.org
Precedence: bulk
List-ID:
X-Mailing-List: linux-media@vger.kernel.org
X-Virus-Scanned: ClamAV using ClamSMTP
Add a function to translate from V4L2 buffer flags to 'I'/'P'/'B'
characters for debug output.
Signed-off-by: Philipp Zabel
---
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",