Message ID | 20221123092427.76055-1-randy.li@synaptics.com (mailing list archive) |
---|---|
State | Superseded |
Delegated to: | Hans Verkuil |
Headers |
Received: from vger.kernel.org ([23.128.96.18]) by www.linuxtv.org with esmtp (Exim 4.92) (envelope-from <linux-media-owner@vger.kernel.org>) id 1oxm1V-009Zts-I6; Wed, 23 Nov 2022 09:26:33 +0000 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237561AbiKWJ0U (ORCPT <rfc822;mkrufky@linuxtv.org> + 1 other); Wed, 23 Nov 2022 04:26:20 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44098 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237586AbiKWJZ7 (ORCPT <rfc822;linux-media@vger.kernel.org>); Wed, 23 Nov 2022 04:25:59 -0500 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2086.outbound.protection.outlook.com [40.107.237.86]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2548B898DA; Wed, 23 Nov 2022 01:24:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=m/Lbl118m+mOI3j5DSus5nNhCwdktKX2qvlsOeF4rb3RqFXUWeu9/Y9WuudnXNF6Tj2CEFKnVXXq/LAm691iIg1GN6gZOB46ow3gVXeRf3okmbmWAYH8IFYRJOzdeNEbA9C8lWR4AiGSAUHVfyqB3/mPYiPKde45bECkjU4njHIF873oVGGfxb16Ln0R5+O1i+IcRtjuL0yD/Ote7OAziaTISLNLCJL2fPXKljbjPTxVqO1H8XJyZ4504tg6iK6EymFVFB8EE8xvsgVGHPOqmaj/vDTI/1IXA5Uw8F4zvisAjDMXeHZc7Hh+vJffRCa2Zj0gMoNtOkNdy0K5G2vGoQ== 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=aR/ZziWtBZWDpsvMQCxlA9Pjokn8pzrRCD7G1BTIAP4=; b=XBFRwe+hBsFaWx5iHk66yrlX0nxkJr/Ie/VMCOaMw1yPXT11/NeorRUO36CvrPBCi69mMjvnRycS9XAOhC4UycTJb0WQJ7ke3YzFvbUSaPkLCKMH9BFhfyMIuBqhE3cd8SQIUyYBtnjyCcfsDg67FD/eNRkDftplzEiNdwvT2vpGnnstUvi6kWrorwRdPUtl+KBTZjRzX3cfvxe0VcgShTci6QFBcr5ebSOQg5wiBGZU+CbD7uU239nLE2D6JFM606RFq9dABR+hqP2u61sNGisZpvJSbpVwojgUXnyyq62XZwao5BktrS68XyAPIWEMoLhM8pcDRIf1fRBViJ2e9Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=synaptics.com; dmarc=pass action=none header.from=synaptics.com; dkim=pass header.d=synaptics.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Synaptics.onmicrosoft.com; s=selector2-Synaptics-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=aR/ZziWtBZWDpsvMQCxlA9Pjokn8pzrRCD7G1BTIAP4=; b=XoTG+EbNnYGqeUIjs6Ki9JCti4QmUZIfmMM28nBlA9a02KYdxaa0kF53Lcnsg4fH9FGBW6zSMJl3QrQ9+xTIPa28V4TYiSJ09XMCvCMA1QeEtTKtW0JUwbAyPlznYj3JQdN54Iw5Ybcp7lAjPXVUy2INsaOCpqOJdhtVgqp7DGo= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=synaptics.com; Received: from DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) by SJ2PR03MB7041.namprd03.prod.outlook.com (2603:10b6:a03:4f9::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5834.11; Wed, 23 Nov 2022 09:24:49 +0000 Received: from DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::a132:66d9:ed0f:e5c1]) by DM6PR03MB5196.namprd03.prod.outlook.com ([fe80::a132:66d9:ed0f:e5c1%6]) with mapi id 15.20.5834.015; Wed, 23 Nov 2022 09:24:49 +0000 From: Hsia-Jun Li <randy.li@synaptics.com> To: linux-media@vger.kernel.org Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl, sebastian.fricke@collabora.com, kieran.bingham+renesas@ideasonboard.com, laurent.pinchart@ideasonboard.com, ming.qian@nxp.com, nicolas.dufresne@collabora.com, wenst@chromium.org, linux-kernel@vger.kernel.org, Randy Li <ayaka@soulik.info> Subject: [PATCH] media: v4l2-mem2mem: allow device run without buf Date: Wed, 23 Nov 2022 17:24:27 +0800 Message-Id: <20221123092427.76055-1-randy.li@synaptics.com> X-Mailer: git-send-email 2.37.3 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: BYAPR06CA0047.namprd06.prod.outlook.com (2603:10b6:a03:14b::24) To DM6PR03MB5196.namprd03.prod.outlook.com (2603:10b6:5:24a::19) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DM6PR03MB5196:EE_|SJ2PR03MB7041:EE_ X-MS-Office365-Filtering-Correlation-Id: 8e86fac5-5d9a-45b2-4555-08dacd34912c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 1VFrv2z6N6YCnLFST++5KfqS+olOwvvj/HUVboivWf9UGIUFE3iIuKvw61yGB/MVDMb0ip5d0NwrBiC7LrhXQvbYicyZBieKI05wycTS5yIsxRMa0nIdqmP7xeDFpVEnh8l00QYlt+vgfa8pW1MpNTYofKePbg+ojskp3jKS1xC7Ji+ZfEaKgIs27Z/7G+B0iq6XYgDNCf+Gxv0rqf9rPCPVjKObu9LKF0MDaencnopWz3AjoUb9E6V1qn6CK3Nb62H1B1OW+bL6YdsXgbOto4zlGyMJi8ZDviGTaJS06pTczHTZZgA0n99XZtDOATpuCsRFR7crki2fgRsaZr9+8S7ylljqY+vqw5MoclcBktfMMNe7q24BZXwI6QJjgbpEZ7sk44FhxXfM78Cg+x5yclcv1ZM2oGxv7GzRGws1VI1YxJR+aZJQqediON5OpcsQkXmhN7dnO5jVqR0NbfIQz3qyHroJ4s1H5xscnXsZ1WM704UPmsVyRgQX9kBHokPOxg/8C63bbYRT2Fa8x3XabxzUIu7PREDZJuKPjApEA9jfOq8DBdzH5KjUGNSLxEr5znSPGgdw6B1RX8AWtJKBGZUO8yCOVRAyR/SXLqwpOOdZJs02wtt78FfffVaflsFl4iJFnQxu2hkMUdG5atlcUwtbPACgEwPnhkb+Ysv3hv9mmkXWB9HsnVo+cr1v6JgRFoTuiaRy5EhujfHfSvJh4A== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DM6PR03MB5196.namprd03.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230022)(39860400002)(346002)(376002)(136003)(396003)(366004)(451199015)(2616005)(186003)(6486002)(52116002)(6666004)(6506007)(6512007)(26005)(36756003)(2906002)(1076003)(38100700002)(38350700002)(86362001)(478600001)(83380400001)(8936002)(7416002)(41300700001)(8676002)(66556008)(66476007)(66946007)(6916009)(4326008)(316002)(5660300002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d7RVLPMjBLt3VlyT0DXTqSF/y8ETmzN40xb+dARW6D+bvhhjOJJ4ipr+ngL1+oD+sDauVLS8bdJEs4KlAa8MyyEitd107od56Iz1OgasjC2Jax2fvM/dtTdO+grHUgJP6tU+508H9ok+H9g+/rghWYkmMMOw3F6m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hZ4TD2GVQ6NUqOQpT/9u5t+hBMFzIKvn1+W5SriqqeXWC/OhbPk1VcsFT9LPMXGU57fTVI29ZlLSjh9QFTLa/dmOlyxjhLK+4W2LmfVIjuv4ZPlXbjetmRiecxwdL7JGQV4tM7L7qanOwYFm+t0TsL4UIDJlevZTRY1ufd7s21woYocyPcGJtzCfqwX7L/MJNWjaHiNZjLYRFym4ZTXef4h4KDKk3HN5SLR6YpGAyVm7qU8SlTPsoVCPzwz2L6HY2H6GTITZkgpeKjadTrmi0WDpVBt+c1uRMPkEDtisvbl3HFtfY+FmCQ+GSByJHZk5GKq1nURpstGd9PXcQls9Gwf1pTPGWoPFtoeFv+GBgna9HXFZ X-OriginatorOrg: synaptics.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8e86fac5-5d9a-45b2-4555-08dacd34912c X-MS-Exchange-CrossTenant-AuthSource: DM6PR03MB5196.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Nov 2022 09:24:49.0498 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 335d1fbc-2124-4173-9863-17e7051a2a0e X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KLJZNrUZbsIe61lBX3d417RwuCVA2ygdGqquYuEur/FUn6v19feeZythaW3qwY1YQCN8JHCz5pJrjXWa2hMPCw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR03MB7041 X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-media.vger.kernel.org> X-Mailing-List: linux-media@vger.kernel.org X-LSpam-Score: -2.4 (--) X-LSpam-Report: No, score=-2.4 required=5.0 tests=BAYES_00=-1.9,DKIMWL_WL_MED=0.001,DKIM_SIGNED=0.1,DKIM_VALID=-0.1,HEADER_FROM_DIFFERENT_DOMAINS=0.5,MAILING_LIST_MULTI=-1 autolearn=ham autolearn_force=no |
Series |
media: v4l2-mem2mem: allow device run without buf
|
|
Commit Message
Hsia-Jun Li
Nov. 23, 2022, 9:24 a.m. UTC
From: Randy Li <ayaka@soulik.info> For the decoder supports Dynamic Resolution Change, we don't need to allocate any CAPTURE or graphics buffer for them at inital CAPTURE setup step. We need to make the device run or we can't get those metadata. Signed-off-by: Randy Li <ayaka@soulik.info> --- drivers/media/v4l2-core/v4l2-mem2mem.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
Comments
Le mercredi 23 novembre 2022 à 17:24 +0800, Hsia-Jun Li a écrit : > From: Randy Li <ayaka@soulik.info> > > For the decoder supports Dynamic Resolution Change, > we don't need to allocate any CAPTURE or graphics buffer > for them at inital CAPTURE setup step. > > We need to make the device run or we can't get those > metadata. Nack: This is not how it works. I know the m2m framework make it difficult, but it is expected that the driver have a special state for OUTPUT streamon (before capture streamon). Please have a look at other drivers. Nicolas > > Signed-off-by: Randy Li <ayaka@soulik.info> > --- > drivers/media/v4l2-core/v4l2-mem2mem.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c > index be7fde1ed3ea..cd56d60fad9d 100644 > --- a/drivers/media/v4l2-core/v4l2-mem2mem.c > +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c > @@ -301,8 +301,9 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, > > dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); > > - if (!m2m_ctx->out_q_ctx.q.streaming > - || !m2m_ctx->cap_q_ctx.q.streaming) { > + if (!(m2m_ctx->out_q_ctx.q.streaming || m2m_ctx->out_q_ctx.buffered) > + || !(m2m_ctx->cap_q_ctx.q.streaming > + || m2m_ctx->cap_q_ctx.buffered)) { > dprintk("Streaming needs to be on for both queues\n"); > return; > }
> On Nov 25, 2022, at 9:43 PM, Nicolas Dufresne <nicolas.dufresne@collabora.com> wrote: > > CAUTION: Email originated externally, do not click links or open attachments unless you recognize the sender and know the content is safe. > > >> Le mercredi 23 novembre 2022 à 17:24 +0800, Hsia-Jun Li a écrit : >> From: Randy Li <ayaka@soulik.info> >> >> For the decoder supports Dynamic Resolution Change, >> we don't need to allocate any CAPTURE or graphics buffer >> for them at inital CAPTURE setup step. >> >> We need to make the device run or we can't get those >> metadata. > > Nack: This is not how it works. I know the m2m framework make it difficult, but > it is expected that the driver have a special state for OUTPUT streamon (before > capture streamon). Please have a look at other drivers. > I have some good reasons here that make dynamic resolution should happen in the device_run(). 1. If the CAPTURE is STREAMON, when the resolution changed event should be triggered? Of course it would be in device_run(), there is no reason to make an special case here. The following reasons may be better applied for encrypted(DRM) video, when no normal video stream parser could be invoked. We don’t know whether the user input contains valid sequence header, would the sequence header applied to the current frame? Beside the metadata we need may not at the beginning of the buffer. 2. If it would cost lots of device time on parsing it, it even may even need to read more than one OUTPUT buffers, we would be better to fix this into the normal schedule procedure. Or it would block the other running contexts(instances) 3. We need extra methods to wait the other context done their work which breaks the original job queue. buffered flag is a perfect way to fix these problems, I didn’t see any m2m driver uses them. > Nicolas >> >> Signed-off-by: Randy Li <ayaka@soulik.info> >> --- >> drivers/media/v4l2-core/v4l2-mem2mem.c | 5 +++-- >> 1 file changed, 3 insertions(+), 2 deletions(-) >> >> diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c >> index be7fde1ed3ea..cd56d60fad9d 100644 >> --- a/drivers/media/v4l2-core/v4l2-mem2mem.c >> +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c >> @@ -301,8 +301,9 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, >> >> dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); >> >> - if (!m2m_ctx->out_q_ctx.q.streaming >> - || !m2m_ctx->cap_q_ctx.q.streaming) { >> + if (!(m2m_ctx->out_q_ctx.q.streaming || m2m_ctx->out_q_ctx.buffered) >> + || !(m2m_ctx->cap_q_ctx.q.streaming >> + || m2m_ctx->cap_q_ctx.buffered)) { >> dprintk("Streaming needs to be on for both queues\n"); >> return; >> } >
diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index be7fde1ed3ea..cd56d60fad9d 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -301,8 +301,9 @@ static void __v4l2_m2m_try_queue(struct v4l2_m2m_dev *m2m_dev, dprintk("Trying to schedule a job for m2m_ctx: %p\n", m2m_ctx); - if (!m2m_ctx->out_q_ctx.q.streaming - || !m2m_ctx->cap_q_ctx.q.streaming) { + if (!(m2m_ctx->out_q_ctx.q.streaming || m2m_ctx->out_q_ctx.buffered) + || !(m2m_ctx->cap_q_ctx.q.streaming + || m2m_ctx->cap_q_ctx.buffered)) { dprintk("Streaming needs to be on for both queues\n"); return; }