From patchwork Thu Jun 4 09:05:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209612 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, MIME_BASE64_TEXT, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNPARSEABLE_RELAY, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BB0C2C433E0 for ; Thu, 4 Jun 2020 09:09:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 955AD2065C for ; Thu, 4 Jun 2020 09:09:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="smMkJ/ut" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728623AbgFDJJq (ORCPT ); Thu, 4 Jun 2020 05:09:46 -0400 Received: from mailgw01.mediatek.com ([210.61.82.183]:56880 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728188AbgFDJIP (ORCPT ); Thu, 4 Jun 2020 05:08:15 -0400 X-UUID: 3ca66dc8564d480cbb5e31ed25bba095-20200604 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=mediatek.com; s=dk; h=Content-Transfer-Encoding:Content-Type:MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:CC:To:From; bh=B/w2ehlpdSMG2o1JAKklslgzvugqL0CKOQBnvbbutuc=; b=smMkJ/utJzrgVNvDcRT4RUMjB2jRAkpK1P0DlNYTdIwqNZhC5IWx3v5tpfnMSQInPWaX8lm1rNUgtJMTJn7D8H99yQcXOVaibtxXjhX0n57XKJaABNtk6xOueU9X+NAAvE6b6tIrmXbRvVRIFLiSO3TF+dk0d/qfaWz9zr4nVOU=; X-UUID: 3ca66dc8564d480cbb5e31ed25bba095-20200604 Received: from mtkcas11.mediatek.inc [(172.21.101.40)] by mailgw01.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 157217895; Thu, 04 Jun 2020 17:08:12 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n2.mediatek.inc (172.21.101.141) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 17:08:09 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Thu, 4 Jun 2020 17:08:08 +0800 From: Xia Jiang To: Hans Verkuil , Mauro Carvalho Chehab , Rob Herring , Matthias Brugger , Rick Chang CC: , , , , , Marek Szyprowski , Tomasz Figa , , , , , , , Xia Jiang Subject: [PATCH RESEND v9 08/18] media: platform: Cancel the last frame handling flow Date: Thu, 4 Jun 2020 17:05:43 +0800 Message-ID: <20200604090553.10861-10-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604090553.10861-1-xia.jiang@mediatek.com> References: <20200604090553.10861-1-xia.jiang@mediatek.com> MIME-Version: 1.0 X-MTK: N Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org There is no need to queue an empty buffer for signaling a last frame, because all frames are separate from each other in JPEG. Signed-off-by: Xia Jiang --- v9: new patch --- .../media/platform/mtk-jpeg/mtk_jpeg_core.c | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) -- 2.18.0 diff --git a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c index 49bdbf1c435f..bb4ebce881ee 100644 --- a/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mtk-jpeg/mtk_jpeg_core.c @@ -55,15 +55,9 @@ static struct mtk_jpeg_fmt mtk_jpeg_formats[] = { #define MTK_JPEG_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_formats) -enum { - MTK_JPEG_BUF_FLAGS_INIT = 0, - MTK_JPEG_BUF_FLAGS_LAST_FRAME = 1, -}; - struct mtk_jpeg_src_buf { struct vb2_v4l2_buffer b; struct list_head list; - int flags; struct mtk_jpeg_dec_param dec_param; }; @@ -520,8 +514,6 @@ static int mtk_jpeg_qbuf(struct file *file, void *priv, struct v4l2_buffer *buf) vb = vb2_get_buffer(vq, buf->index); jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(vb); - jpeg_src_buf->flags = (buf->m.planes[0].bytesused == 0) ? - MTK_JPEG_BUF_FLAGS_LAST_FRAME : MTK_JPEG_BUF_FLAGS_INIT; end: return v4l2_m2m_qbuf(file, fh->m2m_ctx, buf); } @@ -676,10 +668,6 @@ static void mtk_jpeg_buf_queue(struct vb2_buffer *vb) param = &jpeg_src_buf->dec_param; memset(param, 0, sizeof(*param)); - if (jpeg_src_buf->flags & MTK_JPEG_BUF_FLAGS_LAST_FRAME) { - v4l2_dbg(1, debug, &jpeg->v4l2_dev, "Got eos\n"); - goto end; - } header_valid = mtk_jpeg_parse(param, (u8 *)vb2_plane_vaddr(vb, 0), vb2_get_plane_payload(vb, 0)); if (!header_valid) { @@ -792,19 +780,12 @@ static void mtk_jpeg_device_run(void *priv) struct mtk_jpeg_src_buf *jpeg_src_buf; struct mtk_jpeg_bs bs; struct mtk_jpeg_fb fb; - int i, ret; + int ret; src_buf = v4l2_m2m_next_src_buf(ctx->fh.m2m_ctx); dst_buf = v4l2_m2m_next_dst_buf(ctx->fh.m2m_ctx); jpeg_src_buf = mtk_jpeg_vb2_to_srcbuf(&src_buf->vb2_buf); - if (jpeg_src_buf->flags & MTK_JPEG_BUF_FLAGS_LAST_FRAME) { - for (i = 0; i < dst_buf->vb2_buf.num_planes; i++) - vb2_set_plane_payload(&dst_buf->vb2_buf, i, 0); - buf_state = VB2_BUF_STATE_DONE; - goto dec_end; - } - if (mtk_jpeg_check_resolution_change(ctx, &jpeg_src_buf->dec_param)) { mtk_jpeg_queue_src_chg_event(ctx); ctx->state = MTK_JPEG_SOURCE_CHANGE;