From: Laurent Pinchart <laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
To: Mauro Carvalho Chehab <mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
Cc: Linux Media Mailing List
<linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v8 44/55] [media] uapi/media.h: Add MEDIA_IOC_G_TOPOLOGY ioctl
Date: Sun, 06 Dec 2015 02:47:39 +0200 [thread overview]
Message-ID: <1647957.hsKJGfKUVG@avalon> (raw)
In-Reply-To: <297afcfe4c9c5ebc074f92d1badd34b94e8b28f9.1441540862.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
Hi Mauro,
Thank you for the patch.
On Sunday 06 September 2015 09:03:04 Mauro Carvalho Chehab wrote:
> Add a new ioctl that will report the entire topology on
> one go.
>
> Signed-off-by: Mauro Carvalho Chehab <mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
>
> diff --git a/include/media/media-entity.h b/include/media/media-entity.h
> index 7320cdc45833..2d5ad40254b7 100644
> --- a/include/media/media-entity.h
> +++ b/include/media/media-entity.h
> @@ -181,6 +181,8 @@ struct media_interface {
> */
> struct media_intf_devnode {
> struct media_interface intf;
> +
> + /* Should match the fields at media_v2_intf_devnode */
> u32 major;
> u32 minor;
> };
> diff --git a/include/uapi/linux/media.h b/include/uapi/linux/media.h
> index a1bd7afba110..b17f6763aff4 100644
> --- a/include/uapi/linux/media.h
> +++ b/include/uapi/linux/media.h
> @@ -206,6 +206,10 @@ struct media_pad_desc {
> #define MEDIA_LNK_FL_IMMUTABLE (1 << 1)
> #define MEDIA_LNK_FL_DYNAMIC (1 << 2)
>
> +#define MEDIA_LNK_FL_LINK_TYPE (0xf << 28)
> +# define MEDIA_LNK_FL_DATA_LINK (0 << 28)
> +# define MEDIA_LNK_FL_INTERFACE_LINK (1 << 28)
> +
> struct media_link_desc {
> struct media_pad_desc source;
> struct media_pad_desc sink;
> @@ -249,11 +253,93 @@ struct media_links_enum {
> #define MEDIA_INTF_T_ALSA_RAWMIDI (MEDIA_INTF_T_ALSA_BASE + 4)
> #define MEDIA_INTF_T_ALSA_HWDEP (MEDIA_INTF_T_ALSA_BASE + 5)
>
> -/* TBD: declare the structs needed for the new G_TOPOLOGY ioctl */
> +/*
> + * MC next gen API definitions
> + *
> + * NOTE: The declarations below are close to the MC RFC for the Media
> + * Controller, the next generation. Yet, there are a few adjustments
> + * to do, as we want to be able to have a functional API before
> + * the MC properties change. Those will be properly marked below.
> + * Please also notice that I removed "num_pads", "num_links",
> + * from the proposal, as a proper userspace application will likely
> + * use lists for pads/links, just as we intend to do in Kernelspace.
> + * The API definition should be freed from fields that are bound to
> + * some specific data structure.
> + *
> + * FIXME: Currently, I opted to name the new types as "media_v2", as this
> + * won't cause any conflict with the Kernelspace namespace, nor with
> + * the previous kAPI media_*_desc namespace. This can be changed
> + * later, before the adding this API upstream.
Yes, that's a good idea. Or at least we need to remove this comment if we
decide to keep the v2 names :-)
> + */
> +
> +
> +struct media_v2_entity {
> + __u32 id;
> + char name[64]; /* FIXME: move to a property? (RFC says so) */
I agree with Sakari that we can keep the name here even if we also expose it
as a property. However, there's one issue we need to address : we need to
clearly define what the name field should contain and how it should be
constructed, otherwise we'll end up with the exact same mess as today, and I
don't want that. We can discuss it in this mail thread or as replies to a
future documentation patch.
> + __u16 reserved[14];
Sakari and Hans have already commented on using __u32 instead of __u16 for
reserved fields, as well as on the number of reserved fields. I agree with
them but have nothing to add.
> +};
> +
> +/* Should match the specific fields at media_intf_devnode */
> +struct media_v2_intf_devnode {
> + __u32 major;
> + __u32 minor;
> +};
> +
> +struct media_v2_interface {
> + __u32 id;
> + __u32 intf_type;
> + __u32 flags;
> + __u32 reserved[9];
> +
> + union {
> + struct media_v2_intf_devnode devnode;
> + __u32 raw[16];
> + };
> +};
> +
> +struct media_v2_pad {
> + __u32 id;
> + __u32 entity_id;
> + __u32 flags;
> + __u16 reserved[9];
> +};
> +
> +struct media_v2_link {
> + __u32 id;
> + __u32 source_id;
> + __u32 sink_id;
> + __u32 flags;
> + __u32 reserved[5];
> +};
> +
> +struct media_v2_topology {
> + __u32 topology_version;
> +
> + __u32 num_entities;
> + struct media_v2_entity *entities;
The kernel seems to be moving to using __u64 instead of pointers in userspace-
facing structures to avoid compat32 code.
> +
> + __u32 num_interfaces;
> + struct media_v2_interface *interfaces;
> +
> + __u32 num_pads;
> + struct media_v2_pad *pads;
> +
> + __u32 num_links;
> + struct media_v2_link *links;
> +
> + struct {
> + __u32 reserved_num;
> + void *reserved_ptr;
> + } reserved_types[16];
> + __u32 reserved[8];
I'd just create __u32 reserved fields without any reserved_types, we can
always use the reserved fields to add new types later.
> +};
> +
> +/* ioctls */
>
> #define MEDIA_IOC_DEVICE_INFO _IOWR('|', 0x00, struct
media_device_info)
> #define MEDIA_IOC_ENUM_ENTITIES _IOWR('|', 0x01, struct
media_entity_desc)
> #define MEDIA_IOC_ENUM_LINKS _IOWR('|', 0x02, struct media_links_enum)
> #define MEDIA_IOC_SETUP_LINK _IOWR('|', 0x03, struct media_link_desc)
> +#define MEDIA_IOC_G_TOPOLOGY _IOWR('|', 0x04, struct media_v2_topology)
>
> #endif /* __LINUX_MEDIA_H */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2015-12-06 0:47 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-30 3:06 [PATCH v8 00/55] MC next generation patches Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 13/55] [media] uapi/media.h: Declare interface types for V4L2 and DVB Mauro Carvalho Chehab
[not found] ` <4bf60081a6756f559407052aa92e343456697a08.1440902901.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-09-10 14:19 ` Javier Martinez Canillas
2015-08-30 3:06 ` [PATCH v8 15/55] [media] uapi/media.h: Declare interface types for ALSA Mauro Carvalho Chehab
[not found] ` <ec40936d7349f390dd8b73b90fa0e0708de596a9.1441540862.git.mchehab@osg.samsung.com>
[not found] ` <cd69226f7f42baafbc4a3db5f8a8c387fba879dd.1440902901.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
[not found] ` <ec40936d7349f390dd8b73b90fa0e0708de596a9.1441540862.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-09-06 12:02 ` Mauro Carvalho Chehab
2015-09-10 14:23 ` Javier Martinez Canillas
2015-09-06 12:02 ` [PATCH v8 28/55] [media] uapi/media.h: Fix entity namespace Mauro Carvalho Chehab
[not found] ` <9b372bed2898c86f41c6fe7b7e4e13670701feaf.1441540862.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-09-11 13:06 ` Hans Verkuil
2015-09-06 12:02 ` [PATCH v8 39/55] [media] media controller: get rid of entity subtype on Kernel Mauro Carvalho Chehab
[not found] ` <728826957177ee11793b6b28b4e61e94b2d3068c.1441540862.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-09-11 13:08 ` Hans Verkuil
2015-12-06 1:03 ` Laurent Pinchart
2015-09-06 12:03 ` [PATCH v8 40/55] [media] media.h: don't use legacy entity macros at Kernel Mauro Carvalho Chehab
[not found] ` <3f2e554613f0b1286bd72dfd08f02ac6b874c95e.1441540862.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-12-06 1:02 ` Laurent Pinchart
2015-09-06 12:03 ` [PATCH v8 44/55] [media] uapi/media.h: Add MEDIA_IOC_G_TOPOLOGY ioctl Mauro Carvalho Chehab
[not found] ` <297afcfe4c9c5ebc074f92d1badd34b94e8b28f9.1441540862.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-09-11 13:58 ` Hans Verkuil
2015-12-06 0:47 ` Laurent Pinchart [this message]
2015-12-08 19:23 ` Mauro Carvalho Chehab
[not found] ` <20151208172340.43a76779-+RedX5hVuTR+urZeOPWqwQ@public.gmane.org>
2015-12-08 19:48 ` Arnd Bergmann
2015-08-30 3:06 ` [PATCH v8 28/55] [media] uapi/media.h: Fix entity namespace Mauro Carvalho Chehab
2015-08-31 11:17 ` Hans Verkuil
2015-08-31 12:12 ` Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 38/55] [media] v4l2-subdev: use MEDIA_ENT_T_UNKNOWN for new subdevs Mauro Carvalho Chehab
[not found] ` <662a3bb2bfb02f820f4dafa0033af2cf16d273c5.1440902901.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-08-31 11:43 ` Hans Verkuil
2015-09-06 12:02 ` Mauro Carvalho Chehab
2015-12-06 1:37 ` Laurent Pinchart
2015-12-08 17:38 ` Mauro Carvalho Chehab
2015-08-30 3:06 ` [PATCH v8 39/55] [media] media controller: get rid of entity subtype on Kernel Mauro Carvalho Chehab
[not found] ` <8154aa42b993840dfde2d794e7e9e1f0c57c1e82.1440902901.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-08-31 11:44 ` Hans Verkuil
[not found] ` <cover.1440902901.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-08-30 3:06 ` [PATCH v8 40/55] [media] media.h: don't use legacy entity macros at Kernel Mauro Carvalho Chehab
[not found] ` <720b750e2738f8c70535b01c9c3a3dddf044db69.1440902901.git.mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org>
2015-08-31 11:44 ` Hans Verkuil
2015-08-30 3:06 ` [PATCH v8 44/55] [media] uapi/media.h: Add MEDIA_IOC_G_TOPOLOGY ioctl Mauro Carvalho Chehab
2015-08-31 12:00 ` Hans Verkuil
[not found] ` <55E441EA.4020206-qWit8jRvyhVmR6Xm/wNWPw@public.gmane.org>
2015-08-31 13:35 ` Mauro Carvalho Chehab
2015-08-30 14:27 ` [PATCH v8 00/55] MC next generation patches 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=1647957.hsKJGfKUVG@avalon \
--to=laurent.pinchart-rylnwiuwjnjg/c1bvhzhaw@public.gmane.org \
--cc=linux-api-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-media-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=mchehab-JPH+aEBZ4P+UEJcrhfAQsw@public.gmane.org \
/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).