From patchwork Wed Mar 23 09:05:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12789582 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A468AC433F5 for ; Wed, 23 Mar 2022 09:07:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=+LleYKRloxus7oQL8p3RB28ljQTboZHHVAK3j0835Mo=; b=mBFuL/KD5XzhES Y+kNwZkDOoL87oDOra9DOE59PZZLhcN6AcaF+EbiZOp0/0RqCfyKXQTOjomz6KiujSw/oGok78Dt0 Zxp5wyPBO2Kyx+JuFCMFuSlRDHuMwvHRO8oQnwK2Q2Q5ewmesvQ24aGhEUx6LZ/VBXVmPIenbFF/y LlqimhSpk0b+wpQr7Hir16Wgm6TR8mna0u8Qj6xWFzNuA9sXz6LLQnT+ciV3HmJuhGTqKETJvSXG7 LW5S1UALJ3i7kdS6b9jWd7lq3HXzI1UdBIp5JXJ/YDyz/UBOjKUIfJdWkd9SKIejYm2K6SA5OavIw 74qSw0pmV/xYxdSZjNpw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWwwt-00DBCB-E7; Wed, 23 Mar 2022 09:06:35 +0000 Received: from mail-he1eur04on061c.outbound.protection.outlook.com ([2a01:111:f400:fe0d::61c] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWwwg-00DB7p-JF for linux-arm-kernel@lists.infradead.org; Wed, 23 Mar 2022 09:06:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dh/QtLEXij8ODAO8pn3P0su8WYR0tIHCxeN5cuO/33mPP63/5nRQZxmT4khg7VJLAa5KdHQgx2Dtr6cViQ73/HflDVh9h9VtkiShPgPEUdWyrPgaEu7u1CzliNlOy9EoAzAjYYQQVYH5jcT0SU0FgXCDKnee12oxpc4aMFonayr+HU6M0n2c/ViF4Zgc98gSTJbQhOhkQcy7nmBuu9Aqq5a5o7gH3H19MLOlWimWIqLVhCCdrSeWjqh4YBD1UY5xm4BnO1TSeGlzQnTTj12mfgXFhsObc8+FbGVZiKN7HpNDflpsM+BQkDxJZgD+K7ijEpi8GOhd9R1Vjqmxk+rugA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=nV+4+ggQij4sZAFQbBSSvSn62mz5psI8ZHje06+CNwc=; b=YAaQVp9aiCz3G8WAui6U1N1n7QTGul/GPXtyCAHIlBnsfAZEx2+ZszctkUzj812HRQYRI2NCDvXIlocAW8LSiGoRavnho3gW4ujhVGf2lHbBWN/FNZJloynokKRNri48mLiKQnhS2v/XoPXpVNCBzR3zAxCOh4uXBnI/KJWcmEHVlBkGZ/xyecNLZYn1NOgi/6oWFKDeXb2mSu5555e9BmOG21CK3fYD44zWA9WZhecUdmzwaQAd/8mRd++9DQfCX0E32YfFQMqpfr8fv9Fr3lD2lXU5VaI+IkID9c6exWT0F+D6AvvOUcgM/+7aH8+6fjcp+X5tJE0V3MJE33Tn1A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=nV+4+ggQij4sZAFQbBSSvSn62mz5psI8ZHje06+CNwc=; b=KtiOONj2iapUFXpzQCBhltiPVpMwPb/gawExTS7lJYTdwsqA6bx8uA2xedpOQDi8iGjFH6WWhBEaoWa9tKvkEgVpk2L05qMCzCmi72s2ud3XAlvLtJecpBU00pMXXVMPke6LfHQ0qy7VA32KsU/hG3GsuD/6PajsCb2XA7Son0Y= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) by AM6PR04MB4901.eurprd04.prod.outlook.com (2603:10a6:20b:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5081.23; Wed, 23 Mar 2022 09:06:18 +0000 Received: from AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::c39:69cf:c4ea:967]) by AM6PR04MB6341.eurprd04.prod.outlook.com ([fe80::c39:69cf:c4ea:967%5]) with mapi id 15.20.5102.017; Wed, 23 Mar 2022 09:06:18 +0000 From: Ming Qian To: mchehab@kernel.org, shawnguo@kernel.org, s.hauer@pengutronix.de, mirela.rabulea@oss.nxp.com Cc: hverkuil-cisco@xs4all.nl, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 1/5] media: imx-jpeg: Refactor function mxc_jpeg_parse Date: Wed, 23 Mar 2022 17:05:54 +0800 Message-Id: <9f67125ccbab5d36f985c783990ac2767df50f36.1648023273.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: References: X-ClientProxiedBy: SG2PR0401CA0014.apcprd04.prod.outlook.com (2603:1096:3:1::24) To AM6PR04MB6341.eurprd04.prod.outlook.com (2603:10a6:20b:d8::14) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 0046c55c-68b5-4fc6-03fc-08da0cac6438 X-MS-TrafficTypeDiagnostic: AM6PR04MB4901:EE_ X-Microsoft-Antispam-PRVS: X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: flrJmAd6lUceAqs/sS26ZJWhXoEMbCU+cKtXdD1Q+OiOsaA7B5qLU1x5VAqLf/FLUnqUgVtzzS3aAwL4eHufNi+2V3tUmQYGoPn50zeaqTZng1jJtEwTT5GbLBI/hv/XqPqSY5W+NChdTXMEgD6RosKMH7GMw4d9wAohe/B30a/uJLTW0xr4251ceskW1Bl2veKTHk/uyMHgFvQ0i2Inx3dm/577PviM6yM+4DAuwZoX0UNAFFOpxhsbB6NG5sYdsLTspMN3MaeBSh45Oit8kGnNnBV94RLYnbAeC4/OJEZzXl3ma8QUEX7aHoraRtHe91Wclvdv24J9dmTwGgv9baTbg0TgssVQzhWM6qljllixnqlaEdbnhZb5brcQPX1lsL/Pu7WdaRohJ/ewEkPGnTfynAL1H3JL8o42f3UkZLdolKty4O6h4O3bU1BVlwVA7zNLZNXqUicjIhdp25qO2WHCUgQB1SiR7MCk9yYDLoxMQj795fgmoN3xHRhJkGvqert6JsiizkLjpqEj06KD039rFfLIVrRA638JFKkglGfzu07qp/omMvwbnZ6ehwsaVlrf1So0s2o+xUMMghOzju2As+LaWanjtCO36hdIT/ILnKWXMGp8Eiwf53vOcrSGZs+WBXyj217OH5BtuROIUhq91lUcpWpUwy2FqorsZ2dbibGP4KUamQiefE0IhekbDV5Nh+cLZVuSMbTKgxcWcg== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR04MB6341.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230001)(4636009)(366004)(36756003)(2906002)(38100700002)(38350700002)(316002)(8676002)(4326008)(66946007)(66556008)(66476007)(6486002)(6506007)(86362001)(508600001)(8936002)(83380400001)(7416002)(52116002)(6666004)(44832011)(5660300002)(26005)(186003)(2616005)(6512007); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 49iIVbEeBSdDIF42GMc4hJrwBgGs/Ndvz3pGgEjWQ5JUIUHj0bmCTAQYhJ3Nt5NYdMRcbwhUPdQIxUYJ4p+D4cjVZBpZLMXQ6Os0p636frpgb7Ul0ycdlOu5WvBkHbL5qCzRhZFu3JOmQMikhZJXXZ3N2w4/agzK8tM5r85rvWhuAorsHLWkB8GRkvELMOkUwBizLkrgrdxP9OXZPjHK39pt/s08JYD2p85fMc9+T34Nr6YAXN+KST4+gIZCZhDJfb9N0PjRjXj7HJnEat6LtSrQZKsDQFdx5NG09uGyqX9Har66WAFO3PWOW7OpJGDL3zACWFlM4Kl+RQNqiCbelJfe5j+VLOQrebIFhoKVzjLNzxAogDPlF30+4yvdICkyL5ktOqhtrUiSkPN1CQxSY7OBO56VNTZ5+xHy7qPRE0ViBN/2ruglz1QEb60OFlxl3uMywcjp/yYLB7Md9zh3a98WpRhozrAOHJoixXTla1+bACUO5EpuBxGUEqKsUQ4IUu91L9OTjwu5Xl8KVNlOVqy/XHysA6KC8Qpd89wBrVvcwgbyEmvc8kIywRUKou74/KONh3ev3gHLYGgkADvinKpmuzHCoKfbLmdBbFdYQUXI5BSoZVNKL2SYrC+B8oIO+ZtsmD+RxaBkuWgMAtw/r6sFnEGXz/Hvfd31xM+GhW24SGpr9gc/HPJUhwmQro8/a5+r/c5m0Jji4BydldtaFArwS87/y7NoTVOIPBMr4rbumRjZFm/7fNQN+omQYCuXPEq/stgkFluwuaxxSN6cF/0nX8oRelX9rqfG5pwrb6hCS0dgzJ28LG1QwItl9TLbFTK5LqB/3m+qNzqzVp1DdQjrCgJM6uBcyAl32ayY8+UGM1ck3Rk4dG6PdY8UJgAm3oJGlu6utk1OwmHTxg31iUSdnhlJrMvpR+p9CbtzAg5wNHlfvzJcUPGqxjDr/vUkqrcNwrmU87Qi3eVrwwsEBwLYhUzqBw1ujgzHAbXA/ewmU+ThebVjCBgDhFlikB5bQCpepEpuJ5jvNFzfzN0Wt8y8BUJx+5LuzKejcz6IkluZ8bFOB8ixjEz8i4bMGmwOXogPHxOK7PtQnVHxQH5LPse56B7OP2UwvmSDhgRXmKa1ujRMhA+6LO4KmAd+icbEPewtxgW+nPMEnLqdE1l2llYuP0gENsSs7PPrS3dtSvHiFsjX2v6TlF+NF6nU2/riaoVQ57r9eCjyWsmT11C3TUjpFe4oRGqPJgGczc8AuJwfhCF1qGoQxklkQ9vuCVU7beHVKfION6RTZwXyUhH4McITKaFWLBDk30y5m1ZxcpwPxy376e/4ve5/SKUfXpO42UwRPZgkN1tMLEO2HCpC0I0EEW8SgotzCskZAE5gI8lF5A9RMjRNfTB7Pb8px8fQ01pRTnruxT700Jt9pixdVAXNmvd0TEeUghQT38/7t6DHQmyR2VpQduOyhX1bfWcm X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0046c55c-68b5-4fc6-03fc-08da0cac6438 X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2022 09:06:18.3522 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Bs3Mt+Qeo7rLiW8ocve2CI4bYJOT/H/NiZttdPhP2n03O8KlgWFeydDwhlb7NHB6FoLrKh25Z2s4ZpdwMckk4Q== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB4901 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220323_020622_673876_63F9997B X-CRM114-Status: GOOD ( 10.93 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Refine code to support dynamic resolution change Signed-off-by: Ming Qian --- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index d1ec1f4b506b..48e496cec04d 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -1245,8 +1245,7 @@ static void mxc_jpeg_sizeimage(struct mxc_jpeg_q_data *q) } } -static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, - u8 *src_addr, u32 size, bool *dht_needed) +static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) { struct device *dev = ctx->mxc_jpeg->dev; struct mxc_jpeg_q_data *q_data_out, *q_data_cap; @@ -1256,6 +1255,9 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct v4l2_jpeg_header header; struct mxc_jpeg_sof *psof = NULL; struct mxc_jpeg_sos *psos = NULL; + struct mxc_jpeg_src_buf *jpeg_src_buf = vb2_to_mxc_buf(vb); + u8 *src_addr = (u8 *)vb2_plane_vaddr(vb, 0); + u32 size = vb2_get_plane_payload(vb, 0); int ret; memset(&header, 0, sizeof(header)); @@ -1266,7 +1268,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, } /* if DHT marker present, no need to inject default one */ - *dht_needed = (header.num_dht == 0); + jpeg_src_buf->dht_needed = (header.num_dht == 0); q_data_out = mxc_jpeg_get_q_data(ctx, V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE); @@ -1381,10 +1383,7 @@ static void mxc_jpeg_buf_queue(struct vb2_buffer *vb) jpeg_src_buf = vb2_to_mxc_buf(vb); jpeg_src_buf->jpeg_parse_error = false; - ret = mxc_jpeg_parse(ctx, - (u8 *)vb2_plane_vaddr(vb, 0), - vb2_get_plane_payload(vb, 0), - &jpeg_src_buf->dht_needed); + ret = mxc_jpeg_parse(ctx, vb); if (ret) jpeg_src_buf->jpeg_parse_error = true;