From patchwork Thu Jun 4 07:26:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xia Jiang X-Patchwork-Id: 209638 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, 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 0FD02C433DF for ; Thu, 4 Jun 2020 07:29:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DD7F32074B for ; Thu, 4 Jun 2020 07:29:33 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=mediatek.com header.i=@mediatek.com header.b="oRsfVQzi" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728093AbgFDH3c (ORCPT ); Thu, 4 Jun 2020 03:29:32 -0400 Received: from mailgw02.mediatek.com ([210.61.82.184]:28869 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728064AbgFDH3b (ORCPT ); Thu, 4 Jun 2020 03:29:31 -0400 X-UUID: cfc6fb16bf5c4c1c8011ba59839b9e94-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=oRsfVQzimPN0y/qKqdnYUdnrOINeHCI9XGskqg74NqvXt5Uws7RaPXKBCR+ZwhjWZL8vI/XU0iSplf0jcQ4D2E/qDvdQTVGz+t4TlsCLcnEFlhyXboxX83a20LbpayIdzfhXNwo6Bfk0t470axRGMgGsveztQNNS+15iBjxQbms=; X-UUID: cfc6fb16bf5c4c1c8011ba59839b9e94-20200604 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.10 Build 0809 with TLS) with ESMTP id 197240824; Thu, 04 Jun 2020 15:29:26 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs07n1.mediatek.inc (172.21.101.16) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Jun 2020 15:29:23 +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 15:29:21 +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 v9 08/18] media: platform: Cancel the last frame handling flow Date: Thu, 4 Jun 2020 15:26:58 +0800 Message-ID: <20200604072708.9468-9-xia.jiang@mediatek.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20200604072708.9468-1-xia.jiang@mediatek.com> References: <20200604072708.9468-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;