From patchwork Fri Sep 15 21:11:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sebastian Fricke X-Patchwork-Id: 13387708 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 B91A7CD37AA for ; Fri, 15 Sep 2023 21:12:28 +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:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bVMYD3nAolm11q7b+iY4C9UibhicIDPte4j3SFutbS8=; b=jpgYIAdBCW8KnZ CtyR0tKicDdgCeiynt6pFJnmpTL2ZGgVQ1iTiRwcC/BdUbiLAX6H1Su78pXYmRt8ooCAFeUNrd72w xkeEJ1xKt7O0hPnlpmNjJiPmRw8Ff0zuF3K2lIE6BxWEA+N5SsC3YIm+tBvOah6JzPBTQGuuarDoJ FIpE/zUVuqEX8H95Sr1ApDnJpBQbQXdtXSoFQ/6FbwXQJaRvYSjUTC26f3moKno1qRepI3VQb5zsu DF37ySfgvjZMvwhS9MuQa84JV2aN+n10Bmud5h9ZZe6OBTlESgcHxT/VGQKYED0gvKWq4oeUAGgca GheKcTADP+3PeZ58Qdkg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qhG6Y-00BPAs-37; Fri, 15 Sep 2023 21:11:58 +0000 Received: from madras.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e5ab]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qhG6V-00BP98-0v for linux-arm-kernel@lists.infradead.org; Fri, 15 Sep 2023 21:11:56 +0000 Received: from localhost (89-26-75-29.dyn.cablelink.at [89.26.75.29]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: sebastianfricke) by madras.collabora.co.uk (Postfix) with ESMTPSA id A149466072F6; Fri, 15 Sep 2023 22:11:52 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1694812312; bh=bfjXNTEUGOV/V9xi2T+58cboEq+YPmOFqHLsOLFZbPw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=BNrhrDp8xDg1sOY0ZzZSw0/z+hUHhX32F5Km6n2Q/2J8jTNIBATFr0RqgBYO3Kf5/ j/FQ88xSWFyYi637zcWtKz/0I7s0ibi8H/6yy+bEbX61pR5Q9FYmU0SsP73lTs0mAI zjDojvchHDN1c+t3vz3bZfP8VHHLsRtX99U/uRqrCLuZ1NaXy7EHnJAGZ9VYtAeDbt L6s1bF7aoN4N4Qqwmi02QbgIpAZb8RZ5M61mQ8NEPioykwX9jU7NJ6XXryitmfdzp8 BtfAjGoJgNUQog0/x/R3T8tqPziDTsA5MUK1qxZdiZIJAwRObvPN8Cppxh1MRLzBlf 7tUXYngQxluhQ== From: Sebastian Fricke Date: Fri, 15 Sep 2023 23:11:30 +0200 Subject: [PATCH v12 1/7] media: v4l2: Add ignore_streaming flag MIME-Version: 1.0 Message-Id: <20230915-wave5_v12_on_media_master-v12-1-92fc66cd685d@collabora.com> References: <20230915-wave5_v12_on_media_master-v12-0-92fc66cd685d@collabora.com> In-Reply-To: <20230915-wave5_v12_on_media_master-v12-0-92fc66cd685d@collabora.com> To: Mauro Carvalho Chehab , Nas Chung , Sascha Hauer , Fabio Estevam , Rob Herring , Shawn Guo , Philipp Zabel , Jackson Lee , Krzysztof Kozlowski , NXP Linux Team , Hans Verkuil , Conor Dooley , Pengutronix Kernel Team Cc: devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sebastian Fricke , Robert Beckett , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@collabora.com, Nicolas Dufresne X-Mailer: b4 0.11.1 X-Developer-Signature: v=1; a=ed25519-sha256; t=1694812307; l=2295; i=sebastian.fricke@collabora.com; s=linux-media; h=from:subject:message-id; bh=bfjXNTEUGOV/V9xi2T+58cboEq+YPmOFqHLsOLFZbPw=; b=VbAFE35JG3ToaRlhTlsQQfjMPC3TontsrKvcvUyDnHfCVp53Y08nftaFNUIlpaVT9Q2ZOn9XQpjG DO/9V4kyAbx025A/fEK2RLlocnBrmDQV2PBOE3EtYKX8h/TamVMl X-Developer-Key: i=sebastian.fricke@collabora.com; a=ed25519; pk=pYXedPwrTtErcj7ERYeo/IpTrpe4QbJuEzSB52fslBg= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230915_141155_469150_EE6A7175 X-CRM114-Status: GOOD ( 14.67 ) 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 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 sequence to ensure, that userspace prepares the CAPTURE queue correctly. 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. * * 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; +} + /** * v4l2_m2m_ctx_release() - release m2m context *