From patchwork Tue Jul 9 13:28:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Scally X-Patchwork-Id: 13728022 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 EB6E3C2BD09 for ; Tue, 9 Jul 2024 13:30:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=OEULdYyZXrGP0vkYGRXXm3pWzaXQ2x6YvQ1iI2i5UrE=; b=c+np/9hY0sHnyNDe4DAMKpEIWX 6j/aE1bdP+7t0AgpLSsKvE9A71mVy88xBlic4wJ3DdzdfckE2yVlV/pe6a8Ler8V8+bBtujp/n9eg IHuqfIdK0ydknEWYlci5RPi1bpHUZ62ziiW+aFkxeeVQL21ojArNV80460GQSLbLAs8LoZpszPSDq ILQS3n9ypETgeifzE3ue7N5S41hJiZDQDCH4IUPyRqfOsBoZZdOM8r/NKhM9yPeO6ZVaYIhFHCBwL w2buVGOkYEjeIul+b5HcENh52ymBBC0ttpIXk4MKkZUVYDbjw7hbO1CwbxX2uFHvkdW8rX2pAA5Bm wOMqEZqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRAuv-00000007Lgp-3kQe; Tue, 09 Jul 2024 13:30:01 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sRAuF-00000007LIg-26AK for linux-arm-kernel@lists.infradead.org; Tue, 09 Jul 2024 13:29:20 +0000 Received: from mail.ideasonboard.com (cpc141996-chfd3-2-0-cust928.12-3.cable.virginm.net [86.13.91.161]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 835A816C3; Tue, 9 Jul 2024 15:28:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1720531724; bh=mFsO24iG5YUpUaNSD2UNlN/Wjjn30XanUhAge6n4OLk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MqgSuIOLin6RcfsQCFDAAy8ebHsAbqA3fmvxgXTPzmaGL2J6H7e1cezgtfVuJk0jt 4XR1DfAdNgUDL47cuGlR4sCfcbQWalY6i/dQr0MRp6uKE3yOfJdom6Embg7xWCi53M h9KRBCOa5H6ihKvSMANmkglTvyjXEObMHssjfusc= From: Daniel Scally To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org Cc: jacopo.mondi@ideasonboard.com, nayden.kanchev@arm.com, robh+dt@kernel.org, mchehab@kernel.org, krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org, jerome.forissier@linaro.org, kieran.bingham@ideasonboard.com, laurent.pinchart@ideasonboard.com, sakari.ailus@iki.fi, Daniel Scally Subject: [PATCH v6 01/18] media: mc-entity: Record number of video devices in a pipeline Date: Tue, 9 Jul 2024 14:28:49 +0100 Message-Id: <20240709132906.3198927-2-dan.scally@ideasonboard.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240709132906.3198927-1-dan.scally@ideasonboard.com> References: <20240709132906.3198927-1-dan.scally@ideasonboard.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240709_062919_705370_D84E2D68 X-CRM114-Status: GOOD ( 12.87 ) 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 Record the number of video devices in a pipeline so that we can track in a central location how many need to be started before drivers must actually begin streaming. Signed-off-by: Daniel Scally --- Changes in v6: - New patch. This is intended to support Sakari's requirement for the driver not to start streaming before all of the video devices have called streamon(). This was the cleanest way I could think to acheive the goal, and lets us just check for start_count == required_count before streaming. drivers/media/mc/mc-entity.c | 5 +++++ include/media/media-entity.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 96dd0f6ccd0d..1e8186b13b55 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -596,6 +596,9 @@ static int media_pipeline_add_pad(struct media_pipeline *pipe, list_add_tail(&ppad->list, &pipe->pads); + if (pad->entity->obj_type == MEDIA_ENTITY_TYPE_VIDEO_DEVICE) + pipe->required_count++; + dev_dbg(pad->graph_obj.mdev->dev, "media pipeline: added pad '%s':%u\n", pad->entity->name, pad->index); @@ -713,6 +716,8 @@ static void media_pipeline_cleanup(struct media_pipeline *pipe) list_del(&ppad->list); kfree(ppad); } + + pipe->required_count = 0; } static int media_pipeline_populate(struct media_pipeline *pipe, diff --git a/include/media/media-entity.h b/include/media/media-entity.h index 0393b23129eb..ab84458b40dc 100644 --- a/include/media/media-entity.h +++ b/include/media/media-entity.h @@ -104,12 +104,14 @@ struct media_graph { * @mdev: The media device the pipeline is part of * @pads: List of media_pipeline_pad * @start_count: Media pipeline start - stop count + * @required_count: Number of starts required to be "running" */ struct media_pipeline { bool allocated; struct media_device *mdev; struct list_head pads; int start_count; + int required_count; }; /**