All of lore.kernel.org
 help / color / mirror / Atom feed
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 RFC v2 01/16] media: Add some fields to store graph objects
Date: Fri, 7 Aug 2015 20:55:34 -0300	[thread overview]
Message-ID: <20150807205534.06ea65c2@recife.lan> (raw)
In-Reply-To: <20150807231445.GA19840@valkosipuli.retiisi.org.uk>

Em Sat, 8 Aug 2015 02:14:46 +0300
Sakari Ailus <sakari.ailus@iki.fi> escreveu:

> Hi Mauro,
> 
> On Fri, Aug 07, 2015 at 11:19:59AM -0300, Mauro Carvalho Chehab wrote:
> > We'll need unique IDs for graph objects and a way to associate
> > them with the media interface.
> > 
> > So, add an atomic var to be used to create unique IDs and
> > a list to store such objects.
> > 
> > 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 7b39440192d6..e627b0b905ad 100644
> > --- a/drivers/media/media-device.c
> > +++ b/drivers/media/media-device.c
> > @@ -396,6 +396,10 @@ int __must_check __media_device_register(struct media_device *mdev,
> >  		return ret;
> >  	}
> >  
> > +	/* Initialize media graph object list and ID */
> > +	atomic_set(&mdev->last_obj_id, 0);
> > +	INIT_LIST_HEAD(&mdev->object_list);
> > +
> >  	return 0;
> >  }
> >  EXPORT_SYMBOL_GPL(__media_device_register);
> > diff --git a/include/media/media-device.h b/include/media/media-device.h
> > index 6e6db78f1ee2..a9d546716e49 100644
> > --- a/include/media/media-device.h
> > +++ b/include/media/media-device.h
> > @@ -78,6 +78,10 @@ struct media_device {
> >  
> >  	int (*link_notify)(struct media_link *link, u32 flags,
> >  			   unsigned int notification);
> > +
> > +	/* Used by media_graph stuff */
> > +	atomic_t last_obj_id;
> > +	struct list_head object_list;
> >  };
> >  
> >  /* Supported link_notify @notification values. */
> 
> Instead of starting with rework of the MC internals, what would you think of
> separating interfaces from entities first, and see how that would be used by
> a driver (e.g. DVB)? 

Because that won't attend the requirements we've mapped during the
workshop. We did some radical changes there, and we want to keep the
structs more generic, in order to allow MC usage on other subsystems
like IIO.

Also, starting the changes at the drivers would just make a way worse
and harder to work, as it would use a hacky temporary representation
that will need to change as the MC internals change. That would mean
more code to be changed latter and more complex patchsets, as we fix
the MC internals.

You should remind that one of the most complex goals is that we'll need
to support dynamic entity/pad/link/interface creation/removal. That will
require changes at the MC internals anyway. So, it is better to do such
changes first in a way that it would be easier to latter add support for
it, and, once we have a kABI that works, add the needed things at the
drivers side.

With this patch series, the MC internals are better, and will easily
support the new API that was designed during the meeting.

So, my plan for the next week is to test it, in order to be sure that
everything keeps working, and then add interfaces and the new userspace
ioctls.

> I think a simple linked list would do per entity, no
> links would be needed at this point in the internal representation.

The entity/interface links are now represented as linked lists (and
so the pad/pad links). By sharing the same struct, no code duplication,
making easier to maintain. Also, if we need graph traversal, the code
is there.

For now, I opted to use a separate list inside the entity for 
the entity/interface. This is not really needed, but it would mean
a shorter time when checking all entity-interface links. The drawback
is that it makes harder for graph traversal. So, eventually, we might
want to change it in some future, specially if we need to represent
indirect control and do graph traversal for interfaces. I guess we
may need graph traversal for the Kernelspace-userspace sinks, like
ALSA PCM capture interfaces. So, we may need to revisit that.

> I'll review this better during the next week.

Ok.

Regards,
Mauro

  reply	other threads:[~2015-08-07 23:55 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-07 14:19 [PATCH RFC v2 00/16] Changes on MC core due to MC workshop discussion Mauro Carvalho Chehab
2015-08-07 14:19 ` [PATCH RFC v2 01/16] media: Add some fields to store graph objects Mauro Carvalho Chehab
2015-08-07 23:14   ` Sakari Ailus
2015-08-07 23:55     ` Mauro Carvalho Chehab [this message]
2015-08-07 14:20 ` [PATCH RFC v2 02/16] media: Add a common embeed struct for all media " Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 03/16] media: add functions to inialize media_graph_obj Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 04/16] media: ensure that entities will have an object ID Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 05/16] media: initialize PAD objects Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 06/16] media: initialize the graph object inside the media links Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 07/16] media: get rid of unused "extra_links" param on media_entity_init() Mauro Carvalho Chehab
2015-08-07 14:20   ` Mauro Carvalho Chehab
2015-08-07 14:20   ` Mauro Carvalho Chehab
2015-08-07 14:20   ` Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 08/16] media: convert links from array to list Mauro Carvalho Chehab
2015-08-11 10:49   ` Hans Verkuil
2015-08-11 11:12     ` Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 11/16] FIXUP: source link removal on failure Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 12/16] media: move __media_entity_remove_link to avoid prototype Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 13/16] media: make the internal function to create links more generic Mauro Carvalho Chehab
2015-08-11 10:57   ` Hans Verkuil
2015-08-11 11:16     ` Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 14/16] media: add a generic function to remove a link Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 15/16] media: rename media_entity_remove_foo functions Mauro Carvalho Chehab
2015-08-07 14:20 ` [PATCH RFC v2 16/16] media: add functions to allow creating interfaces Mauro Carvalho Chehab
2015-08-11 11:14   ` Hans Verkuil
2015-08-11 12:24     ` Mauro Carvalho Chehab
2015-08-11 12:26       ` Hans Verkuil
2015-08-07 15:23 ` [PATCH RFC v2 00/16] Changes on MC core due to MC workshop discussion Mauro Carvalho Chehab
     [not found] ` <cover.1439292977.git.mchehab@osg.samsung.com>
2015-08-11 12:09   ` [PATCH RFC v2 09/16] media: use media_graph_obj for link endpoints Mauro Carvalho Chehab
2015-08-11 12:09     ` Mauro Carvalho Chehab
2015-08-11 12:09     ` Mauro Carvalho Chehab
     [not found]     ` <cover.1439294756.git.mchehab@osg.samsung.com>
2015-08-11 12:09       ` [PATCH RFC v2 10/16] media: rename the function that create pad links Mauro Carvalho Chehab
2015-08-11 12:09         ` Mauro Carvalho Chehab
2015-08-11 12:09         ` Mauro Carvalho Chehab
2015-08-11 12:09         ` Mauro Carvalho Chehab
2015-08-11 12:25     ` [PATCH RFC v2 09/16] media: use media_graph_obj for link endpoints Hans Verkuil
2015-08-11 12:25       ` Hans Verkuil
2015-08-11 13:22       ` Mauro Carvalho Chehab
2015-08-11 13:22         ` Mauro Carvalho Chehab
2015-08-11 13:22         ` Mauro Carvalho Chehab
2015-08-11 13:32         ` Hans Verkuil
2015-08-11 13:32           ` Hans Verkuil
2015-08-11 13:32           ` Hans Verkuil

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=20150807205534.06ea65c2@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.