Received: by 2002:a05:7412:37c9:b0:e2:908c:2ebd with SMTP id jz9csp1315166rdb; Wed, 20 Sep 2023 06:04:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGx5m0gKVur3dZWouL8VUmwzLQQTVVB3qXk76TXrBONsN0njX1JrzDOfhB1X04nPaL4ozfT X-Received: by 2002:a17:902:cec4:b0:1b9:e9b2:124b with SMTP id d4-20020a170902cec400b001b9e9b2124bmr2423369plg.64.1695215093573; Wed, 20 Sep 2023 06:04:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695215093; cv=none; d=google.com; s=arc-20160816; b=FLQNqwxTG/ldF7b4ZuBOJbPMLKlEpEr8GPzR6630gOEDYbinSFJSgq1OwJKa5XTTfO GnxRM4JSf6Ykb6KPCfLipLQ/iBe52K3He7z7tIEO/t+MjbdiX8SyLAuQG5y/b8Q9l1F9 6NF5Fk8Cc+bDIm9L33GPrPmHeTQtQ0N0a+j9AgNmOT7ejD8NSUKzYuwO2yMRJ/ew0xAL 3PGXd3gJLDY5TBHt6npiwJiE1FByH3frc1cQZDD5V3K4i4I/U6vTS2ZhxRpQqwIs+yU6 zuHSew2UNXypw3qfpx6KK4kuyq753z+/7vjEbSZc0e3DP3hYQaUxVNOYfDOnfEeeir1a VJtw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:autocrypt :from:references:cc:to:content-language:subject:user-agent :mime-version:date:message-id; bh=MdsZBBR16tU415heSGnbjFZkbeKwNBSFEf/qP45Sqys=; fh=t/Le1SCKL9lVypDnzFBAj1aetb9gT0PgLEtCFMGNm7U=; b=KlON4v0+5BrgNdLQU+AMHmzFpgNReJ7MIf8Beokaany5Ta33Y6VxGUTcOuwP4t9jjO QxnzF7u3TwTEpTK902w3aFrAxXp8RcciPWt6+MMkHhoEjyt1WgJG9GuPL7+ImIWY59HK s9PTIZ/Ej+r5mUc8thb12s4ULMbBUCjAsiKZ9WbKsX2IjU6862Uy4mRFk0aVT3olYrhm l8C88BkTjsfvpG1JjcIiZtMHUbROv16IayoKRVIv0axcpETT4V7vcJKiRSnvN0kll7TH FznBZxB/47dY8IsZTHDLXH5sLWeH/o71sn/ATWWppCWiOprnuJT+bSH2LYZB21AgtvCX nbWg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id o7-20020a170902d4c700b001c386f8dd0asi7777246plg.179.2023.09.20.06.04.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Sep 2023 06:04:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=xs4all.nl Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A464A82F917D; Wed, 20 Sep 2023 05:59:36 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236327AbjITM7X (ORCPT + 99 others); Wed, 20 Sep 2023 08:59:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236324AbjITM7V (ORCPT ); Wed, 20 Sep 2023 08:59:21 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4946D129; Wed, 20 Sep 2023 05:59:11 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E2A9C433C9; Wed, 20 Sep 2023 12:59:06 +0000 (UTC) Message-ID: Date: Wed, 20 Sep 2023 14:59:05 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v12 1/7] media: v4l2: Add ignore_streaming flag Content-Language: en-US, nl To: Sebastian Fricke , Mauro Carvalho Chehab , Nas Chung , Sascha Hauer , Fabio Estevam , Rob Herring , Shawn Guo , Philipp Zabel , Jackson Lee , Krzysztof Kozlowski , NXP Linux Team , Conor Dooley , Pengutronix Kernel Team Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Robert Beckett , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Nicolas Dufresne References: <20230915-wave5_v12_on_media_master-v12-0-92fc66cd685d@collabora.com> <20230915-wave5_v12_on_media_master-v12-1-92fc66cd685d@collabora.com> From: Hans Verkuil Autocrypt: addr=hverkuil@xs4all.nl; keydata= xsFNBFQ84W0BEAC7EF1iL4s3tY8cRTVkJT/297h0Hz0ypA+ByVM4CdU9sN6ua/YoFlr9k0K4 BFUlg7JzJoUuRbKxkYb8mmqOe722j7N3HO8+ofnio5cAP5W0WwDpM0kM84BeHU0aPSTsWiGR yw55SOK2JBSq7hueotWLfJLobMWhQii0Zd83hGT9SIt9uHaHjgwmtTH7MSTIiaY6N14nw2Ud C6Uykc1va0Wqqc2ov5ihgk/2k2SKa02ookQI3e79laOrbZl5BOXNKR9LguuOZdX4XYR3Zi6/ BsJ7pVCK9xkiVf8svlEl94IHb+sa1KrlgGv3fn5xgzDw8Z222TfFceDL/2EzUyTdWc4GaPMC E/c1B4UOle6ZHg02+I8tZicjzj5+yffv1lB5A1btG+AmoZrgf0X2O1B96fqgHx8w9PIpV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S+QZerZp3PY27XgtPxRxYj AmFUeF486PHx/2Yi4u1rQpIpC5inPxIgR1+ZFvQrAV36SvLFfuMhyCAxV6WBlQc85ArOiQZB Wm7L0repwr7zEJFEkdy8C81WRhMdPvHkAIh3RoY1SGcdB7rB3wCzfYkAuCBqaF7Zgfw8xkad KEiQTexRbM1sc/I8ACpla3N26SfQwrfg6V7TIoweP0RwDrcf5PVvwSWsRQp2LxFCkwnCXOra gYmkrmv0duG1FStpY+IIQn1TOkuXrciTVfZY1cZD0aVxwlxXBnUNZZNslldvXFtndxR0SFat sflovhDxKyhFwXOP0Rv8H378/+14TaykknRBIKEc0+lcr+EMOSUR5eg4aURb8Gc3Uc7fgQ6q UssTXzHPyj1hAyDpfu8DzAwlh4kKFTodxSsKAjI45SLjadSc94/5Gy8645Y1KgBzBPTH7Q== In-Reply-To: <20230915-wave5_v12_on_media_master-v12-1-92fc66cd685d@collabora.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Wed, 20 Sep 2023 05:59:37 -0700 (PDT) On 15/09/2023 23:11, Sebastian Fricke wrote: > Add a new flag to the `struct v4l2_m2m_dev` to toggle whether a queue > must be streaming in order to allow queuing jobs to the ready queue. > Currently, both queues (CAPTURE & OUTPUT) must be streaming in order to > allow adding new jobs. This behavior limits the usability of M2M for > some drivers, as these have to be able, to perform analysis of the able, to -> able to > sequence to ensure, that userspace prepares the CAPTURE queue correctly. ensure, that -> ensure that > > Signed-off-by: Sebastian Fricke > Signed-off-by: Nicolas Dufresne > --- > include/media/v4l2-mem2mem.h | 17 +++++++++++++++++ > 1 file changed, 17 insertions(+) > > diff --git a/include/media/v4l2-mem2mem.h b/include/media/v4l2-mem2mem.h > index d6c8eb2b5201..97a48e61e358 100644 > --- a/include/media/v4l2-mem2mem.h > +++ b/include/media/v4l2-mem2mem.h > @@ -57,6 +57,16 @@ struct v4l2_m2m_dev; > * @rdy_spinlock: spin lock to protect the struct usage > * @num_rdy: number of buffers ready to be processed > * @buffered: is the queue buffered? > + * @ignore_streaming: Dictates whether the queue must be streaming for a job to > + * be queued. > + * This is useful, for example, when the driver requires to > + * initialize the sequence with a firmware, where only a > + * queued OUTPUT queue buffer and STREAMON on the OUTPUT > + * queue is required to perform the anlysis of the bitstream > + * header. > + * This means the driver is responsible for implementing the > + * job_ready callback correctly to make sure that requirements > + * for actual decoding are met. This is a bad description and field name. Basically what this field does is that, if true, the streaming state of the capture queue is ignored. So just call it that: ignore_cap_streaming. And explain that, if true, job_ready() will be called even if the capture queue is not streaming, and that that can be used to allow hardware to analyze the bitstream header that arrives on the OUTPUT queue. Also, doesn't this field belong to struct v4l2_m2m_ctx? It makes no sense for the output queue, this is really a configuration for the m2m context as a whole. > * > * Queue for buffers ready to be processed as soon as this > * instance receives access to the device. > @@ -69,6 +79,7 @@ struct v4l2_m2m_queue_ctx { > spinlock_t rdy_spinlock; > u8 num_rdy; > bool buffered; > + bool ignore_streaming; > }; > > /** > @@ -564,6 +575,12 @@ static inline void v4l2_m2m_set_dst_buffered(struct v4l2_m2m_ctx *m2m_ctx, > m2m_ctx->cap_q_ctx.buffered = buffered; > } > > +static inline void v4l2_m2m_set_dst_ignore_streaming(struct v4l2_m2m_ctx *m2m_ctx, > + bool ignore_streaming) > +{ > + m2m_ctx->cap_q_ctx.ignore_streaming = ignore_streaming; > +} > + I think this is overkill, esp. when the field is moved to m2m_ctx. Just clearly document that drivers can set this. Regards, Hans > /** > * v4l2_m2m_ctx_release() - release m2m context > * >