linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: linux-media@vger.kernel.org, dacohen@gmail.com, snjw23@gmail.com,
	andriy.shevchenko@linux.intel.com, t.stanislaws@samsung.com,
	tuukkat76@gmail.com, k.debski@samsung.com, riverful@gmail.com,
	hverkuil@xs4all.nl, teturtia@gmail.com,
	pradeep.sawlani@gmail.com
Subject: Re: [PATCH v5.1 25/35] omap3isp: Collect entities that are part of the pipeline
Date: Thu, 08 Mar 2012 00:50:38 +0100	[thread overview]
Message-ID: <1912567.UNqMTnFDpO@avalon> (raw)
In-Reply-To: <1331140976-5087-1-git-send-email-sakari.ailus@iki.fi>

Hi Sakari,

Thanks for the patch.

On Wednesday 07 March 2012 19:22:56 Sakari Ailus wrote:
> Collect entities which are part of the pipeline into a single bit mask.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
>  drivers/media/video/omap3isp/ispvideo.c |   48
> ++++++++++++++++--------------- drivers/media/video/omap3isp/ispvideo.h |  
>  2 +
>  2 files changed, 27 insertions(+), 23 deletions(-)
> 
> diff --git a/drivers/media/video/omap3isp/ispvideo.c
> b/drivers/media/video/omap3isp/ispvideo.c index d34f690..7411076 100644
> --- a/drivers/media/video/omap3isp/ispvideo.c
> +++ b/drivers/media/video/omap3isp/ispvideo.c
> @@ -255,8 +255,9 @@ isp_video_remote_subdev(struct isp_video *video, u32
> *pad) }
> 
>  /* Return a pointer to the ISP video instance at the far end of the
> pipeline. */ -static struct isp_video *
> -isp_video_far_end(struct isp_video *video)
> +static int isp_video_get_graph_data(struct isp_video *video,
> +				    struct isp_pipeline *pipe,
> +				    enum isp_pipeline_state *state)
>  {
>  	struct media_entity_graph graph;
>  	struct media_entity *entity = &video->video.entity;
> @@ -267,6 +268,8 @@ isp_video_far_end(struct isp_video *video)
>  	media_entity_graph_walk_start(&graph, entity);
> 
>  	while ((entity = media_entity_graph_walk_next(&graph))) {
> +		pipe->entities |= 1 << entity->id;
> +
>  		if (entity == &video->video.entity)
>  			continue;
> 

The loop will stop as soon as it find a video node at the other end of the 
pipeline. As media_entity_graph_walk_next() doesn't guarantee any graph search 
order, you should avoid stopping the loop before having walked all entities, 
otherwise you could miss some.

Something like

        while ((entity = media_entity_graph_walk_next(&graph))) {
                struct isp_video *node;

                pipe->entities |= 1 << entity->id;

                if (entity == &video->video.entity)
                        continue;

                if (media_entity_type(entity) != MEDIA_ENT_T_DEVNODE)
                        continue;

                node = to_isp_video(media_entity_to_video_device(entity));
                if (node->type != video->type)
                        far_end = node;
        }

should do (feel free to rename node to something else, I have little 
imagination so late at night).

> @@ -281,7 +284,21 @@ isp_video_far_end(struct isp_video *video)
>  	}
> 
>  	mutex_unlock(&mdev->graph_mutex);
> -	return far_end;
> +
> +	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
> +		*state = ISP_PIPELINE_STREAM_OUTPUT | ISP_PIPELINE_IDLE_OUTPUT;
> +		pipe->input = far_end;
> +		pipe->output = video;
> +	} else {
> +		if (far_end == NULL)
> +			return -EPIPE;
> +
> +		*state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT;
> +		pipe->input = video;
> +		pipe->output = far_end;
> +	}
> +
> +	return 0;
>  }
> 
>  /*
> @@ -972,7 +989,6 @@ isp_video_streamon(struct file *file, void *fh, enum
> v4l2_buf_type type) struct isp_video *video = video_drvdata(file);
>  	enum isp_pipeline_state state;
>  	struct isp_pipeline *pipe;
> -	struct isp_video *far_end;
>  	unsigned long flags;
>  	int ret;
> 
> @@ -992,6 +1008,8 @@ isp_video_streamon(struct file *file, void *fh, enum
> v4l2_buf_type type) pipe = video->video.entity.pipe
>  	     ? to_isp_pipeline(&video->video.entity) : &video->pipe;
> 
> +	pipe->entities = 0;
> +
>  	if (video->isp->pdata->set_constraints)
>  		video->isp->pdata->set_constraints(video->isp, true);
>  	pipe->l3_ick = clk_get_rate(video->isp->clock[ISP_CLK_L3_ICK]);
> @@ -1011,25 +1029,9 @@ isp_video_streamon(struct file *file, void *fh, enum
> v4l2_buf_type type) video->bpl_padding = ret;
>  	video->bpl_value = vfh->format.fmt.pix.bytesperline;
> 
> -	/* Find the ISP video node connected at the far end of the pipeline and
> -	 * update the pipeline.
> -	 */
> -	far_end = isp_video_far_end(video);
> -
> -	if (video->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) {
> -		state = ISP_PIPELINE_STREAM_OUTPUT | ISP_PIPELINE_IDLE_OUTPUT;
> -		pipe->input = far_end;
> -		pipe->output = video;
> -	} else {
> -		if (far_end == NULL) {
> -			ret = -EPIPE;
> -			goto err_check_format;
> -		}
> -
> -		state = ISP_PIPELINE_STREAM_INPUT | ISP_PIPELINE_IDLE_INPUT;
> -		pipe->input = video;
> -		pipe->output = far_end;
> -	}
> +	ret = isp_video_get_graph_data(video, pipe, &state);
> +	if (ret < 0)
> +		goto err_check_format;
> 
>  	/* Validate the pipeline and update its state. */
>  	ret = isp_video_validate_pipeline(pipe);
> diff --git a/drivers/media/video/omap3isp/ispvideo.h
> b/drivers/media/video/omap3isp/ispvideo.h index d91bdb91..c9187cb 100644
> --- a/drivers/media/video/omap3isp/ispvideo.h
> +++ b/drivers/media/video/omap3isp/ispvideo.h
> @@ -88,6 +88,7 @@ enum isp_pipeline_state {
>  /*
>   * struct isp_pipeline - An ISP hardware pipeline
>   * @error: A hardware error occurred during capture
> + * @entities: Bitmask of entities in the pipeline (indexed by entity ID)
>   */
>  struct isp_pipeline {
>  	struct media_pipeline pipe;
> @@ -96,6 +97,7 @@ struct isp_pipeline {
>  	enum isp_pipeline_stream_state stream_state;
>  	struct isp_video *input;
>  	struct isp_video *output;
> +	u32 entities;
>  	unsigned long l3_ick;
>  	unsigned int max_rate;
>  	atomic_t frame_number;

-- 
Regards,

Laurent Pinchart


  reply	other threads:[~2012-03-07 23:50 UTC|newest]

Thread overview: 93+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-06 16:32 [PATCH v5 0/35] V4L2 subdev and sensor control changes, SMIA++ driver and N9 camera board code Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 01/35] v4l: Introduce integer menu controls Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 02/35] v4l: Document " Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 03/35] vivi: Add an integer menu test control Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 04/35] v4l: VIDIOC_SUBDEV_S_SELECTION and VIDIOC_SUBDEV_G_SELECTION IOCTLs Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 05/35] v4l: vdev_to_v4l2_subdev() should have return type "struct v4l2_subdev *" Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 06/35] v4l: Check pad number in get try pointer functions Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 07/35] v4l: Support s_crop and g_crop through s/g_selection Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 08/35] v4l: Add subdev selections documentation: svg and dia files Sakari Ailus
2012-03-06 16:42   ` Laurent Pinchart
2012-03-06 16:32 ` [PATCH v5 09/35] v4l: Add subdev selections documentation Sakari Ailus
2012-03-06 16:44   ` Laurent Pinchart
2012-03-07  8:53   ` Michael Jones
2012-03-07 18:11     ` Sakari Ailus
2012-03-15  9:55   ` Sylwester Nawrocki
2012-03-15 13:00     ` Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 10/35] v4l: Mark VIDIOC_SUBDEV_G_CROP and VIDIOC_SUBDEV_S_CROP obsolete Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 11/35] v4l: Image source control class Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 12/35] v4l: Image processing " Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 13/35] v4l: Document raw bayer 4CC codes Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 14/35] v4l: Add DPCM compressed raw bayer pixel formats Sakari Ailus
2012-03-21  9:37   ` Prabhakar Lad
2012-03-21  9:53     ` Sakari Ailus
2012-03-21 11:44     ` [PATCH v5.5 14/40] " Sakari Ailus
2012-03-21 12:08       ` Prabhakar Lad
2012-03-06 16:32 ` [PATCH v5 15/35] media: Add link_validate() op to check links to the sink pad Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 16/35] v4l: Improve sub-device documentation for pad ops Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 17/35] v4l: Implement v4l2_subdev_link_validate() Sakari Ailus
2012-03-06 16:32 ` [PATCH v5 18/35] v4l: Allow changing control handler lock Sakari Ailus
2012-05-14 15:27   ` Sylwester Nawrocki
2012-05-14 15:45     ` Sakari Ailus
2012-05-14 16:02       ` Sylwester Nawrocki
2012-05-14 15:48     ` Sylwester Nawrocki
2012-03-06 16:33 ` [PATCH v5 19/35] omap3isp: Support additional in-memory compressed bayer formats Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 20/35] omap3isp: Move definitions required by board code under include/media Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 21/35] omap3: add definition for CONTROL_CAMERA_PHY_CTRL Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 22/35] omap3isp: Move setting constaints above media_entity_pipeline_start Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 23/35] omap3isp: Assume media_entity_pipeline_start may fail Sakari Ailus
2012-03-06 16:45   ` Laurent Pinchart
2012-03-06 16:33 ` [PATCH v5 24/35] omap3isp: Add lane configuration to platform data Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 25/35] omap3isp: Collect entities that are part of the pipeline Sakari Ailus
2012-03-07 10:35   ` Laurent Pinchart
2012-03-07 17:20     ` Sakari Ailus
2012-03-07 17:22       ` [PATCH v5.1 " Sakari Ailus
2012-03-07 23:50         ` Laurent Pinchart [this message]
2012-03-09 18:44           ` [PATCH " Sakari Ailus
2012-03-09 20:31           ` [PATCH v5.3 " Sakari Ailus
2012-03-09 20:34             ` Laurent Pinchart
2012-03-08 17:05     ` Sakari Ailus
2012-03-07 10:50   ` [PATCH v5 " Laurent Pinchart
2012-03-07 15:24     ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 26/35] omap3isp: Add information on external subdev to struct isp_pipeline Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 27/35] omap3isp: Introduce isp_video_check_external_subdevs() Sakari Ailus
2012-03-07 10:43   ` Laurent Pinchart
2012-03-07 17:49     ` Sakari Ailus
2012-03-07 18:52       ` Laurent Pinchart
2012-03-07 23:57         ` Sakari Ailus
2012-03-08 17:04         ` [PATCH v5.3 " Sakari Ailus
2012-03-08 18:05           ` Laurent Pinchart
2012-03-07 18:14     ` [PATCH v5.1 " Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 28/35] omap3isp: Use external rate instead of vpcfg Sakari Ailus
2012-03-07 10:53   ` Laurent Pinchart
2012-03-07 17:54     ` Sakari Ailus
2012-03-07 18:34     ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 29/35] omap3isp: Default link validation for ccp2, csi2, preview and resizer Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 30/35] omap3isp: Move CCDC link validation to ccdc_link_validate() Sakari Ailus
2012-03-07 11:00   ` Laurent Pinchart
2012-03-07 18:02     ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 31/35] omap3isp: Configure CSI-2 phy based on platform data Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 32/35] omap3isp: Add resizer data rate configuration to resizer_link_validate Sakari Ailus
2012-03-07 11:01   ` Laurent Pinchart
2012-03-06 16:33 ` [PATCH v5 33/35] omap3isp: Find source pad from external entity Sakari Ailus
2012-03-07 11:04   ` Laurent Pinchart
2012-03-07 18:08     ` Sakari Ailus
2012-03-06 16:33 ` [PATCH v5 34/35] smiapp: Generic SMIA++/SMIA PLL calculator Sakari Ailus
2012-03-07 12:26   ` Laurent Pinchart
2012-03-08 13:29     ` Sakari Ailus
2012-03-08 13:57     ` [PATCH v5.1 " Sakari Ailus
2012-03-08 14:38       ` Laurent Pinchart
2012-03-08 14:48         ` Sakari Ailus
2012-03-08 14:49         ` [PATCH v5.2 " Sakari Ailus
2012-03-08 14:51           ` Laurent Pinchart
2012-03-08 13:57     ` [PATCH v5.1 35/35] smiapp: Add driver Sakari Ailus
2012-03-08 14:46       ` Laurent Pinchart
2012-03-08 16:49         ` [PATCH v5.3 " Sakari Ailus
2012-03-11 13:37           ` Laurent Pinchart
2012-03-11 14:03             ` Sakari Ailus
2012-03-11 14:45               ` [PATCH v5.4 " Sakari Ailus
2012-03-11 16:32                 ` Laurent Pinchart
2012-03-08 15:06       ` [PATCH v5.1 " jean-philippe francois
2012-03-11  9:04         ` Sakari Ailus
2012-03-12  9:44           ` jean-philippe francois
2012-03-06 16:33 ` [PATCH v5 35/35] rm680: Add camera init Sakari Ailus

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=1912567.UNqMTnFDpO@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dacohen@gmail.com \
    --cc=hverkuil@xs4all.nl \
    --cc=k.debski@samsung.com \
    --cc=linux-media@vger.kernel.org \
    --cc=pradeep.sawlani@gmail.com \
    --cc=riverful@gmail.com \
    --cc=sakari.ailus@iki.fi \
    --cc=snjw23@gmail.com \
    --cc=t.stanislaws@samsung.com \
    --cc=teturtia@gmail.com \
    --cc=tuukkat76@gmail.com \
    /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).