diff mbox series

[v6,11/24] media: entity: Skip link validation for pads to which there is no route to

Message ID 20210427124523.990938-12-tomi.valkeinen@ideasonboard.com
State New
Headers show
Series v4l: subdev internal routing | expand

Commit Message

Tomi Valkeinen April 27, 2021, 12:45 p.m. UTC
From: Sakari Ailus <sakari.ailus@linux.intel.com>

Links are validated along the pipeline which is about to start streaming.
Not all the pads in entities that are traversed along that pipeline are
part of the pipeline, however. Skip the link validation for such pads,
and while at there rename "other_pad" to "local_pad" to convey the fact
the route to be checked is internal to the entity.

Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>
---
 drivers/media/mc/mc-entity.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

Comments

Laurent Pinchart April 29, 2021, 2:30 a.m. UTC | #1
Hi Tomi and Sakari,

Thank you for the patch.

On Tue, Apr 27, 2021 at 03:45:10PM +0300, Tomi Valkeinen wrote:
> From: Sakari Ailus <sakari.ailus@linux.intel.com>

> 

> Links are validated along the pipeline which is about to start streaming.

> Not all the pads in entities that are traversed along that pipeline are

> part of the pipeline, however. Skip the link validation for such pads,

> and while at there rename "other_pad" to "local_pad" to convey the fact

> the route to be checked is internal to the entity.


After sorting out the "other_pad" name as discussed in v5,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

> Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>

> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>

> ---

>  drivers/media/mc/mc-entity.c | 15 ++++++++++-----

>  1 file changed, 10 insertions(+), 5 deletions(-)

> 

> diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c

> index d00c7397e09a..a4cca53124b2 100644

> --- a/drivers/media/mc/mc-entity.c

> +++ b/drivers/media/mc/mc-entity.c

> @@ -482,27 +482,32 @@ __must_check int __media_pipeline_start(struct media_pad *pad,

>  		bitmap_fill(has_no_links, entity->num_pads);

>  

>  		list_for_each_entry(link, &entity->links, list) {

> -			struct media_pad *other_pad =

> +			struct media_pad *local_pad =

>  				link->sink->entity == entity ?

>  				link->sink : link->source;

>  

> +			/* Ignore pads to which there is no route. */

> +			if (!media_entity_has_route(entity, pad->index,

> +						    local_pad->index))

> +				continue;

> +

>  			/* Mark that a pad is connected by a link. */

> -			bitmap_clear(has_no_links, other_pad->index, 1);

> +			bitmap_clear(has_no_links, local_pad->index, 1);

>  

>  			/*

>  			 * Pads that either do not need to connect or

>  			 * are connected through an enabled link are

>  			 * fine.

>  			 */

> -			if (!(other_pad->flags & MEDIA_PAD_FL_MUST_CONNECT) ||

> +			if (!(local_pad->flags & MEDIA_PAD_FL_MUST_CONNECT) ||

>  			    link->flags & MEDIA_LNK_FL_ENABLED)

> -				bitmap_set(active, other_pad->index, 1);

> +				bitmap_set(active, local_pad->index, 1);

>  

>  			/*

>  			 * Link validation will only take place for

>  			 * sink ends of the link that are enabled.

>  			 */

> -			if (link->sink != other_pad ||

> +			if (link->sink != local_pad ||

>  			    !(link->flags & MEDIA_LNK_FL_ENABLED))

>  				continue;

>  


-- 
Regards,

Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c
index d00c7397e09a..a4cca53124b2 100644
--- a/drivers/media/mc/mc-entity.c
+++ b/drivers/media/mc/mc-entity.c
@@ -482,27 +482,32 @@  __must_check int __media_pipeline_start(struct media_pad *pad,
 		bitmap_fill(has_no_links, entity->num_pads);
 
 		list_for_each_entry(link, &entity->links, list) {
-			struct media_pad *other_pad =
+			struct media_pad *local_pad =
 				link->sink->entity == entity ?
 				link->sink : link->source;
 
+			/* Ignore pads to which there is no route. */
+			if (!media_entity_has_route(entity, pad->index,
+						    local_pad->index))
+				continue;
+
 			/* Mark that a pad is connected by a link. */
-			bitmap_clear(has_no_links, other_pad->index, 1);
+			bitmap_clear(has_no_links, local_pad->index, 1);
 
 			/*
 			 * Pads that either do not need to connect or
 			 * are connected through an enabled link are
 			 * fine.
 			 */
-			if (!(other_pad->flags & MEDIA_PAD_FL_MUST_CONNECT) ||
+			if (!(local_pad->flags & MEDIA_PAD_FL_MUST_CONNECT) ||
 			    link->flags & MEDIA_LNK_FL_ENABLED)
-				bitmap_set(active, other_pad->index, 1);
+				bitmap_set(active, local_pad->index, 1);
 
 			/*
 			 * Link validation will only take place for
 			 * sink ends of the link that are enabled.
 			 */
-			if (link->sink != other_pad ||
+			if (link->sink != local_pad ||
 			    !(link->flags & MEDIA_LNK_FL_ENABLED))
 				continue;