From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sylwester Nawrocki Subject: Re: [PATCH v8 07/12] media: Entities, pads and links enumeration Date: Sun, 13 Feb 2011 22:59:44 +0100 Message-ID: <4D585450.2050900@gmail.com> References: <1296131437-29954-1-git-send-email-laurent.pinchart@ideasonboard.com> <1296131437-29954-8-git-send-email-laurent.pinchart@ideasonboard.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1296131437-29954-8-git-send-email-laurent.pinchart@ideasonboard.com> Sender: linux-media-owner@vger.kernel.org To: Laurent Pinchart Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org, clemens@ladisch.de, broonie@opensource.wolfsonmicro.com, sakari.ailus@maxwell.research.nokia.com List-Id: alsa-devel@alsa-project.org Hi Laurent, Please see my little comment below.. On 2011-01-27 13:30, Laurent Pinchart wrote: > Create the following two ioctls and implement them at the media device > level to enumerate entities, pads and links. > > - MEDIA_IOC_ENUM_ENTITIES: Enumerate entities and their properties > - MEDIA_IOC_ENUM_LINKS: Enumerate all pads and links for a given entity > > Entity IDs can be non-contiguous. Userspace applications should > enumerate entities using the MEDIA_ENT_ID_FLAG_NEXT flag. When the flag > is set in the entity ID, the MEDIA_IOC_ENUM_ENTITIES will return the > next entity with an ID bigger than the requested one. > > Only forward links that originate at one of the entity's source pads are > returned during the enumeration process. > > Signed-off-by: Laurent Pinchart > Signed-off-by: Sakari Ailus > --- > Documentation/DocBook/media-entities.tmpl | 8 + > Documentation/DocBook/v4l/media-controller.xml | 2 + > .../DocBook/v4l/media-ioc-device-info.xml | 3 +- > .../DocBook/v4l/media-ioc-enum-entities.xml | 308 ++++++++++++++++++++ > Documentation/DocBook/v4l/media-ioc-enum-links.xml | 202 +++++++++++++ > drivers/media/media-device.c | 123 ++++++++ > include/linux/media.h | 85 ++++++ > include/media/media-entity.h | 24 +-- > 8 files changed, 731 insertions(+), 24 deletions(-) > create mode 100644 Documentation/DocBook/v4l/media-ioc-enum-entities.xml > create mode 100644 Documentation/DocBook/v4l/media-ioc-enum-links.xml > ... > diff --git a/Documentation/DocBook/v4l/media-ioc-enum-links.xml b/Documentation/DocBook/v4l/media-ioc-enum-links.xml > new file mode 100644 > index 0000000..daf0360 > --- /dev/null > +++ b/Documentation/DocBook/v4l/media-ioc-enum-links.xml > @@ -0,0 +1,202 @@ > + > + > + ioctl MEDIA_IOC_ENUM_LINKS > + &manvol; > + > + > + > + MEDIA_IOC_ENUM_LINKS > + Enumerate all pads and links for a given entity > + > + > + > + > + > + int ioctl > + int fd > + int request > + struct media_links_enum *argp > + > + > + > + > + > + Arguments > + > + > + > + fd > + > + File descriptor returned by > + open(). > + > + > + > + request > + > + MEDIA_IOC_ENUM_LINKS > + > + > + > + argp > + > + > + > + > + > + > + > + > + Description > + > + To enumerate pads and/or links for a given entity, applications set > + the entity field of a &media-links-enum; structure and initialize the > + &media-pad-desc; and &media-link-desc; structure arrays pointed by the > + pads and links fields. > + They then call the MEDIA_IOC_ENUM_LINKS ioctl with a pointer to this > + structure. > + If the pads field is not NULL, the driver > + fills the pads array with information about the > + entity's pads. The array must have enough room to store all the entity's > + pads. The number of pads can be retrieved with the &MEDIA-IOC-ENUM-ENTITIES; > + ioctl. > + If the links field is not NULL, the driver > + fills the links array with information about the > + entity's outbound links. The array must have enough room to store all the > + entity's outbound links. The number of outbound links can be retrieved with > + the &MEDIA-IOC-ENUM-ENTITIES; ioctl. > + Only forward links that originate at one of the entity's source pads > + are returned during the enumeration process. > + > + > + struct <structname>media_links_enum</structname> > + > + &cs-str; > + > + > + __u32 > + entity > + Entity id, set by the application. > + > + > + struct &media-pad-desc; > + *pads > + Pointer to a pads array allocated by the application. Ignored > + if NULL. > + > + > + struct &media-link-desc; > + *links > + Pointer to a links array allocated by the application. Ignored > + if NULL. > + > + > + > + > + > + > + struct <structname>media_pad_desc</structname> > + > + &cs-str; > + > + > + __u32 > + entity > + ID of the entity this pad belongs to. > + > + > + __u16 > + index > + 0-based pad index. > + > + > + __u32 > + flags > + Pad flags, see for more details. > + > + > + > +
> + > + > + Media pad flags > + > + > + > + > + > + MEDIA_PAD_FL_INPUT > + Input pad, relative to the entity. Input pads sink data and > + are targets of links. > + > + > + MEDIA_PAD_FL_OUTPUT > + Output pad, relative to the entity. Output pads source data > + and are origins of links. > + > + > + > +
> + > + > + struct <structname>media_links_enum</structname> ..the above line should perhaps be: > + struct <structname>media_links_desc</structname> as "struct media_links_desc" is described above. BTW, I was wondering how one makes use of the pads associated with a media entity of type other than MEDIA_ENT_T_V4L2_SUBDEV*, e.g. V4L2 device - MEDIA_ENT_T_DEVNODE_V4L. I guess new standard ioctls should be added for per pads operations at V4L2 device, similarly is it is done with v4l2-subdevs. Is this right? Regards, Sylwester