From patchwork Fri Mar 11 07:51:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ming Qian X-Patchwork-Id: 12777581 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 5EB45C433FE for ; Fri, 11 Mar 2022 07:54:36 +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=GdfN4KlKeQufE/GHS7qVeipx39E/sZTdfHJjLh3IKQA=; b=FLAuNjB/LOUji8 UtJPGnYykTHUS1rGqA/0Bw5q5IyFl2Deqw6sUSycEAXNrus9OHTi8ACA00hZ7PeV700kQLg6L/L3a b0THrdeDmAefh67+Ym/7ZIUkuj+gIUWmX7a+p+QcvZdiZX76oRIjWiurnPk6OxDEAoDIP6lTiYI17 UHLZbT75SKwL/zlPkpza+HkHRQYkiiVv0G+s2CiMkXmhmoAxeSVB1LzwR5Dk5Jfe4AAgVTyrqB95x +V/Lo35xji1GU2X27nMk931GceZyQRfxCemHwjPx2zgjCNNjc6Uxm9iHRzwyuvhw0a5nN9tnZmyfx 4sTvnMlRolSM3fel/2/A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSa5G-00FOxZ-HI; Fri, 11 Mar 2022 07:53:10 +0000 Received: from mail-vi1eur05on20607.outbound.protection.outlook.com ([2a01:111:f400:7d00::607] helo=EUR05-VI1-obe.outbound.protection.outlook.com) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nSa4l-00FOj7-QD for linux-arm-kernel@lists.infradead.org; Fri, 11 Mar 2022 07:52:41 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AIxdjQBQAbN3xxV0zfYFqmMvZ/gGSqEYewMOm+z6fpUKKBawa9J/2PYM4p1cTqb4WdcTBqh00xQ8IFM5CHStVMX7a3Vtsjqi6d0hJf1FM5h6m/Y6+UrM6juF8hW3KfrvKWWw718zR87MjS1LvDHFL8p8PfxcO2si9FGOgzF18cShB4gfwCq1UClTbsfiDjZm8oXDtvUW9V5rPqMS7rZa9DimG0lWj51z49NwsJ5Srx7z1WIMu275Pc02RCPDM2iCdTketOlsdaEx2VQDnRHbaX8GkUs1bsuK/IotT4UjeE3AVTHZF+VwoSF+NbBVrzVhpfzdssMs+Gq8DNstRweAEA== 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=ku317mUSHruXe+eqtL9Jhx41SjsYYJOst5rCfUruQV0=; b=A1gQ9pXRv1NknBpJxT9iBbJC/41GuWiKJDQUcwzRky+kFTmA6xqa3/dmzI4UwJL5sMIGWDDkIDavjChGWPDlbvOYDoqVJ7yDS3ppUIw5r7oIE0/+zI1OZd6dkIs9qtoW6WXsvroWXOLZGrtowNHkKHdOadvTfpjpFM8H4EqUJ92lO+EfGeQRqG1LiaSh3u2Mc+eYV2SteLFSjgBcNPF7XFcowOtsiZ7PnKgMUaLMOztaWQwCmMumT9bNVWRtdjtOgVi5oNXZ8LW0RwCvJRy6mNEdU9Fjof2+SOL+7i0LDkedxpmNYCqLmjGcKosz8xOZ2eNaoR6xt84uLjLZkqDigQ== 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=ku317mUSHruXe+eqtL9Jhx41SjsYYJOst5rCfUruQV0=; b=ZHBwT+U5mdAlC+QCh2c9bXQNQEyd54tJp5TH57uHRVB05Rpcjfz082hviZzcSpImbsG+pHKkXhl2/a41saGE8n7/TZRHWE2ZrH2iA0A0HZFVX1ljIRbZ9UzURK+WYYJsfaOWwKEGnTEx8G2YWSS2e09NEtYUUL8w8aGh45H4644= 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:35 +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:35 +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 3/5] media: imx-jpeg: Propagate the output frame size to the capture side Date: Fri, 11 Mar 2022 15:51:45 +0800 Message-Id: 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: 2600a90e-3dc0-4fac-a2b7-08da03341af4 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: XvbHJyob2eZvcyOfJP8CpYjL2PMkQmVjclDec/TNye/LkbMocSLfNnGafv9Exn8jhAfccPYIvqevFW30nYr0xtyNYfl+oW1WRrvX/jPDxvpRlZcI3VG+pLrrwqh9JpESNvEpwJ8u3SbdkdAxQBC1IDrc4heLvm8Asf7lDI37Oiu+WiTsIf1N3pMmpDq7UQH5oxgo1/mY1UDJDC0n6e9pV3Ln4Vu90f8XfoU1wpQrEZbzPn/0MEtcvQEJwn1LV40HaE7r+g9wvQzpn3dlves0kM6raCom/Yi7dkcm91dhGl34pMTfeyWz82EWA7UJ4fpwn1+IOlln1RyE2D2rK5K5/SD5Woka3M2GovpAGg+v5511NehkHp0cLmanYrEJaYvaUJG3B+y1sXZxOAz0t1OWm/ccUHdJ9/yzylSfmo4Q859N1wOIp0a0xpywI3FwR1vfFR5zUxUjA1MpZnPisP6kqaGsdT7/5xF1BNfdv2THODXRFA6IjnQTWOF65D4iL1Z/tVxl/RKTvnDGccj4Jepny3gg5km3daZFOY9P/xRigsoCityGFvBPXDcQYpwEvDtC58aCAU3H/ALq5LF16FUpoMys4PXw4zzq9IZe0syEr0peksI4Ix2HKDM3u0GGSookkaYAtHVH8zc08OGDhdbau9ndfFQaYEXCz/ITnYSvxJni3SHHqQVhRfIp8hG1PAXFn0WVi5ufmCE0ROvANMGF9w== 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: Tet9QfBlwgEe111tKBeUvGQVe9YiZfOM0/n+ikhGogBnX2skkCk+RTxqpv0dJ0albz8WoJ4mANZAVU2MkAwPrTzlfePk6KH8igq2uQdSy+fxvDVM4lWo0N8dFWj62kL42Y5BYqxzHMVxvKoVHB+PBN1DOj+blW1KHTEE6XI6NGR5f/IDV/YQW6Y7NfDT1XYlKRoCXunMVdEWdsgi7hOqkALFqqX9+ZemqFZMDM3+cDw4FIjN3fJsoHr+NdUI0agzGXEqYTNQXg+G/c+wwRJpUUs1yneGy58taliZm+tdTSb1abkAy61iosQ6YRmXDc0CztKVz7U98WiRs+ZlHZrlGXKir6b7UK/bbiclUDmZU66xZWQb7fg+xzvjrRMJrBgBORnLg+YiFn3Z5+JUgduiSeVI3NCYOIqsu52iqhN6YdSrVCeqcOlnL9RpJf4g42EESmIinlg5ltUWYrI1Y5uEyPkB8hnFXWY+3OnHLQo2fOu4EuCd6g6gLYsl1V3AD7xj46U+zOhoVUbtjqMjFDH3ciPoqC4psyRZN0Iq2MOa/mHci1RZsMm0R5dXuvokrjvjbt3RsTOk+x11k/DAJBOK1R3f5hAys8cne1MInEN+vdAzRCO6QpA3S6EBZVdB7hj82ediWj9lRkHI9IOf6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ange-CrossTenant-AuthSource: AM6PR04MB6341.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2022 07:52:35.5519 (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: MSbYlqDjIRxRI6Atgzm1+CvTu6qPT4vLY4Gs2+q96KIVcHoBmEk5ylAVyPiAczWwKo+zdaU4THv4RSrBeCgoDA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB7PR04MB4443 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220310_235239_893276_B8EA131E X-CRM114-Status: GOOD ( 11.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 The GStreamer v4l2videodec only ever calls S_FMT on the output side and then expects G_FMT on the capture side to return a valid format. Signed-off-by: Ming Qian --- drivers/media/platform/imx-jpeg/mxc-jpeg.c | 25 +++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/imx-jpeg/mxc-jpeg.c index 82b9b4630d9c..9e8a4157ce2f 100644 --- a/drivers/media/platform/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/imx-jpeg/mxc-jpeg.c @@ -1831,12 +1831,35 @@ static int mxc_jpeg_s_fmt_vid_out(struct file *file, void *priv, struct v4l2_format *f) { int ret; + struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv); + struct vb2_queue *dst_vq; + struct mxc_jpeg_q_data *q_data_cap; + enum v4l2_buf_type cap_type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; + struct v4l2_format fc; ret = mxc_jpeg_try_fmt_vid_out(file, priv, f); if (ret) return ret; - return mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f); + ret = mxc_jpeg_s_fmt(mxc_jpeg_fh_to_ctx(priv), f); + if (ret) + return ret; + + dst_vq = v4l2_m2m_get_vq(ctx->fh.m2m_ctx, cap_type); + if (!dst_vq) + return -EINVAL; + + if (vb2_is_busy(dst_vq)) + return 0; + + q_data_cap = mxc_jpeg_get_q_data(ctx, cap_type); + memset(&fc, 0, sizeof(fc)); + fc.type = cap_type; + fc.fmt.pix_mp.pixelformat = q_data_cap->fmt->fourcc; + fc.fmt.pix_mp.width = f->fmt.pix_mp.width; + fc.fmt.pix_mp.height = f->fmt.pix_mp.height; + + return mxc_jpeg_s_fmt_vid_cap(file, priv, &fc); } static int mxc_jpeg_g_fmt_vid(struct file *file, void *priv,