From patchwork Fri Mar 11 07:51:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12777579 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 4CF6AC433EF for ; Fri, 11 Mar 2022 07:54:20 +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=DkK4PcMDrjXIjgMoT4bN1Qxb5/yoDueLPOHLIm7qCa8=; b=obEbW3VZwqWyvh PExnpwtPzOqnsVEyJXpJhfpfXojDjvRbeJxtsx+eCNgWZONPQ5jRJaHZlZFD1LjlwkuLJU5wwriKU EFvGW9wQdS9QRFfQJjpxLVraMcPr5G8tfk0wEJLb+cWX9Yusbbrh8cjD9bGKqn42jB6F8bDdhkeir Z4T6HYo7L2xGhwlbGLeZXZvJ02sJWl/n2vQiGG3EY/aWbmeYfuv8/BxS6AJC4Ub3G9Lj5rVrJE0uL MoILm/5ECCbTgMPnu7ISvu6BQYdMrjQRMkMKdU6HgLp/j9y8r6Mbc7gfZcdpyPE3wkS3y0y5rc1tK W6hYo7LezV98j0y/MPjw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSa4s-00FOmr-7H; Fri, 11 Mar 2022 07:52:46 +0000 Received: from mail-am6eur05on20609.outbound.protection.outlook.com ([2a01:111:f400:7e1b::609] helo=EUR05-AM6-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSa4e-00FOgY-T9 for linux-arm-kernel@lists.infradead.org; Fri, 11 Mar 2022 07:52:34 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gnPQI+UEJhdh/tb0KBuRqmyVB6EaGk5oKGCpqrUwHW47I8FlVqB8A1IoEU8At3i8Y9s6fI/qSiprWbaBalrvx8ZlPc/CoLIYI+rzCEB/DzTEYNAoNgbeC34koXSzgtIXfI2/i5WQuGtHEbMvYYXAypbUh2knGCdY7PB/EnipBSdDBk2atB3+zmHtR4tElNFUh+CWh/ZoKesAYSS/UoIvpMVzNjbcFXeFTp90gkgkBmI6/4M5U19e71cVmWCXrT2VkXzdi5goJH6c6OcQx9fl9xxWTqcTBV/XudX1Qd+zBvroX/L7CYG2nFQ/vfNBjLeQJMaPGjZGTEA90iuNN+f5mw== 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=X7hcNMneOC9xJkl/Wtf0wJPxGaqpQjEMuKLCGvH/sRI=; b=aY9dfsMqi/5MR/u/ITqMj2Zsu1frkUVbowJBJowRTkYPBWwrEHGsoZvP7uLThBuuRfNk5FHlKActle2l6SrfApt/4Mbk5ZBzcQU+TinXCAfLKeyMZschY3QybwbB1nn0qNGvT/8XKZLgY7g2NC6CQlaeogjd69Xjm2YG7EUFzAmf75qURkR6cQM8xb3SrV3cCQ0ziVX8j4iWHubFkNLX/yftqbCevEOPRG09yY3Q0ON0RMPvEOCDQrpOKN8h4M8mr06SVJJszpxntX9NPfSyuIt345fRoR2f/UYbAEnm1MVQWXPj33ws6edaMH886hfRMqCPnib/bggKU13PPwtzpQ== 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=X7hcNMneOC9xJkl/Wtf0wJPxGaqpQjEMuKLCGvH/sRI=; b=Q2+4PeiRSRH2bYQPFCNMDbQ0PS8ns36SndqN6SyXYGfATMtoFk7SP7TFuXkjVZ2mpvou2xJzDpMirlvWKzfs4/5Xv4QtKvVMAGougui2vsKZfhgCkCM9eCiyBup1xnldgAHrusY7wJFYu+a3nOKL3Is9S2cya2O5ikcl42ClkPo= 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 DB7PR04MB4443.eurprd04.prod.outlook.com (2603:10a6:5:32::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5038.14; Fri, 11 Mar 2022 07:52:27 +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.5061.022; Fri, 11 Mar 2022 07:52:27 +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 1/5] media: imx-jpeg: Refactor function mxc_jpeg_parse Date: Fri, 11 Mar 2022 15:51:43 +0800 Message-Id: <73ea0dba34b5bf02104517fce3f66ef2e6d96a16.1646983646.git.ming.qian@nxp.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: References: X-ClientProxiedBy: SGXP274CA0015.SGPP274.PROD.OUTLOOK.COM (2603:1096:4:b8::27) 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: 11317b55-abf6-4ba8-9740-08da0334166b X-MS-TrafficTypeDiagnostic: DB7PR04MB4443: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: eWIIn3dVgvz5oQ0aAQoCZcEJyS4KgMWIGx4WYIPRKhkUBRAJ5zifsQerjuaaix0BjMMN4m/UP91xIdR/1qFWh7fgYYWO5eGty7FDQRhPOsTXaWJUY3Kf7d1hnP+6f8mlEHzwMyL8fkds+4JjEhaZV6qKe+vfQH4xgFVtSmFHShHkISSliHBY9zocftSESdMFrdFwX1W5b099RAOrBAruSXk7JvdkoaCjFM+7MLBG+/7dnyl9qqEJEFhae/XwoZgA3J9DcAfqaZPTJFGPdAOodngeq+KDU/gp4Eslx6e6daK2txzGq9xmYeoxx3QZaT9nAfJAeVwesAv3OwZZn4E0BxRRmmHxq6X41vMRxC0l4PUT4IwKeCvalCUgIkQcaotu7gsZnbQNMErWkMrC7Xna4Jh6bxLn31/7JGXRKrnFVqIFFpWbvw1xj7Sp4vUKUoM6pMZnjZD4taWJeVlvUhyApFui4RwQsAHRxsQPLZn4OxJhSqyC79b1SNq/mVT9abEb+AHyQ04fLVezIfZL2pdkTqxr5o/Hucw8aLfzMb4dL7cxDAHY0DNf1KpkGq9RE0BmL+thG5pmB1TzykXBYXt+kRSfFe2gzNLTNjMaMruTdKNllRk8HJg1JJu9dSXWWap8WJtA0JF7vFnoeFjYCXnlOF2tlwrValN1EXgUQRdbj+la+67eaing5YVsAExjcnXqpB0bobWG8jXGCeSWm/MBAg== 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)(7416002)(8936002)(26005)(52116002)(44832011)(2906002)(8676002)(6486002)(2616005)(508600001)(86362001)(4326008)(186003)(66946007)(6512007)(6506007)(5660300002)(66556008)(38350700002)(6666004)(38100700002)(66476007)(316002)(83380400001)(36756003); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 0hiZ06YDnZHHvWPuVouM+ZobIAQ7MjSakku7dDO1p94aBd8NHPbO4IA2rbqngJ/qO2ZxAVllJfiEJvps+Y/TC7o9Bvu/qZm4pfdCBmHXdLIzxuV2kz9XBqc/0iq4Fx7PDbMw8QKuVdm21jsYcMvfSNxowLlEr8hfCkRZD3hrkRMrJtHj1tLQc8TYR8Qee8Io0j2TTnzQ7CVbby5Z/qS5hepG9YvVzH3/4HAMHomEVkyucW4woh1CDn9GUntJuWlD/PbS3cop9byCHvxQojPIShMQvnD+AHnTUO4Oohxw8rdDUHpWJnRRuON2Wh1Sr2wV3e52+AglBu2Q9MCQWrvcR6lL2zNnPebfHtDMy7Lf8pcCCU3SJTE/SB5gI7H3VU+DvQ0SV7ZTbFBX8NIBimlouQPGEAf+Ob/O7EbSTvfwOkEnaJRs/sNfOh6jGXlWLe+7X/BtuhTm8Cx8OWrlKhuc09rz3sImMUqoU3b2AmUBWDbVjtd2+cR1kSPMoXk/AaKYsnMPdx6741Mdy5CNzX6H46q6xoQNg6NK2De9NDntCj/rZY7+WQT/zgcd7LUmXwY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orOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 11317b55-abf6-4ba8-9740-08da0334166b X-MS-Exchange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2022 07:52:27.7710 (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: JId3ZNfD/y2qNkYRfh5r4cp+UJRWv3TQ+4Wfp1wAeNOOyurgL4daSrSG4FjZkPqV+kJ8+ht8R7W/zZjEPVblCQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220310_235232_953320_41D38088 X-CRM114-Status: GOOD ( 10.85 ) 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/imx-jpeg/mxc-jpeg.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c index 1de0400750aa..d8d24c19f423 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/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;