From: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
Mauro Carvalho Chehab <mchehab@infradead.org>
Subject: Re: [PATCH v4 3/6] media: add a common struct to be embed on media graph objects
Date: Sat, 15 Aug 2015 11:56:18 -0300 [thread overview]
Message-ID: <20150815115618.7af73c68@recife.lan> (raw)
In-Reply-To: <20150814212514.GB28370@valkosipuli.retiisi.org.uk>
Em Sat, 15 Aug 2015 00:25:15 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:
> Hi Mauro,
>
> On Fri, Aug 14, 2015 at 11:56:40AM -0300, Mauro Carvalho Chehab wrote:
> > Due to the MC API proposed changes, we'll need to have an unique
> > object ID for all graph objects, and have some shared fields
> > that will be common on all media graph objects.
> >
> > Right now, the only common object is the object ID, but other
> > fields will be added latter on.
> >
> > Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
> >
> > diff --git a/drivers/media/media-entity.c b/drivers/media/media-entity.c
> > index b8102bda664d..046f1fe40b50 100644
> > --- a/drivers/media/media-entity.c
> > +++ b/drivers/media/media-entity.c
> > @@ -27,6 +27,39 @@
> > #include <media/media-device.h>
> >
> > /**
> > + * graph_obj_init - Initialize a graph object
> > + *
> > + * @mdev: Pointer to the media_device that contains the object
> > + * @type: Type of the object
> > + * @gobj: Pointer to the object
> > + *
> > + * This routine initializes the embedded struct media_graph_obj inside a
> > + * media graph object. It is called automatically if media_*_create()
> > + * calls are used. However, if the object (entity, link, pad, interface)
> > + * is embedded on some other object, this function should be called before
> > + * registering the object at the media controller.
> > + */
> > +void graph_obj_init(struct media_device *mdev,
> > + enum media_graph_type type,
> > + struct media_graph_obj *gobj)
> > +{
> > + /* An unique object ID will be provided on next patches */
> > + gobj->id = type << 24;
>
> Ugh. This will mean the object IDs are going to be huge to begin with,
> ending up being a nuisance to work with as you often write them by hand. Do
> we win anything by doing so?
There is a problem on the current implementation of the graph: it uses
a bitmap in order to detect if the graph traversal entered inside a loop.
Also, one of the drivers (vsp1, I think) assumes that the maximum ID
for an entity is 31 (as it uses 1 << entity->id).
Due to that, we should have a separate range for entities starting from
0.
That should not affect neither debug printks or userspace, provided that
the object type is known, as one could always do:
#define gobj_id(gobj) ( (gobj)->id & ( (1 << 25) - 1) )
dev_dbg(mdev->dev, "MC create: %s#%d\n",
gobj_type[media_gobj_type(gobj)],
gobj_id(gobj));
in order to report the ID into a reasonable range.
I'm actually doing that on some debug patches I'm writing right now
in order to allow me to test object creation/removal.
Regards,
Mauro
next prev parent reply other threads:[~2015-08-15 14:56 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 [this message]
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
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=20150815115618.7af73c68@recife.lan \
--to=mchehab@osg.samsung.com \
--cc=linux-media@vger.kernel.org \
--cc=mchehab@infradead.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).