[RFC,09/17] v4l: Add pad op for pipeline validation

Message ID 1324412889-17961-9-git-send-email-sakari.ailus@maxwell.research.nokia.com (mailing list archive)
State RFC, archived
Headers

Commit Message

Sakari Ailus Dec. 20, 2011, 8:28 p.m. UTC
  From: Sakari Ailus <sakari.ailus@iki.fi>

smiapp_pad_ops.validate_pipeline is intended to validate the full pipeline
which is implemented by the driver to which the subdev implementing this op
belongs to. The validate_pipeline op must also call validate_pipeline on
any external entity which is linked to its sink pads.

Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
---
 include/media/v4l2-subdev.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
  

Comments

Laurent Pinchart Jan. 6, 2012, 9:42 a.m. UTC | #1
Hi Sakari,

Thanks for the patch.

On Tuesday 20 December 2011 21:28:01 Sakari Ailus wrote:
> From: Sakari Ailus <sakari.ailus@iki.fi>
> 
> smiapp_pad_ops.validate_pipeline is intended to validate the full pipeline
> which is implemented by the driver to which the subdev implementing this op
> belongs to.

Should this be documented in Documentation/video4linux/v4l2-framework.txt ?

> The validate_pipeline op must also call validate_pipeline on any external
> entity which is linked to its sink pads.

I'm uncertain about this. Subdev drivers would then have to implement the 
pipeline walk logic, resulting in duplicate code. Our current situation isn't 
optimal either: walking the pipeline should be implemented in the media code. 
Would it suit your needs if the validate_pipeline operation was replaced by a 
validate_link operation, with a media_pipeline_validate() function in the 
media core to walk the pipeline and call validate_link in each pad (or maybe 
each sink pad) ?

> Signed-off-by: Sakari Ailus <sakari.ailus@iki.fi>
> ---
>  include/media/v4l2-subdev.h |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
> 
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 26eeaa4..a5ebe86 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -470,6 +470,7 @@ struct v4l2_subdev_pad_ops {
>  			     struct v4l2_subdev_selection *sel);
>  	int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
>  			     struct v4l2_subdev_selection *sel);
> +	int (*validate_pipeline)(struct v4l2_subdev *sd);
>  };
> 
>  struct v4l2_subdev_ops {
  
Sakari Ailus Jan. 7, 2012, 11:28 p.m. UTC | #2
Hi Laurent,

Thanks for the review!!

Laurent Pinchart wrote:
> On Tuesday 20 December 2011 21:28:01 Sakari Ailus wrote:
>> From: Sakari Ailus <sakari.ailus@iki.fi>
>>
>> smiapp_pad_ops.validate_pipeline is intended to validate the full pipeline
>> which is implemented by the driver to which the subdev implementing this op
>> belongs to.
> 
> Should this be documented in Documentation/video4linux/v4l2-framework.txt ?
> 
>> The validate_pipeline op must also call validate_pipeline on any external
>> entity which is linked to its sink pads.
> 
> I'm uncertain about this. Subdev drivers would then have to implement the 
> pipeline walk logic, resulting in duplicate code. Our current situation isn't 
> optimal either: walking the pipeline should be implemented in the media code. 
> Would it suit your needs if the validate_pipeline operation was replaced by a 
> validate_link operation, with a media_pipeline_validate() function in the 
> media core to walk the pipeline and call validate_link in each pad (or maybe 
> each sink pad) ?

Albeit I don't see the pipeline checking a big problem in the subdev
drivers, that does seem like a viable alternative --- it's definitely
more generic. Any benefit of that is directly bound to the existence of
generic pipeline validation function, which definitely shouldn't be too
difficult to write.

It is also true that in practice, I assume, considering the pipeline
validation inside subdev drivers, the SMIA++ driver is almost as complex
any sensor driver will get in the near future. But once a practice has
been established it's difficult to change that.

I'm for validate_link() op.

I assume that in the implementation the Media controller framework would
walk the pipeline and call entity specific link_validate() ops. We
already have link_setup() op there. Those would, in turn, check that the
link requirements are fulfilled. How does that sound like to you?

Regards,
  
Laurent Pinchart Jan. 8, 2012, 6:20 p.m. UTC | #3
Hi Sakari,

On Sunday 08 January 2012 00:28:40 Sakari Ailus wrote:
> Laurent Pinchart wrote:
> > On Tuesday 20 December 2011 21:28:01 Sakari Ailus wrote:
> >> From: Sakari Ailus <sakari.ailus@iki.fi>
> >> 
> >> smiapp_pad_ops.validate_pipeline is intended to validate the full
> >> pipeline which is implemented by the driver to which the subdev
> >> implementing this op belongs to.
> > 
> > Should this be documented in Documentation/video4linux/v4l2-framework.txt
> > ?
> > 
> >> The validate_pipeline op must also call validate_pipeline on any
> >> external entity which is linked to its sink pads.
> > 
> > I'm uncertain about this. Subdev drivers would then have to implement the
> > pipeline walk logic, resulting in duplicate code. Our current situation
> > isn't optimal either: walking the pipeline should be implemented in the
> > media code. Would it suit your needs if the validate_pipeline operation
> > was replaced by a validate_link operation, with a
> > media_pipeline_validate() function in the media core to walk the
> > pipeline and call validate_link in each pad (or maybe each sink pad) ?
> 
> Albeit I don't see the pipeline checking a big problem in the subdev
> drivers, that does seem like a viable alternative --- it's definitely
> more generic. Any benefit of that is directly bound to the existence of
> generic pipeline validation function, which definitely shouldn't be too
> difficult to write.
> 
> It is also true that in practice, I assume, considering the pipeline
> validation inside subdev drivers, the SMIA++ driver is almost as complex
> any sensor driver will get in the near future. But once a practice has
> been established it's difficult to change that.
> 
> I'm for validate_link() op.
> 
> I assume that in the implementation the Media controller framework would
> walk the pipeline and call entity specific link_validate() ops. We
> already have link_setup() op there. Those would, in turn, check that the
> link requirements are fulfilled. How does that sound like to you?

That sounds good to me. If the operation isn't implemented, the core should 
just make sure that code, width and height are identical on the two ends of 
the link. That will be the usual requirement, checking it in the core will 
make drivers simpler.
  

Patch

diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
index 26eeaa4..a5ebe86 100644
--- a/include/media/v4l2-subdev.h
+++ b/include/media/v4l2-subdev.h
@@ -470,6 +470,7 @@  struct v4l2_subdev_pad_ops {
 			     struct v4l2_subdev_selection *sel);
 	int (*set_selection)(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh,
 			     struct v4l2_subdev_selection *sel);
+	int (*validate_pipeline)(struct v4l2_subdev *sd);
 };
 
 struct v4l2_subdev_ops {