devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Daniel Scally <dan.scally@ideasonboard.com>
Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	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,
	sakari.ailus@iki.fi
Subject: Re: [PATCH v6 01/18] media: mc-entity: Record number of video devices in a pipeline
Date: Tue, 30 Jul 2024 18:09:15 +0300	[thread overview]
Message-ID: <20240730150915.GA8146@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20240709132906.3198927-2-dan.scally@ideasonboard.com>

Hi Dan,

Thank you for the patch.

On Tue, Jul 09, 2024 at 02:28:49PM +0100, Daniel Scally wrote:
> 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 <dan.scally@ideasonboard.com>
> ---
> 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.

This violates the abstraction layers a bit, the MC code isn't supposed
to handle video devices like that.

What you can instead do is to use media_pipeline_for_each_entity() in
your driver when starting the pipeline to iterate over all entities, and
count the video devices there.

> 
>  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;
>  };
>  
>  /**

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2024-07-30 15:09 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-09 13:28 [PATCH v6 00/18] Add Arm Mali-C55 Image Signal Processor Driver Daniel Scally
2024-07-09 13:28 ` [PATCH v6 01/18] media: mc-entity: Record number of video devices in a pipeline Daniel Scally
2024-07-30 15:09   ` Laurent Pinchart [this message]
2024-07-30 15:18     ` Dan Scally
2024-07-09 13:28 ` [PATCH v6 02/18] media: uapi: Add MEDIA_BUS_FMT_RGB202020_1X60 format code Daniel Scally
2024-07-09 13:28 ` [PATCH v6 03/18] media: uapi: Add 20-bit bayer formats Daniel Scally
2024-07-22 22:13   ` Laurent Pinchart
2024-07-09 13:28 ` [PATCH v6 04/18] media: v4l2-common: Add RAW16 format info Daniel Scally
2024-07-09 13:28 ` [PATCH v6 05/18] media: v4l2-common: Add RAW14 " Daniel Scally
2024-07-22 22:14   ` Laurent Pinchart
2024-07-09 13:28 ` [PATCH v6 06/18] dt-bindings: media: Add bindings for ARM mali-c55 Daniel Scally
2024-07-09 13:28 ` [PATCH v6 07/18] media: mali-c55: Add Mali-C55 ISP driver Daniel Scally
2024-07-30 21:23   ` Laurent Pinchart
2024-08-13 15:20     ` Dan Scally
2024-07-09 13:28 ` [PATCH v6 08/18] media: Documentation: Add Mali-C55 ISP Documentation Daniel Scally
2024-07-30 15:15   ` Laurent Pinchart
2024-07-09 13:28 ` [PATCH v6 09/18] MAINTAINERS: Add entry for mali-c55 driver Daniel Scally
2024-07-09 13:28 ` [PATCH v6 10/18] media: Add MALI_C55_3A_STATS meta format Daniel Scally
2024-07-09 13:28 ` [PATCH v6 11/18] media: uapi: Add 3a stats buffer for mali-c55 Daniel Scally
2024-07-09 13:29 ` [PATCH v6 12/18] media: platform: Add mali-c55 3a stats devnode Daniel Scally
2024-07-22 14:50   ` Laurent Pinchart
2024-07-22 22:55     ` Laurent Pinchart
2024-08-13 13:13       ` Dan Scally
2024-08-25 20:20         ` Laurent Pinchart
2024-07-29 10:53     ` Dan Scally
2024-08-13 13:51     ` Dan Scally
2024-07-09 13:29 ` [PATCH v6 13/18] media: platform: Fill stats buffer on ISP_START Daniel Scally
2024-07-30 21:46   ` Laurent Pinchart
2024-07-09 13:29 ` [PATCH v6 14/18] Documentation: mali-c55: Add Statistics documentation Daniel Scally
2024-07-09 13:29 ` [PATCH v6 15/18] media: mali-c55: Add image formats for Mali-C55 parameters buffer Daniel Scally
2024-07-09 13:29 ` [PATCH v6 16/18] media: uapi: Add parameters structs to mali-c55-config.h Daniel Scally
2024-07-22 23:48   ` Laurent Pinchart
2024-07-29 10:51     ` Dan Scally
2024-07-29 11:03       ` Laurent Pinchart
2024-07-09 13:29 ` [PATCH v6 17/18] media: platform: Add mali-c55 parameters video node Daniel Scally
2024-07-30 22:16   ` Laurent Pinchart
2024-07-31  6:53     ` Jacopo Mondi
2024-07-31  7:02       ` Laurent Pinchart
2024-07-31 15:12     ` Dan Scally
2024-08-02 15:03       ` Laurent Pinchart
2024-07-09 13:29 ` [PATCH v6 18/18] Documentation: mali-c55: Document the mali-c55 parameter setting Daniel Scally

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240730150915.GA8146@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=conor+dt@kernel.org \
    --cc=dan.scally@ideasonboard.com \
    --cc=devicetree@vger.kernel.org \
    --cc=jacopo.mondi@ideasonboard.com \
    --cc=jerome.forissier@linaro.org \
    --cc=kieran.bingham@ideasonboard.com \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=nayden.kanchev@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=sakari.ailus@iki.fi \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).