From: Hans Verkuil <hverkuil@xs4all.nl>
To: Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH v4 6/6] media: use media_graph_obj inside links
Date: Fri, 14 Aug 2015 17:18:28 +0200 [thread overview]
Message-ID: <55CE06C4.7080100@xs4all.nl> (raw)
In-Reply-To: <b7b0a4f38b7ae2bb3bd69aeaf3476250f489d50a.1439563682.git.mchehab@osg.samsung.com>
On 08/14/2015 04:56 PM, Mauro Carvalho Chehab wrote:
> Just like entities and pads, links also need to have unique
> Object IDs along a given media controller.
>
> So, let's add a media_graph_obj inside it and initialize
> the object then a new link is created.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
>
> diff --git a/drivers/media/media-device.c b/drivers/media/media-device.c
> index 3ac5803b327e..9f02939c2864 100644
> --- a/drivers/media/media-device.c
> +++ b/drivers/media/media-device.c
> @@ -466,6 +466,8 @@ void media_device_unregister_entity(struct media_entity *entity)
> graph_obj_remove(&entity->graph_obj);
> for (i = 0; i < entity->num_pads; i++)
> graph_obj_remove(&entity->pads[i].graph_obj);
> + for (i = 0; entity->num_links; i++)
> + graph_obj_remove(&entity->links[i].graph_obj);
> list_del(&entity->list);
> spin_unlock(&mdev->lock);
> entity->parent = NULL;
> diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> index d3dee6fc79d7..4f18bd10b162 100644
> --- a/drivers/media/media-entity.c
> +++ b/drivers/media/media-entity.c
> @@ -50,6 +50,8 @@ void graph_obj_init(struct media_device *mdev,
> gobj->id |= ++mdev->entity_id;
> case MEDIA_GRAPH_PAD:
> gobj->id |= ++mdev->pad_id;
> + case MEDIA_GRAPH_LINK:
> + gobj->id |= ++mdev->pad_id;
Same issue with missing breaks. Also for links you want to use link_id, not
pad_id. Clearly a copy-and-paste mistake.
A bigger question is whether you actually need graph_obj for a link? Links are
*between* graph objects, but are they really graph objects in their own right?
Currently a link is identified by the source/sink objects and I think that is
all you need. I didn't realize that when reviewing the v3 patch series, but I'm
now wondering about it.
If you *don't* make links a graph_obj, will anything break or become difficult
to use? I don't think so, but let me know if I am overlooking something.
> }
> }
>
> @@ -469,6 +471,10 @@ static struct media_link *media_entity_add_link(struct media_entity *entity)
> entity->links = links;
> }
>
> + /* Initialize graph object embedded at the new link */
> + graph_obj_init(entity->parent, MEDIA_GRAPH_LINK,
> + &entity->links[entity->num_links].graph_obj);
> +
> return &entity->links[entity->num_links++];
> }
>
> diff --git a/include/media/media-device.h b/include/media/media-device.h
> index 2a9d9260cccc..2d9a050d46f7 100644
> --- a/include/media/media-device.h
> +++ b/include/media/media-device.h
> @@ -43,6 +43,7 @@ struct device;
> * @driver_version: Device driver version
> * @entity_id: Unique ID used on the last entity registered
> * @pad_id: Unique ID used on the last pad registered
> + * @link_id: Unique ID used on the last link registered
> * @entities: List of registered entities
> * @lock: Entities list lock
> * @graph_mutex: Entities graph operation lock
> @@ -72,6 +73,7 @@ struct media_device {
> /* Unique object ID counter */
> u32 entity_id;
> u32 pad_id;
> + u32 link_id;
>
> struct list_head entities;
>
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 936f68f27bba..30eaae47d72e 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -35,10 +35,12 @@
> *
> * @MEDIA_GRAPH_ENTITY: Identify a media entity
> * @MEDIA_GRAPH_PAD: Identify a media pad
> + * @MEDIA_GRAPH_LINK: Identify a media link
> */
> enum media_graph_type {
> MEDIA_GRAPH_ENTITY,
> MEDIA_GRAPH_PAD,
> + MEDIA_GRAPH_LINK,
> };
>
>
> @@ -61,6 +63,7 @@ struct media_pipeline {
> };
>
> struct media_link {
> + struct media_graph_obj graph_obj;
> struct media_pad *source; /* Source pad */
> struct media_pad *sink; /* Sink pad */
> struct media_link *reverse; /* Link in the reverse direction */
>
Regards,
Hans
next prev parent reply other threads:[~2015-08-14 15:19 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-14 14:56 [PATCH v4 0/6] MC preparation patches Mauro Carvalho Chehab
2015-08-14 14:56 ` [PATCH v4 1/6] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
2015-08-14 14:59 ` Hans Verkuil
2015-08-14 15:16 ` Laurent Pinchart
2015-08-14 14:56 ` [PATCH v4 2/6] media: create a macro to get entity ID Mauro Carvalho Chehab
2015-08-14 15:02 ` Hans Verkuil
2015-08-14 21:08 ` Sakari Ailus
2015-08-14 21:48 ` Laurent Pinchart
2015-08-14 14:56 ` [PATCH v4 3/6] media: add a common struct to be embed on media graph objects Mauro Carvalho Chehab
2015-08-14 15:03 ` Hans Verkuil
2015-08-14 21:25 ` Sakari Ailus
2015-08-15 14:56 ` Mauro Carvalho Chehab
2015-08-15 16:42 ` Laurent Pinchart
2015-08-16 11:41 ` Mauro Carvalho Chehab
2015-08-14 14:56 ` [PATCH v4 4/6] media: use media_graph_obj inside entities Mauro Carvalho Chehab
2015-08-14 15:07 ` Hans Verkuil
2015-08-14 22:12 ` Sakari Ailus
2015-08-14 14:56 ` [PATCH v4 5/6] media: use media_graph_obj inside pads Mauro Carvalho Chehab
2015-08-14 15:10 ` Hans Verkuil
2015-08-14 22:15 ` Sakari Ailus
2015-08-14 14:56 ` [PATCH v4 6/6] media: use media_graph_obj inside links Mauro Carvalho Chehab
2015-08-14 15:18 ` Hans Verkuil [this message]
2015-08-14 15:33 ` Hans Verkuil
2015-08-14 16:19 ` Mauro Carvalho Chehab
2015-08-14 16:15 ` Mauro Carvalho Chehab
2015-08-14 22:37 ` [PATCH v4 0/6] MC preparation patches Sakari Ailus
2015-08-14 23:27 ` Mauro Carvalho Chehab
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=55CE06C4.7080100@xs4all.nl \
--to=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.org \
--cc=mchehab@osg.samsung.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).