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: 12777574 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 787DBC4332F for ; Fri, 11 Mar 2022 07:52:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1347281AbiCKHxq (ORCPT ); Fri, 11 Mar 2022 02:53:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43144 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347275AbiCKHxn (ORCPT ); Fri, 11 Mar 2022 02:53:43 -0500 Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2087.outbound.protection.outlook.com [40.107.21.87]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 626FC95A1F; Thu, 10 Mar 2022 23:52:38 -0800 (PST) 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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Z39sBXu/U7v9SlkSbO4jhmp67d1R0ibpKrkGQbt02i58HlGJ15TmA6gkCPOvhkKfn7YOt8/3BhCZjdrCXa8XPqY8+qn4fZ6h9ieR/l2AyFdxLklY8L7H8mc1rGYOAz3VQaraN/xVkLl3osjqwhN4lYdrgpyJh53hp1Qk8PKz4OQyIGASeooA4wcs2WYWte5YP72QpRtX2TZR65NMG6QDbvaxolzgM/Un8kqmsgvkOzetwsfd5ngPNe9Bt1lNLrWkfqq23uLtVwiMx+u94O2DHYeBnIBfULQNfMECDdtSMDk2kETbgtbcfNuYzj2Z0VLXB/lM7gCj2WK40CmzGYI= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2600a90e-3dc0-4fac-a2b7-08da03341af4 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: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 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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,