blob: 7259611981437189f6352c510382a54616a2935f [file] [log] [blame]
Markus Heiser5377d912016-06-30 15:18:56 +02001.. -*- coding: utf-8; mode: rst -*-
2
Mauro Carvalho Chehabd2c68152016-07-09 08:54:35 -03003.. _media_ioc_g_topology:
Markus Heiser5377d912016-06-30 15:18:56 +02004
5**************************
6ioctl MEDIA_IOC_G_TOPOLOGY
7**************************
8
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -03009Name
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030010====
Markus Heiser5377d912016-06-30 15:18:56 +020011
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030012MEDIA_IOC_G_TOPOLOGY - Enumerate the graph topology and graph element properties
Markus Heiser5377d912016-06-30 15:18:56 +020013
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030014
15Synopsis
Markus Heiser5377d912016-06-30 15:18:56 +020016========
17
Mauro Carvalho Chehab5ccbb182016-08-19 16:59:55 -030018.. c:function:: int ioctl( int fd, MEDIA_IOC_G_TOPOLOGY, struct media_v2_topology *argp )
19 :name: MEDIA_IOC_G_TOPOLOGY
Markus Heiser5377d912016-06-30 15:18:56 +020020
Mauro Carvalho Chehab586027c2016-07-05 07:58:48 -030021
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030022Arguments
Markus Heiser5377d912016-06-30 15:18:56 +020023=========
24
25``fd``
26 File descriptor returned by :ref:`open() <media-func-open>`.
27
Markus Heiser5377d912016-06-30 15:18:56 +020028``argp``
29
30
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -030031Description
Markus Heiser5377d912016-06-30 15:18:56 +020032===========
33
34The typical usage of this ioctl is to call it twice. On the first call,
35the structure defined at struct
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030036:c:type:`media_v2_topology` should be zeroed. At
Markus Heiser5377d912016-06-30 15:18:56 +020037return, if no errors happen, this ioctl will return the
38``topology_version`` and the total number of entities, interfaces, pads
39and links.
40
41Before the second call, the userspace should allocate arrays to store
42the graph elements that are desired, putting the pointers to them at the
43ptr_entities, ptr_interfaces, ptr_links and/or ptr_pads, keeping the
44other values untouched.
45
46If the ``topology_version`` remains the same, the ioctl should fill the
47desired arrays with the media graph elements.
48
Mauro Carvalho Chehab1367f4e2017-09-02 19:29:53 -040049.. tabularcolumns:: |p{1.6cm}|p{3.4cm}|p{12.5cm}|
Markus Heiser5377d912016-06-30 15:18:56 +020050
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -030051.. c:type:: media_v2_topology
Markus Heiser5377d912016-06-30 15:18:56 +020052
53.. flat-table:: struct media_v2_topology
54 :header-rows: 0
55 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -030056 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +020057
Hans Verkuil8c4fe242018-06-15 09:19:44 -040058 * - __u64
Markus Heiser5377d912016-06-30 15:18:56 +020059 - ``topology_version``
Markus Heiser5377d912016-06-30 15:18:56 +020060 - Version of the media graph topology. When the graph is created,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030061 this field starts with zero. Every time a graph element is added
62 or removed, this field is incremented.
Markus Heiser5377d912016-06-30 15:18:56 +020063
Hans Verkuil8c4fe242018-06-15 09:19:44 -040064 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +020065 - ``num_entities``
Markus Heiser5377d912016-06-30 15:18:56 +020066 - Number of entities in the graph
67
Hans Verkuil8c4fe242018-06-15 09:19:44 -040068 * - __u32
Hans Verkuilccac77d2018-02-03 13:06:01 -050069 - ``reserved1``
Hans Verkuilccac77d2018-02-03 13:06:01 -050070 - Applications and drivers shall set this to 0.
71
Hans Verkuil8c4fe242018-06-15 09:19:44 -040072 * - __u64
Markus Heiser5377d912016-06-30 15:18:56 +020073 - ``ptr_entities``
Markus Heiser5377d912016-06-30 15:18:56 +020074 - A pointer to a memory area where the entities array will be
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030075 stored, converted to a 64-bits integer. It can be zero. if zero,
76 the ioctl won't store the entities. It will just update
77 ``num_entities``
Markus Heiser5377d912016-06-30 15:18:56 +020078
Hans Verkuil8c4fe242018-06-15 09:19:44 -040079 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +020080 - ``num_interfaces``
Markus Heiser5377d912016-06-30 15:18:56 +020081 - Number of interfaces in the graph
82
Hans Verkuil8c4fe242018-06-15 09:19:44 -040083 * - __u32
Hans Verkuilccac77d2018-02-03 13:06:01 -050084 - ``reserved2``
Hans Verkuilccac77d2018-02-03 13:06:01 -050085 - Applications and drivers shall set this to 0.
86
Hans Verkuil8c4fe242018-06-15 09:19:44 -040087 * - __u64
Markus Heiser5377d912016-06-30 15:18:56 +020088 - ``ptr_interfaces``
Markus Heiser5377d912016-06-30 15:18:56 +020089 - A pointer to a memory area where the interfaces array will be
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -030090 stored, converted to a 64-bits integer. It can be zero. if zero,
91 the ioctl won't store the interfaces. It will just update
92 ``num_interfaces``
Markus Heiser5377d912016-06-30 15:18:56 +020093
Hans Verkuil8c4fe242018-06-15 09:19:44 -040094 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +020095 - ``num_pads``
Markus Heiser5377d912016-06-30 15:18:56 +020096 - Total number of pads in the graph
97
Hans Verkuil8c4fe242018-06-15 09:19:44 -040098 * - __u32
Hans Verkuilccac77d2018-02-03 13:06:01 -050099 - ``reserved3``
Hans Verkuilccac77d2018-02-03 13:06:01 -0500100 - Applications and drivers shall set this to 0.
101
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400102 * - __u64
Markus Heiser5377d912016-06-30 15:18:56 +0200103 - ``ptr_pads``
Markus Heiser5377d912016-06-30 15:18:56 +0200104 - A pointer to a memory area where the pads array will be stored,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300105 converted to a 64-bits integer. It can be zero. if zero, the ioctl
106 won't store the pads. It will just update ``num_pads``
Markus Heiser5377d912016-06-30 15:18:56 +0200107
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400108 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200109 - ``num_links``
Markus Heiser5377d912016-06-30 15:18:56 +0200110 - Total number of data and interface links in the graph
111
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400112 * - __u32
Hans Verkuilccac77d2018-02-03 13:06:01 -0500113 - ``reserved4``
Hans Verkuilccac77d2018-02-03 13:06:01 -0500114 - Applications and drivers shall set this to 0.
115
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400116 * - __u64
Markus Heiser5377d912016-06-30 15:18:56 +0200117 - ``ptr_links``
Markus Heiser5377d912016-06-30 15:18:56 +0200118 - A pointer to a memory area where the links array will be stored,
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300119 converted to a 64-bits integer. It can be zero. if zero, the ioctl
120 won't store the links. It will just update ``num_links``
Markus Heiser5377d912016-06-30 15:18:56 +0200121
122
Mauro Carvalho Chehabfa92b04d2016-08-19 11:14:23 -0300123.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
Markus Heiser5377d912016-06-30 15:18:56 +0200124
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -0300125.. c:type:: media_v2_entity
Markus Heiser5377d912016-06-30 15:18:56 +0200126
127.. flat-table:: struct media_v2_entity
128 :header-rows: 0
129 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300130 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200131
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400132 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200133 - ``id``
Markus Heiser5377d912016-06-30 15:18:56 +0200134 - Unique ID for the entity.
135
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400136 * - char
Mauro Carvalho Chehab8968da92016-07-13 08:43:30 -0300137 - ``name``\ [64]
Markus Heiser5377d912016-06-30 15:18:56 +0200138 - Entity name as an UTF-8 NULL-terminated string.
139
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400140 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200141 - ``function``
Hans Verkuilcccc41f2018-03-19 11:43:24 -0400142 - Entity main function, see :ref:`media-entity-functions` for details.
Markus Heiser5377d912016-06-30 15:18:56 +0200143
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400144 * - __u32
Hans Verkuil793d2a92018-03-19 11:43:17 -0400145 - ``reserved``\ [6]
Markus Heiser5377d912016-06-30 15:18:56 +0200146 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300147 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200148
149
Mauro Carvalho Chehabfa92b04d2016-08-19 11:14:23 -0300150.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
Markus Heiser5377d912016-06-30 15:18:56 +0200151
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -0300152.. c:type:: media_v2_interface
Markus Heiser5377d912016-06-30 15:18:56 +0200153
154.. flat-table:: struct media_v2_interface
155 :header-rows: 0
156 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300157 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200158
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400159 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200160 - ``id``
Markus Heiser5377d912016-06-30 15:18:56 +0200161 - Unique ID for the interface.
162
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400163 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200164 - ``intf_type``
Markus Heiser5377d912016-06-30 15:18:56 +0200165 - Interface type, see :ref:`media-intf-type` for details.
166
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400167 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200168 - ``flags``
Markus Heiser5377d912016-06-30 15:18:56 +0200169 - Interface flags. Currently unused.
170
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400171 * - __u32
Mauro Carvalho Chehab8968da92016-07-13 08:43:30 -0300172 - ``reserved``\ [9]
Markus Heiser5377d912016-06-30 15:18:56 +0200173 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300174 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200175
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400176 * - struct media_v2_intf_devnode
Markus Heiser5377d912016-06-30 15:18:56 +0200177 - ``devnode``
Markus Heiser5377d912016-06-30 15:18:56 +0200178 - Used only for device node interfaces. See
Hans Verkuilb0549002018-03-19 11:11:10 -0400179 :c:type:`media_v2_intf_devnode` for details.
Markus Heiser5377d912016-06-30 15:18:56 +0200180
181
Mauro Carvalho Chehabfa92b04d2016-08-19 11:14:23 -0300182.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
Markus Heiser5377d912016-06-30 15:18:56 +0200183
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -0300184.. c:type:: media_v2_intf_devnode
Markus Heiser5377d912016-06-30 15:18:56 +0200185
Alexandre Courbot7eb2bcb2017-06-07 06:33:02 -0300186.. flat-table:: struct media_v2_intf_devnode
Markus Heiser5377d912016-06-30 15:18:56 +0200187 :header-rows: 0
188 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300189 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200190
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400191 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200192 - ``major``
Markus Heiser5377d912016-06-30 15:18:56 +0200193 - Device node major number.
194
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400195 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200196 - ``minor``
Markus Heiser5377d912016-06-30 15:18:56 +0200197 - Device node minor number.
198
Mauro Carvalho Chehabfa92b04d2016-08-19 11:14:23 -0300199.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
Markus Heiser5377d912016-06-30 15:18:56 +0200200
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -0300201.. c:type:: media_v2_pad
Markus Heiser5377d912016-06-30 15:18:56 +0200202
203.. flat-table:: struct media_v2_pad
204 :header-rows: 0
205 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300206 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200207
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400208 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200209 - ``id``
Markus Heiser5377d912016-06-30 15:18:56 +0200210 - Unique ID for the pad.
211
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400212 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200213 - ``entity_id``
Markus Heiser5377d912016-06-30 15:18:56 +0200214 - Unique ID for the entity where this pad belongs.
215
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400216 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200217 - ``flags``
Markus Heiser5377d912016-06-30 15:18:56 +0200218 - Pad flags, see :ref:`media-pad-flag` for more details.
219
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400220 * - __u32
Hans Verkuilb0549002018-03-19 11:11:10 -0400221 - ``index``
222 - Pad index, starts at 0. Only valid if ``MEDIA_V2_PAD_HAS_INDEX(media_version)``
223 returns true. The ``media_version`` is defined in struct
224 :c:type:`media_device_info` and can be retrieved using
225 :ref:`MEDIA_IOC_DEVICE_INFO`.
226
227 * - __u32
228 - ``reserved``\ [4]
Markus Heiser5377d912016-06-30 15:18:56 +0200229 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300230 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200231
232
Mauro Carvalho Chehabfa92b04d2016-08-19 11:14:23 -0300233.. tabularcolumns:: |p{1.6cm}|p{3.2cm}|p{12.7cm}|
Markus Heiser5377d912016-06-30 15:18:56 +0200234
Mauro Carvalho Chehabe8be7e92016-08-29 17:37:59 -0300235.. c:type:: media_v2_link
Markus Heiser5377d912016-06-30 15:18:56 +0200236
Alexandre Courbot7eb2bcb2017-06-07 06:33:02 -0300237.. flat-table:: struct media_v2_link
Markus Heiser5377d912016-06-30 15:18:56 +0200238 :header-rows: 0
239 :stub-columns: 0
Mauro Carvalho Chehab89268142016-07-06 07:31:59 -0300240 :widths: 1 2 8
Markus Heiser5377d912016-06-30 15:18:56 +0200241
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400242 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200243 - ``id``
Alexandre Courbot7eb2bcb2017-06-07 06:33:02 -0300244 - Unique ID for the link.
Markus Heiser5377d912016-06-30 15:18:56 +0200245
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400246 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200247 - ``source_id``
Markus Heiser5377d912016-06-30 15:18:56 +0200248 - On pad to pad links: unique ID for the source pad.
249
Hans Verkuilafd11792018-02-03 14:18:38 -0500250 On interface to entity links: unique ID for the interface.
Markus Heiser5377d912016-06-30 15:18:56 +0200251
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400252 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200253 - ``sink_id``
Markus Heiser5377d912016-06-30 15:18:56 +0200254 - On pad to pad links: unique ID for the sink pad.
255
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300256 On interface to entity links: unique ID for the entity.
Markus Heiser5377d912016-06-30 15:18:56 +0200257
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400258 * - __u32
Markus Heiser5377d912016-06-30 15:18:56 +0200259 - ``flags``
Markus Heiser5377d912016-06-30 15:18:56 +0200260 - Link flags, see :ref:`media-link-flag` for more details.
261
Hans Verkuil8c4fe242018-06-15 09:19:44 -0400262 * - __u32
Hans Verkuil793d2a92018-03-19 11:43:17 -0400263 - ``reserved``\ [6]
Markus Heiser5377d912016-06-30 15:18:56 +0200264 - Reserved for future extensions. Drivers and applications must set
Mauro Carvalho Chehab0579e6e2016-07-04 16:25:48 -0300265 this array to zero.
Markus Heiser5377d912016-06-30 15:18:56 +0200266
267
Mauro Carvalho Chehab15e7d612016-07-05 15:14:35 -0300268Return Value
Markus Heiser5377d912016-06-30 15:18:56 +0200269============
270
271On success 0 is returned, on error -1 and the ``errno`` variable is set
272appropriately. The generic error codes are described at the
273:ref:`Generic Error Codes <gen-errors>` chapter.
274
275ENOSPC
276 This is returned when either one or more of the num_entities,
277 num_interfaces, num_links or num_pads are non-zero and are
278 smaller than the actual number of elements inside the graph. This
279 may happen if the ``topology_version`` changed when compared to the
280 last time this ioctl was called. Userspace should usually free the
281 area for the pointers, zero the struct elements and call this ioctl
282 again.